SAP Tutorials Blog

 

Inserting Lines:

INSERT [{<wa>|INITIAL LINE} INTO] <itab> [INDEX <idx>].


Inserts a new line into table. For tables with a header line the source area can be omitted. With INDEX option, the new line is inserted before the line which has the index <idx>. After the insertion, the new entry has the index <idx> and the index of the following lines is incremented by 1.

If the table consists of <idx> - 1 entries, the system appends the new entry after the last existing table line. If the table has less than <idx> - 1 entries, the system cannot insert the entry: SY-SUBRC = 4. If success, SY-SUBRC = 0.

Use INSERT without the INDEX option is allowed only within a LOOP - ENDLOOP loop by inserting the new entry before the current line (i.e. the line which has the index returned by SY-TABIX).

INSERT LINES OF <itab1> [FROM <idx1>] [TO <idx2>] INTO <itab2> [INDEX <idx>].

Inserts lines from one table into another table. Default inserts entire table. Can be up to 20 times faster than inserting lines line by line in a loop.


Serkan AKKAVAK

Computer Engineer BSc

SAP Department Manager

Contact : serkurumsal@yandex.com