09-15-2008 5:18 AM
Hi friends,
I have the following requirement. Please provide me a solution.
eg: 1st Internal Table Structure (having 100 records)
A type char(10),
B type char(10),
C type char(10)
2nd Internal Table Structure ( having no records)
A type char(10),
B type char(10),
C type char(10),
D type char(10)
I want to copy data from Ist internal table to 2nd internal table at one go (in a single step) considering all the performance aspects. I don't want to use MOVE-CORRESPONDING in this case.
Thanks in Advance.
09-15-2008 5:41 AM
Hi,
In such cases best to use APPEND LINES syntax.
You can also append internal tables to index tables using the following statement:
APPEND LINES OF itab1 TO itab2.
This statement appends the whole of ITAB1 to ITAB2. ITAB1 can be any type of table, but its line type must be convertible into the line type of ITAB2.
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.
reference : help.sap.com
thanx.
09-15-2008 5:20 AM
hi
i dont think there is a way of transfering data in one step.
you to use loop and move-corr
regards
vivek
09-15-2008 5:20 AM
2nd_itab[ ] = 1st_itab[ ].
Edited by: -=Bo0h=- on Sep 15, 2008 6:21 AM
09-15-2008 5:23 AM
09-15-2008 5:41 AM
Hi,
In such cases best to use APPEND LINES syntax.
You can also append internal tables to index tables using the following statement:
APPEND LINES OF itab1 TO itab2.
This statement appends the whole of ITAB1 to ITAB2. ITAB1 can be any type of table, but its line type must be convertible into the line type of ITAB2.
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.
reference : help.sap.com
thanx.
09-15-2008 11:23 AM
The fastest way is
table2[] = table1[]
because you copy the first three fields in the same order in the second table and cut the third field. In othe way you need to make a loop and move-corresponding and append
09-15-2008 11:24 AM
table2 [ ] = table1 [ ]
When i talk about third field is fouth field
sorry
09-15-2008 11:28 AM
hi
in ur case i think it is not possible because
append lines of itab1 to itab2 can be used only they are of same structure
or
itab1 = itab2
this is also for the same case
so only thing is move corresponding
itab 1 to itab 2
with regards
s.janagar
09-15-2008 11:36 AM