Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Assignments →  Assignment Rules →  Conversion Rules for Structures 

Conversion Between Flat Structures and Single Fields

Other versions: 7.31 | 7.40 | 7.54

Conversion Outside of Unicode Programs

Outside of 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 possible alignment gaps. In this case, the assignment between the structure and the single field takes place according to the conversion rules between the data type c and the data type of the single field (see Conversion Rules for Elementary Data Types).


Note

Assignments of this type are only advisable if the corresponding structure only contains character-like components. If you assign a single field to a structure that does not only contain character-like components, the content of these components will usually then no longer match the data type, so that it will no longer be possible to evaluate them individually.

Conversion in Unicode Programs

The following rules apply in Unicode programs when converting a flat structure to a single field and vice versa:

  • If a structure is purely character-like, it is processed during 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 c and 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 treated 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, so that assignment is not possible.


Note

If a syntax error occurs due to an inadmissible assignment between flat structures and single fields, you can display the fragment view of the corresponding structure when displaying the syntax error in the ABAP Editor by choosing the pushbutton with the information icon.