INSERT - line_spec

Syntax

... {wa}
  | {INITIAL LINE}
  | {LINES OF jtab [FROM idx1] [TO idx2]} ... .

Alternatives:

1. ... wa

2. ... INITIAL LINE

3. ... LINES OF jtab [FROM idx1] [TO idx2]

Effect

You can insert a work area wa, an initial line INITIAL LINE or multiple lines of an internal table jtab.

Alternative 1

... wa


Effect

A new line is generated and filled with the content of the work area wa. wa must be compatible with the line type of the internal table when you insert the lines or work area using the table key. When you insert the lines or work area using the table index, wa can be incompatible with the line type of the internal table and may be converted to the line type according to the conversion rules, if necessary.

Note

Outside of classes, you can omit the specification of wa INTO if the internal table contains a header line itab with the same name. In this case, the statement implicitly uses the header line as the work area.

Alternative 2

... INITIAL LINE


Effect

A new line is inserted in which each component contains the type-specific initial value from the table of value ranges of built-in ABAP types.

Alternative 3

... LINES OF jtab [FROM idx1] [TO idx2]


Effect

The lines of an internal table jtab are inserted one after another according to the same rules as for the insertion of a work area. The line types of itab and jtab must be compatible. If jtab is an index table, you can specify FROM idx1 and TO idx2 to restrict the lines to be inserted. In this case, only the table lines from the table idx1 onward and/or up to the table index idx2 are inserted from jtab. Data objects of the type i are expected for idx1 and idx2. If idx1 or idx2 is less than or equal to 0, an exception that cannot be handled is raised. If idx1 is greater than idx2 or greater than the number of table lines, no lines are inserted. If idx2 is greater than the number of table lines, it is set to the number of table lines.

Note

If a conflict with an already existing unique table key occurs, an exception that cannot be handled is caused when inserting multiple lines from an internal table.