Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Declarations →  Declaration Statements →  Data Types and Data Objects →  Types and Objects - Overview →  Details of Special Data Types or Data Objects 

Reference Types

References are pointers to instances. Pointers to data objects are known as data references. Pointers to instances of classes are known as object references. In ABAP, references occur as the content of reference variables. Reference variables are data objects whose data type is a reference type.

Reference types are always created with the addition REF TO. The content of reference variables can be checked using the predicate expression IS BOUND.

The reference type is the static type of a reference variable. It defines the types of the instances its references can point to. The dynamic type of a reference variable is the type from which an object (to which a reference variable points) was instanced. The static type is always more general than or the same as the dynamic type. A dynamic type can be a data type or a class. A reference type or static type can be a type for a data reference variable or object reference variable. The latter is subdivided into class reference variables and interface reference variables.

Special conversion rules apply for assignments between reference variables, depending on the static type. These rules ensure that the dynamic type is never more general than the static type (up cast, down cast).

Depending on where the object referenced by a reference variable is located, memory-retaining heap references or non-memory-retaining stack references are used.

Other versions: 7.31 | 7.40 | 7.54


Notes

  • From a technical point of view, a reference in ABAP does not refer directly to an object; instead it refers to what is known as a header that contains the address of the actual object as well as additional information. See also Memory Management of Deep Data Objects.

  • As well as the regular references in reference variables, weak references represented by objects from a system class can also be used.

Continue

Data References

Object References

Heap References and Stack References