APPEND - 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 append either a workarea wa, an inital row INITIAL LINE or several rows of an internal table jtab.

Alternative 1

... wa


Effect

A new row is appended to which the content of the workarea wa is assigned. wa may be incompatible to the row type of the internal table; if so, it is converted according to the conversion rules into the row type.

Note

Outside of classes, you can omit wa TO if the internal table has a header line itab of the same name. The statement implicitly uses the header line as the workarea.

Alternative 2

... INITIAL LINE


Effect

A new row is appended, for which each component contains the initial value of correct type from the table of the value ranges of built-in ABAP types.

Alternative 3

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


Effect

The rows of an internal table jtab are appended according to the same rules that apply for appending a workarea, in the sequence in which they exist in jtab. If jtab is an index table, you can restrict the rows to be appended by specifying FROM idx1 and TO idx2. In this case, only the table rows starting at table index idx1 or ending at table index idx2 from jtab are appended. For idx1 and idx2, data objects of type i are expected. If the value idx1 or idx2 is less than 0, an untreatable exception occurs. If idx1 is greater than idx2 or greater than the number of table rows, no rows are appended. If idx2 is greater than the number of table rows, it is set to the number of table rows.

Example

Appending square numbers to a sorted table with elementary row type.

DATA: int  TYPE i,
      itab LIKE SORTED TABLE OF int
           WITH UNIQUE KEY table_line.

DO 10 TIMES.
  int = sy-index ** 2.
  APPEND int TO itab.
ENDDO.