SAP APPEND LINES ABEXA

Get Example source ABAP code based on a different SAP table
  


ARTIClE

Internal Table, Appending Rows
This example demonstrates how rows are appended to internal tables.

ABAP_SOURCE_CODE
ABAP_EXEC

ABAP_DESCRIPTION
In the first part of this example, the internal table itab is created with two columns and filled in the loop DO. At each pass of the loop, a row with initial values is added, after which the table work area is filled with the loop index and the square of the loop index and then appended.
In the second part of this example two internal tables, tab1 and tab2, are created. tab2 has a deep structure because the second component of line2 has the same data type as tab1. line1 is filled and appended to tab1. line2 is filled next and appended to tab2. After tab1 has been initialized using the REFRESH statement, the same procedure is repeated.
Finally, three rows are added to the internal table itab using APPEND statement and the SORTED BY addition. The row with the smallest value in the field col2 is dropped because the number of rows for this APPEND statement is limited to two using INITIAL SIZE.