Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Assignments 

Value Assignments

You use value assignments to change the content of a variable by assigning the content of another data object to it. This section deals with the statements designed exclusively for value assignments to variables. However, value assignments also appear in other statements, in which the content of a variable is changed.

When assigning the value of a source object (source) to a destination object (destination), three cases can be distinguished with respect to the data type:

  • source and destination are compatible, which means that all technical type attributes match. The content is copied from source to destination without being converted. For flat data objects and related character-like or byte-like structural areas, a copy of the source object is created to the exact byte. For deep data objects, a reference is created in the destination object, the actual byte-like content of which cannot be seen externally. When entire structures are assigned, the response in terms of alignment gaps is undefined: The binary content of an alignment gap in the destination structure can either be copied from the source structure or retain the original value.
  • source and destination are not compatible, but can be converted. The content of source is converted in accordance with the conversion rules and then copied to destination. Two data types are convertible if a conversion rule exists for them. An exception is raised if the content of source cannot be handled in accordance with the conversion rules. After an exception, the content of destination is determined by the category of the data type. An assignment that requires a conversion is always slower than an assignment without conversion.
  • If the data objects are neither compatible nor convertible, then no assignment can take place. If the syntax check detects this situation, a syntax error is displayed; otherwise an exception is raised when the program is executed.
  • The following statements are designed for value assignments:

    • = for multiple assignments

    Other versions: 7.31 | 7.40 | 7.54

    Continue

    MOVE

    destination1 = destination2 = ...

    MOVE-CORRESPONDING

    UNPACK