ABAP Keyword Documentation → ABAP - Reference → Processing Internal Data → Assignments → Assignment and Conversion Rules → Conversion Rules for Structures
Conversion Between Flat Structures and Single Fields
The following rules apply when converting a flat structure to a single field and vice versa:
- If a structure is purely character-like, it is handled in the conversion like a data object of the type
c(casting). The single field can have any elementary data type.
- If the structure is not purely character-like, the single field must have the type
cand the structure must begin with a character-like fragment that is at least as long as the single field. The assignment takes place only between this fragment and the single field. The character-like fragment of the structure is handled like a data object of the type
c(casting) in the assignment. If the structure is the target field, the remaining character-like fragments are filled with blanks and all other components with the initial value that corresponds to their type.
No conversion rule is defined for any other cases, and assignments are not possible.
Other versions: 7.31 | 7.40 | 7.54
- If a syntax error occurs due to an invalid assignment between flat structures and single fields, the fragment view of the corresponding structure can be displayed when displaying the syntax error in ABAP Editor by choosing the pushbutton with the information icon.
- In obsolete
non-Unicode programs, the structure involved is regarded as a single field of type
c(casting), whose length is determined by the length of its components and any alignment gaps. In this case, the assignment between the structure and the single field is done in accordance with the conversion rules between the data type
cand the data type of the single field (see Conversion Rules for Elementary Data Types). Assignments of this type are only advisable if the structure in question only contains character-like components. If a single field is assigned to a structure that does not only contain character-like components, the content of these components usually then no longer matches the data type, which means that it is no longer possible to evaluate them individually.