05-27-2008 8:25 AM
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.
05-27-2008 8:29 AM
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.
05-27-2008 8:26 AM
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.
05-27-2008 8:26 AM
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.
05-27-2008 8:27 AM
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
05-27-2008 8:29 AM
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.
05-27-2008 8:31 AM
Hi..
You can use statment APPEND LINES OF itab1 [FROM idx1] [TO idx2] TO itab2.
Regards,
N M Poojari.
05-27-2008 8:31 AM
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
05-27-2008 8:33 AM
both shuld be of same structure .
data : itab1 type table of mara,
itab2 like table of itab1.
append itab1 to itab2.