Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Assignments 

Assignment Rules

The following sections describe the rules for assignments. Usually, compatible data objects are assigned without conversion, whereas a type conversion is performed for incompatible data objects. For each assignment between incompatible data objects, the system searches for a suitable conversion rule to carry out the assignment.

If a rule exists for two data types, the two types are convertible. According to a basic rule for all conversions, the content of the source field must represent a meaningful value for the data type of the target field.

If a suitable conversion rule is not found or the content of the source field is not suitable, a syntax errors occurs or an exception is raised.

Conversion rules exist for:

Slightly different rules apply for conversions between

The conversion rules explained here generally apply to all statements in which the contents of data objects are changed. Exceptions to these rules are explained for each individual statement. Differences between Unicode and non- Unicode programs programs are also explained.

Other versions: 7.31 | 7.40 | 7.54


Notes

  • In some cases, for comparisons, different rules apply than the usual rules for assignments. In particular, exceptions that can be resolved for assignments, cannot be resolved for comparisons.

  • The EXACT addition for the MOVE statement can be used to perform checks before the conversion is carried out. These ensure that only applicable values are assigned and that no values are lost during the assignment process.

  • Checks generally are not made on assignments between compatible data objects. If a data object already contains an invalid value, for example an invalid date or time in a date or time field, then this value is passed just like a valid value if the assignment is being made to a compatible data object.

Programming Guideline

Avoid unexpected conversion results

Continue

Conversion Rules for Elementary Data Objects

Conversion Rules for Structures

Conversion Rules for Internal Tables

Assignment Rules for Reference Variables

System Classes for Converting Character Sets and Number Formats

Conversions - Performance Note