Repetitive Structures (PA-PAD)In many master data infotypes, data is entered in table form. This, for example, allows you to enter up to twenty different wage types and their amounts. The input line for the wage type is available seven times on the input template. By scrolling, you can enter up to twenty wage types.
The structure of the wage type line is stored in the infotype structure P0008, and the individual fields are numbered from one to twenty. This means that each field of the wage type table is defined.
When evaluating repeat structures, you must ensure that all fields are entered. In the case of the
Basic Pay
infotype, 20 * 5 = 100 fields are queried.
A loop offers a more streamlined method of evaluation. Here, one line of the repeat structure is evaluated each time the loop is executed.
To use this method of evaluation, define a field string whose structure corresponds to the fields in one line of the repetitive structure.
In this field string, one line of the basic pay wage types is evaluated each time the loop is executed.
Example
REPORT RPABAP06.
TABLES:PERNR.
INFOTYPES: 0008.
DATA: BEGIN OF WAGETYPES,
LGA LIKE P0008-LGA01,
BET LIKE P0008-BET01,
ANZ LIKE P0008-ANZ01,
EIN LIKE P0008-EIN01,
OPK LIKE P0008-OPK01,
END OF WAGETYPES.
GET PERNR.
RP_PROVIDE_FROM_LAST P0008 SPACE PN-BEGDA PN-ENDDA.
DO 20 TIMES VARYING WAGETYPES
FROM P0008-LGA01
NEXT P0008-LGA02.
IF WAGETYPES-LGA IS INITIAL.
EXIT.
ELSE.
WRITE: / WAGETYPES-LGA, WAGETYPES-BET.
ENDIF.
ENDDO.
Repeat structures are also found in the
Leave Entitlement, Cost Distribution, Appraisals,
and
Wage Maintenance
infotypes. They are also evaluated in this way.