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

Moving data from 2 internal table into 1 internal table

Former Member
0 Likes
1,873

Hi Experts,

suppose i've declared 2 internal tables and structure is same for both of them i.e.

itab1

f1

f2

f3

f4

itab2

f1

f2

f3

f4

now i want to transfer the data from these internal tables into another internal table (itab3) which is also of same type.

itab3.

f1

f2

f3

f4

suppose itab1 is having 10 records and itab2 is having 20 records. now i want all the records i.e. 30 records into itab3. pls give me the logic.

regards

Faisal

1 ACCEPTED SOLUTION
Read only

alejandro_bindi
Active Contributor
0 Likes
970

Adbul, use this:


APPEND LINES OF itab1 TO itab3.
APPEND LINES OF itab2 TO itab3.

http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb36c8358411d1829f0000e829fbfe/content.htm

Regards

Hi Experts,

suppose i've declared 2 internal tables and structure is same for both of them i.e.

itab1

f1

f2

f3

f4

itab2

f1

f2

f3

f4

now i want to transfer the data from these internal tables into another internal table (itab3) which is also of same type.

itab3.

f1

f2

f3

f4

suppose itab1 is having 10 records and itab2 is having 20 records. now i want all the records i.e. 30 records into itab3. pls give me the logic.

regards

Faisal

3 REPLIES 3
Read only

Former Member
0 Likes
970

Hi Abdul,

You said you are having 10 records in itab1,20 records in itab2.You want to move these records into itab3.

try this.

data : begin of itab occurs 0,

f1 type c,

f2 type c,

end of itab.

data : jtab like itab occurs 0 with header line,

ktab like itab occurs 0 with header line.

itab-f1 = '5'. itab-f2 = '6'. append itab.

do 3 times.

move itab to jtab.

append jtab.

enddo.

move itab( ) to ktab( ).

append ktab.

loop at jtab.

append jtab to ktab.

endloop.

loop at ktab.

write : / ktab-f1 , ktab-f2.

endloop.

Award points if useful...

Thanks,

Ravee...

Edited by: ravee on May 15, 2008 7:52 PM

Read only

BGarcia
Active Contributor
0 Likes
970

Hello Faisal,

If it helps, here's another aproach:


INSERT LINES OF itab1 INTO TABLE itab3.
INSERT LINES OF itab2 INTO TABLE itab3.

The itab3 table will get all itab1 and itab2 records.

Regards,

Bruno

Read only

alejandro_bindi
Active Contributor
0 Likes
971

Adbul, use this:


APPEND LINES OF itab1 TO itab3.
APPEND LINES OF itab2 TO itab3.

http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb36c8358411d1829f0000e829fbfe/content.htm

Regards