INCLUDE
ARTICLE
Cannot Use Anonymous Components in Structures
You cannot declare anonymous components when you define a structured
data object using the DATA , CLASS-DATA , STATICS ,
or CONSTANTS statements in ABAP Objects.
In ABAP Objects, the following statements cause an error message:
DATA: BEGIN OF struc,
'Text Literal',
space(10) [TYPE c],
text(10) TYPE c VALUE 'Text Field',
END OF struc.
Correct syntax:
DATA: BEGIN OF struc,
text1(12) TYPE c VALUE 'Text Literal',
blanks(10) TYPE c VALUE IS INITIAL,
text2(10) TYPE c VALUE 'Text Field',
END OF struc.
Cause:
You should be able to address each component in a structure explicitly.
If you declare literals, or the special name space in the
structure definition, nameless text fields are included as components.
For literals, the initial and value correspond to the content of the
literal. For space , the system creates a text field filled with
spaces. These anonymous text fields cannot be addressed explicitly in
programs. In particular, structures never contain components with the
name space . You can only access anonymous components using the
structure name and offset/length addressing. You can easily replace
these nameless components with named components. Named components
increase the function of anonymous components by allowing them to be
accessed explicitly, without limiting their role as, for example, as
filler fields.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved