ARTIClE
Internal Tables, Nested Tables
This example demonstrates how nested internal tables are declared and
used.
ABAP_SOURCE_CODE
ABAP_EXEC
ABAP_DESCRIPTION
The example shows the declaration of two internal tables
t_address_tab and company_tab , where t_address_tab is
contained in company_tab . For this purpose t_address_tab
is defined as the table type. The component addresses of the
company structure is declared with this type. The data type of
company is used as the row type for the tables company_tab and
company_sorted_tab .
The internal table is filled using the value operator
VALUE .
A row from company_tab is assigned to the field symbol
fs using READ and its table-like
component addresses is processed in a
LOOP . The content of the row is
assigned to the structure address . Since addresses is an
index table, sy-tabix can be analyzed.
To change the content of the component street of a row of the
inner table addresses , the index of the relevant row is
determined using a READ statement and it is then used in
MODIFY . To make the changes effective in
the corresponding row of the outer hashed table as well, the key access
of the MODIFY statement is used.
Finally, the hashed table is assigned a sorted table with the same row
type. In this way, the entries are automatically sorted by the table key
name . However, the entries of the inner standard table are
sorted using the SORT command.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved