Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Declarations →  Declaration Statements →  Data Types and Data Objects →  Types and Objects - Overview 

Compatible Data Types

The compatibility of two data types (except reference types) is based on the technical type attributes of the data types. It is the basis for type checking in assignments to field symbols or when assigning actual parameters to formal parameters.

In the case of value assignments and comparisons between data objects (except reference variables), compatibility also determines whether a conversion has to be performed or not.

In the case of reference types with data objects (reference variables) that have a dynamic type alongside the static type, a compatibility concept based entirely on technical type attributes is not sufficient.

Other versions: 7.31 | 7.40 | 7.54

Non-Generic Data Types Except Reference Types

Two non-generic data types (not reference types) and data types that contain reference types as components are compatible if all their technical type attributes match.

  • The length (in the case of the types c, n, p, and x)
With compatible elementary data types, all these attributes match.
  • the component structure
The layout of structured types does not only refer to the sequence of elementary components in memory, but also to the combination of components with substructures and whether a substructure is a boxed component. The names of the components and of the semantic attributes defined in ABAP Dictionary , such as conversion routines or documentation, however, are not important. With compatible structures, all components are compatible in pairs. This applies recursively down to the level of elementary data types.
If two structures are both constructed identically but different substructures are declared as boxed components, then the structures are not compatible.
  • In the case of table types, the technical type attributes are as follows:
With compatible internal tables, the row types are compatible and table category and table key match. Other attributes, such as the initial memory requirement, are not important.
  • In the case of mesh types, the technical type attributes are as follows:
  • The layout of nodes (including the node names)
  • The mesh associations (defined by ON conditions) of every component, including names and the table key used
  • In the case of enumerated types, the technical type attributes are as follows:
  • All properties of the enumerated type
Every enumerated type is unique and only compatible with itself.


  • The types listed here are not compatible with one another - for example, an elementary data type is never compatible with a structure, even if the structure has only one component.

  • The statement TYPES cannot be used to define different enumerated types with the same technical type properties. Even data types constructed with RTTC methods exactly like an existing enumerated type are not compatible with it. An enumerated type defined by direct or indirect reference (including RTTI) to an existing enumerated type, is compatible with it however.

Generic Data Types

A non-generic data type (not a reference type) is compatible with a generic data type if its technical attributes are covered by the generic data type.

Reference Types

A reference type is the static type of reference variables and determines to which objects they can point. At runtime, reference variables also have a dynamic type determined by the type of the object, which a reference variable points to. The dynamic type may be more specialized than the static type. For this reason, the rules for typing checks, assignments and comparisons cannot be covered by the idea of a compatibility that is based entirely on the technical attributes of the static type. Instead, the following three issues show how reference types can be used together:

  • When checking typings, a reference variable can
  • A reference variable can be passed to a formal parameter typed as a reference variable, provided that the type of the formal parameter is more general or equal to the type of the reference variable (known as an up cast) and the formal parameter cannot be changed within the procedure.
  • be assigned to a field symbol typed as a reference variable, provided that the reference types are identical.
  • Assignments between reference variables can be made by using an up cast or a down cast.
  • Data reference variables can be compared to all data reference variables and object reference variables can be compared to all object reference variables.

As a rule, you can only use data reference variables with data reference variables and object reference variables only with object reference variables. No conversions take place between reference variables. They are either passed without conversion or assigned to each other or compared to each other or not.


  • These rules for the usability of reference variables for assignments is one-way. The type of a target reference variable, to which a source reference variable can be assigned, does not itself have to be assignable to the source reference variable. In contrast, the usability of reference variables in the case of comparisons is not a one-way relationship.

  • If a reference variable is a component of a structure, the usability of the structure is determined accordingly. In particular, the usability of this structure type with regard to assignments is also a one-way relationship.