SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → Declarations → Declaration Statements → Data Types and Data Objects → Declaring Data Objects → DATA →
DATA - BEGIN OF
Syntax
DATA BEGIN OF struc [READ-ONLY].
...
INCLUDE TYPE|STRUCTURE ...
...
DATA END OF struc.
Effect
Declaration of a new structure struc. This starts with a DATA statement with the addition BEGIN OF and must end with a DATA statement with the addition END OF.
The following can be included between these DATA statements:
The meaning of these statements is the same as in the definition of structured data types in the section TYPES - BEGIN OF, but here it is used to generate a bound structured data type. No structure can be created without at least one component.
A component of type struc cannot be declared by referencing struc
itself. If the name struc is specified after LIKE in the declaration of a component, the next object of this name is searched for in a higher
visibility area, and used if found. If a more global object of this name does not exist, a syntax error occurs.
Notes
Example
In this example, a structure spfli_struc is declared with an elementary component index and a substructure spfli_wa. The SELECT loop shows a possible use of the nested structure.
DATA: BEGIN OF spfli_struc,
index TYPE i,
spfli_wa TYPE spfli,
END OF spfli_struc.
SELECT *
FROM spfli
INTO spfli_struc-spfli_wa.
spfli_struc-index = spfli_struc-index + 1.
cl_demo_output=>next_section( |{ spfli_struc-index }| ).
cl_demo_output=>write_data( spfli_struc-spfli_wa ).
ENDSELECT.
cl_demo_output=>display( ).