sitemap
ABAP HR
Repetitive Structures processing
In many master data infotypes the data is stored in the form of repetitive structures. For
example infotype 0008, the structure wage type line is available for 20 times, that is an
employee is eligible for having 20 different wage types based on his benefits. 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.
To use this method of evaluation, define a field string whose structure corresponds to the
fields in one line of the repetitive structure.
Example for understanding the repetitive Structure
Say, for an employee you want to know that for what all wage types an employee is eligible
for the latest period you mentioned on the selection screen.
Using LDB (PNP)
Program:
Report zhk_repstru.
Tables Pernr.
Infotypes 0008.
- You have to declare a structure same as repetitive structure in the 0008 infotype
Data: begin of s_wagetypes,
Wagetype type p0008-lga01,
Amount type p0008-bet01,
Hours type p0008-anz01,
Unit type p0008-ein01,
Ind type p0008-opk01,
End of s_wagetypes,
- Selecting data from the Data base Get pernr
- Getting the latest record based on the selection period.
RP_PROVIDE_FROM_LAST P0008 SPACE PN-BEGDA PN-ENDDA.
- Now knowing for what all wage types the employee is eligible.
Do 20 times varying s_wagetypes from p0008-lga01 next p0008-lga02. If
s_wagetypes-wagetype is initial.
Here the data is stored sequentially, i.e., if the employee is eligible for 5 wage types
then all the 5 wage types are stored sequentially in lga01 to lga05 respectively. So, if
say the lga05 is initial then it is understood that, employee is eligible for only 4 wage
types and from lga05 to lga20 structures will be empty so, we need not process
further
Exit.
Else.
Write: / s_wagetypes-wagetype,
S_wagetypes-amount.
Endif.
Enddo.
All of the product names here are trademarks of their respective companies. The site
www.allsaplinks.com no way affiliated with SAP AG. We have made every effort for the content
integrity. Information used on this site is at your own risk.