DATA - BEGIN OF
Short Reference
ABAP Syntax_4 DATA BEGIN OF struc
[READ-ONLY] .
...
DATA comp ... [ BOXED ]
INCLUDE TYPE|STRUCTURE ...
...
DATA END OF struc.
What does it do? 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:
Any DATA statements, in particular further closed structures.
INCLUDE TYPE and
INCLUDE STRUCTURE 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.
Wenn die Struktur struc im Deklarationsteil einer Klasse als
Attribut der Klasse deklariert wird, kann eine Unterstruktur mit dem
Zusatz BOXED als
statische Box deklariert
werden.
Latest notes: The addition READ-ONLY can
only be used for whole structures and not for individual structure
components comp .
A structure called text cannot have any components with
three-character names, since these are reserved for addressing
text symbols . It is best never to call a
structure text and avoid any conflicts with text symbols.
The BOXED addition cannot be specified
between DATA BEGIN OF and DATA END OF when declaring
components. Static boxes in structures can only be defined with
TYPES .
The value operator
VALUE can be used to
construct the content of
structures.
In an obsolete variant , text field
literals or the constant space can be specified between BEGIN
OF and END OF as anonymous components.
The use of the addition OCCURS
for defining standard tables with structured row types is obsolete.
Example ABAP Coding 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( ).
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved