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.

Notes



Continue
Data References
Object References
Heap References and Stack References