Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

HR Repeative Structures

Former Member
0 Likes
868

Hello,

Can some one give me a neat explaination or document with a example scenario and code on repeative stuctures please.

Regards

SDN Powered

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
653

Hi ,

Repititive structures in HR are basically used to store amounts for the different wagetypes or u can say dates for the Different action ,

Please refer the sample codes ,

basically we access the values for the Repititive structures in the

code through do varying ,

DATA : BEGIN OF S_DATETYPE,

DAR TYPE P0041-DAR01,

DAT TYPE P0041-DAT01,

END OF S_DATETYPE.

RP_PROVIDE_FROM_LAST P0041 SPACE PN-BEGDA PN-ENDDA.

IF PNP-SW-FOUND = 1.

DO 12 TIMES VARYING S_DATETYPE-DAR FROM P0041-DAR01 NEXT P0041-DAR02

VARYING S_DATETYPE-DAT FROM P0041-DAT01 NEXT P0041-DAT02.

IF S_DATETYPE-DAR IS INITIAL.

EXIT.

ENDIF.

  • Hire Date Type.

IF S_DATETYPE-DAR = C_HR.

IT_OUTPUT-HIRE_TYPE = S_DATETYPE-DAT.

ENDIF.

  • Rehire Date Type.

IF S_DATETYPE-DAR = C_RH.

IT_OUTPUT-REHIRE = S_DATETYPE-DAT.

ENDIF.

  • Seniority Date Type.

IF S_DATETYPE-DAR = C_SN.

IT_OUTPUT-SENIORITY = S_DATETYPE-DAT.

L_VAR = SY-DATUM - S_DATETYPE-DAT.

L_VAR = L_VAR / 365.

IT_OUTPUT-D_YEARS = L_VAR.

ENDIF.

IF S_DATETYPE-DAR = C_DD.

IT_OUTPUT-DEATH = S_DATETYPE-DAT.

ENDIF.

ENDDO.

ENDIF.

hope u find it usefull

4 REPLIES 4
Read only

Bhaskar_Tripath
Participant
0 Likes
653

Hi,

Example for understanding the repetitive structure

Say, for an employee you want to know that for what all wage type

an employee is eligible for the latest period you mentioned on the

selection screen.

REPORT ZRP_REPETITIVE_STR NO STANDARD PAGE HEADING.

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.

GET pernr.

DO 20 TIMES VARYING s_wagetypes FROM p0008-lga01 NEXT p0008-lga02.

IF s_wagetypes-wagetype IS INITIAL.

EXIT.

ELSE.

WRITE: / s_wagetypes-wagetype,

s_wagetypes-amount.

ENDIF.

ENDDO.

Reward if useful.

Regards,

Bhaskar

Read only

0 Likes
653

HI Bhaskar,

I am getting an error " P0008-LGA01 and S_WAGETYPES are type-incompatible". when I copied this into se38 and ran syntax check.

Thanks

SDN POWERED

Read only

Former Member
0 Likes
653

Hi,

check the sample code

data: it_0041 like p0041 occurs 0 with header line.

data: v_dar like p0041-dar01,

v_date like p0041-dat01.

select * from pa0041 into table it_0041 up to 1 rows.

loop at it_0041.

write:/5 'Employee = ', 15 it_0041-pernr.

skip.

do 12 times varying v_dar from it_0041-dar01 next it_0041-dar02

varying v_date from it_0041-dat01 next it_0041-dat02.

write:/5 'Date type = ', 25 v_dar,

50 'Date = ', 70 v_date.

enddo.

endloop.

Note: check the table T770P which contains infotype versus repeat structures.

Read only

Former Member
0 Likes
654

Hi ,

Repititive structures in HR are basically used to store amounts for the different wagetypes or u can say dates for the Different action ,

Please refer the sample codes ,

basically we access the values for the Repititive structures in the

code through do varying ,

DATA : BEGIN OF S_DATETYPE,

DAR TYPE P0041-DAR01,

DAT TYPE P0041-DAT01,

END OF S_DATETYPE.

RP_PROVIDE_FROM_LAST P0041 SPACE PN-BEGDA PN-ENDDA.

IF PNP-SW-FOUND = 1.

DO 12 TIMES VARYING S_DATETYPE-DAR FROM P0041-DAR01 NEXT P0041-DAR02

VARYING S_DATETYPE-DAT FROM P0041-DAT01 NEXT P0041-DAT02.

IF S_DATETYPE-DAR IS INITIAL.

EXIT.

ENDIF.

  • Hire Date Type.

IF S_DATETYPE-DAR = C_HR.

IT_OUTPUT-HIRE_TYPE = S_DATETYPE-DAT.

ENDIF.

  • Rehire Date Type.

IF S_DATETYPE-DAR = C_RH.

IT_OUTPUT-REHIRE = S_DATETYPE-DAT.

ENDIF.

  • Seniority Date Type.

IF S_DATETYPE-DAR = C_SN.

IT_OUTPUT-SENIORITY = S_DATETYPE-DAT.

L_VAR = SY-DATUM - S_DATETYPE-DAT.

L_VAR = L_VAR / 365.

IT_OUTPUT-D_YEARS = L_VAR.

ENDIF.

IF S_DATETYPE-DAR = C_DD.

IT_OUTPUT-DEATH = S_DATETYPE-DAT.

ENDIF.

ENDDO.

ENDIF.

hope u find it usefull