Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Copying data from one internal table to another internal table.

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.

Tags:
Former Member
Former Member replied

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.

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question