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: 

Append

Former Member
0 Kudos

hi,

if i need to append one internal table to another what do i need to do?

i have made changes in internal table 1.

now i need to move this internal table 1 to internal table 2.??

please help me.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Check the code below:

Loop at itab1 into wa1.
append wa1 to itab2.
or move-corresponding wa1 to wa2.
append wa2 to itab2.
endloop.
or 
itab2[] = itab1[]. "If both structures are same.

Regards

Kannaiah.

7 REPLIES 7

former_member156446
Active Contributor
0 Kudos

if both are of same structure then u can use

 append lines of itab1 to itab2. 

if not then you have to loop at one table and move-corresponding entries into another table.


loop at itab1 into wa_itab1.

move-corresponding wa_itab1 to wa_itab2.

modify table itab2 using wa_itab2.
clear: wa_itab1, wa_itab2.

endloop.

Former Member
0 Kudos

itab2[] = itab1[]. if the internal tables are of same type.

else you need to move manually all the fields to another inrenal table by looping at itab1.

Former Member
0 Kudos

DATA: ITAB1 TYPE STANDARD TABLE OF I WITH NON-UNIQUE

DEFAULT KEY INITIAL SIZE 100, ITAB 2 TYPESTANDARD TABLE OF I WITH NON-UNIQUE

DEFAULT KEY INITIAL SIZE 100.

APPEND 2 TO ITAB1.

APPEND 3 TO ITAB1.

APPEND 5 TO ITAB1.

APPEND 7 TO ITAB1.

APPEND 3 TO ITAB2.

APPEND INITIAL LINE TO ITAB2.

APPEND LINES OF ITAB1 FROM 2 TO 20 TO ITAB2.

Thanks

Sujith

Former Member
0 Kudos

Hi,

Check the code below:

Loop at itab1 into wa1.
append wa1 to itab2.
or move-corresponding wa1 to wa2.
append wa2 to itab2.
endloop.
or 
itab2[] = itab1[]. "If both structures are same.

Regards

Kannaiah.

Former Member
0 Kudos

Hi..

You can use statment APPEND LINES OF itab1 [FROM idx1] [TO idx2] TO itab2.

Regards,

N M Poojari.

Former Member
0 Kudos

Hi,

This method of appending lines of one table to another is about 3 to 4 times faster than appending them line by line in a loop. After the APPEND statement, the system field SY-TABIX contains the index of the last line appended. When you append several lines to a sorted table, you must respect the unique key (if defined), and not violate the sort order. Otherwise, a runtime error will occur.

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

Regards,,

Shiva Kumar

Former Member
0 Kudos

both shuld be of same structure .

data : itab1 type table of mara,

itab2 like table of itab1.

append itab1 to itab2.