SAP APPEND LINES ABEXA



Get Example source ABAP code based on a different SAP table
  



ABAP_ITAB - Appending Lines
This example demonstrates how lines can be appended to internal tables.

ABAP_SOURCE_CODE
DEMO CL_DEMO_INT_TBLS_APPEND

ABAP_DESCRIPTION
The example has three parts:
In the first part, the internal table wa_tab is created with two columns and filled in the loop DO. In each pass of the loop, a line with initial values is appended, then a structure of the line type is constructed and appended from the loop index and the square of the loop index.
In the second part, two internal tables tab1 and tab2 are created. tab2 has a deep structure, since the second component of the line type has the data type of the table tab1. Structures of the line type line1 are appended to tab1. After this, a structure with the line type line2 is constructed and appended to tab2. After tab1 has been initialized using the statement CLEAR, the same process is repeated.
In the final part, two lines of the internal table jtab are appended to the internal table itab using the statement APPEND and the addition LINES OF.



Latest notes:

It could be better to use the value operator VALUE for internal tables instead of using APPEND VALUE #( ... ) shown here.
NON_V5_HINTS
ABAP_HINT_END