DATA BEGIN OF struc [READ-ONLY].
...
{DATA comp ...} | {INCLUDE {TYPE|STRUCTURE} ...}.
...
DATA END OF struc.
The declaration of a new structure struc is opened using a DATA statement with the addition BEGIN OF and must be ended using a DATA statement with the addition END OF.
Within these two DATA statements, any
DATA statements, particularly any further closed structures, and the statements
INCLUDE TYPE and INCLUDE
STRUCTURE can be included. 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.
The addition READ-ONLY is only possible for the whole structure, and not for individual structure components comp.
In this example, a structure spfli_struc is declared with an elementary component index and a substructure spfli_wa. The SELECT loop shows one 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.
WRITE: / spfli_struc-index,
spfli_struc-spfli_wa-carrid,
spfli_struc-spfli_wa-carrid.
ENDSELECT.