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

Problem in Internal table Record Splitting

Former Member
0 Likes
401

Hi All,

Plz look into my below requirement and me know your Suggestions.

My Internal tables :

1.*Internal table for Infotype 2002 (Attendances)

DATA : BEGIN OF T_PA2002 OCCURS 0,

PERNR LIKE PA2002-PERNR,

BEGDA LIKE PA2002-BEGDA,

ENDDA LIKE PA2002-ENDDA,

BEGUZ LIKE PA2002-BEGUZ,

ENDUZ LIKE PA2002-ENDUZ,

SUBTY LIKE PA2002-SUBTY,

END OF T_PA2002.

1.*Internal table for Infotype 9003 (Custom Attendances)

DATA : BEGIN OF T_PA9003HRABS OCCURS 0,

PERNR LIKE PA9003-PERNR,

BEGDA LIKE PA9003-BEGDA,

ENDDA LIKE PA9003-ENDDA,

SHIFT LIKE PA9003-SHIFT,

OTHOURS LIKE PA9003-OTHOURS,

BEGUZ LIKE PA2002-BEGUZ,

ENDUZ LIKE PA2002-ENDUZ,

NSA LIKE PA9003-NSA,

MA LIKE PA9003-MA,

CA LIKE PA9003-CA,

END OF T_PA9003HRABS.

Requirement :

1. Internal table T_PA2002

PERNR BEGDA ENDDA BEGUZ ENDUZ

5 27.12.2006 27.12.2006 10:00:00 14:30:00

2. Internal table T_PA9003HRABS

PERNR BEGDA ENDDA BEGUZ ENDUZ HRABS OTHOURS MA CA WA

5 27.12.2006 27.12.2006 08:00:00 14:30:00 2 2

Iam doing comparision between T_PA2002 and T_PA9003HRABS.

Iam doing some caluculation to get Hourly absence,OT Hours and else ( Fields)

So my Hourly absence on 27.12.2006 was 2Hours.

So i need to split my Final table as below how to do that....( It is like In infotypes COPY option i.e 1 record to 3 Record )

I need the Output like this...

3. Final Internal table T_PA9003HRABS

PERNR BEGDA ENDDA BEGUZ ENDUZ HRABS OTHOURS MA CA WA

5 25.12.2006 26.12.2006 08:00:00 14:30:00 0 0

5 27.12.2006 27.12.2006 08:00:00 14:30:00 2 2

5 25.12.2006 26.12.2006 08:00:00 14:30:00 0 0

Points will be rewarded.

Thanks,

Suresh.U

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
358

you could:

sort T_PA2002 by pernr.

sort T_PA9003HRABS by pernr.

loop at T_PA2002

read table T_PA9003HRABS with key

pernr = T_PA2002-pernr

begda = T_PA2002-begda

binary search.

***here you can specify how you calculate

***your absences and apply them to your

***final internal table.

endloop.

hope this helps.

Warren

2 REPLIES 2
Read only

Former Member
0 Likes
359

you could:

sort T_PA2002 by pernr.

sort T_PA9003HRABS by pernr.

loop at T_PA2002

read table T_PA9003HRABS with key

pernr = T_PA2002-pernr

begda = T_PA2002-begda

binary search.

***here you can specify how you calculate

***your absences and apply them to your

***final internal table.

endloop.

hope this helps.

Warren

Read only

Former Member
0 Likes
358

sort T_PA2002 by pernr.

sort T_PA9003HRABS by pernr.

loop at T_PA2002

read table T_PA9003HRABS with key

pernr = T_PA2002-pernr

begda = T_PA2002-begda

binary search.

<write code for calculating>.

endloop.