Ansicht
Dokumentation

ABENSTRUCTURE_FILLING_ABEXA - STRUCTURE FILLING ABEXA

ABENSTRUCTURE_FILLING_ABEXA - STRUCTURE FILLING ABEXA

BAL Application Log Documentation   Vendor Master (General Section)  
This documentation is copyright by SAP AG.
SAP E-Book

Filling a Structure

The example demonstrates the filling of a nested structure.

Source Code

Execute

Description

In this example, the structure from the executable example Declaring a Nested Structure is defined with TYPES as the data type address_type and used for the data objects addr and address. A separate structure type is also defined for each of the substructures.

If a structure is declared with the statement DATA by reference to a structure type as shown here, the addition VALUE cannot be used. Instead, the structure must be filled by accessing the components. In particular, this also applies to the frequently occurring reference to structures of the ABAP Dictionary. There are mainly two ways for doing this:

  • In the first part of the method main, the structure addr is filled using the structure component selector. The component name is assigned a prefilled structure. In the components street and city, the components that are nested there are accessed.
  • In the second part of the method main, the structure address is filled with the value operator VALUE, but the structure itself is created using an inline declaration. The parentheses after VALUE show different options for accessing the components of substructures. Either the structure component selector is used again in the same way as for the substructure name, or additional VALUE operators are nested, such as for street and city.

The content of both structures is the same. The value operator VALUE represents the modern way, where the need of expressing all the component names explicitly is replaced by the use of parentheses.






Addresses (Business Address Services)   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.

Length: 2274 Date: 20240425 Time: 125328     sap01-206 ( 45 ms )