Show TOC

Type ConversionsLocate this document in the navigation structure

Every time you assign a data object to a variable, the data types involved must either be compatible , that is, their technical attributes (data type, field length, number of decimal places) must be identical, or the data type of the source field must be convertible into the data type of the target field.

In ABAP, two non-compatible data types can be converted to each other if a corresponding conversion rule exists. If data types are compatible, no conversion rule is necessary.

In each MOVE statement, the content of the source field for any compatible data objects is copied to the target field byte by byte. For any non-compatible data objects, the content of the source field is converted to the data type of the target object. Type conversions take longer than copying. For all ABAP operations that perform value assignments between data objects (for example, arithmetic operations or filling internal tables), the system handles all the necessary type conversions as for the MOVEstatement. If you try to assign values between two data types for which no conversion rule exists, a syntax error or runtime error occurs.

For more information about the explicit conversion rules between non-compatible elementary data types in ABAP, see the ABAP keyword documentation (F1 help).

Assignment Rules for Reference Variables

Conversion Rules for Structures

Conversion Rules for Internal Tables

For some ABAP statements that pass data between different objects, the alignment of the data objects is also important.