Application Development 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: 

Need to merge two same structure internal table.

Former Member
0 Kudos

Dear gurus,

I have two same internal table with around 70,000 records in each table now i want to merge both internal table so there will be no repetition of same record in table. Is this statement will work? Internal table has 6 field. 4 field are numc or char and last 2 fields are packed decimal. if there is any other good idea please let me know. If question is not clear let me know.

COLLECT LINES IT_CYD2 TO IT_CYD4.

Thanks in advance.

Dave.

3 REPLIES 3

uwe_schieferstein
Active Contributor
0 Kudos

Hello Dave

If you intention is to summarize the two itabs then the COLLECT statement is correct.

However, according to the ABAP keyword documentation you can collect only one record at a time.

If you do not want to summarize then you may have a look at my Wiki posting:

[Comparing Two Internal Tables - A Generic Approach|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/comparing%2btwo%2binternal%2btables%2b-%2ba%2bgeneric%2bapproach]

Regards

Uwe

Former Member
0 Kudos

Hi,

You can use following code if you do not want to have duplicate entries in itab2 from itab1.

loop at itab1

read table itab2 from itab1.

if sy-subrc ne 0.

append itab2 from itab1.

endif.

endloop.

collect will not work.

Former Member
0 Kudos

use

append lines of it2[] to it1[].

Edited by: DEBOPRIYO MALLICK on May 30, 2008 5:39 AM