SAP DATA REFERENCES



Get Example source ABAP code based on a different SAP table
  



References
References are pointers to instances. Pointers to data objects are data references. Pointers to instances of classes are object references. References occur in ABAP as the content of reference variables. Reference variables are data objects whose data type is a reference type.
Reference types are always created using 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 to which types of instances its references can point. The dynamic type of a reference variable is the type from which an object was instantiated to which a reference variable points. 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 an object reference variable. The latter are subdivided into class reference variables and interface reference variables.
Special conversion rules apply to assignments between reference variables, depending on the static type. These rules ensure that the dynamic type is never more general than the static type (upcast, downcast).
Depending on where the object referenced by a reference variable is stored, memory-preserving heap references or non-memory-preserving stack references can be distinguished. Special weak references that are represented by objects of a system class, do not keep an object alive.
Data references
Object references
Heap references and stack references
Weak references
A reference in a reference variable is valid if it points to an object. For this, the predicate expression IS BOUND is true. A non-initial reference can be invalid if it points to deleted objects. A heap reference that points to a line in an internal table can become invalid if the line is deleted. A stack reference can become invalid if the referenced data object is removed from the stack.



Latest notes:

From a technical perspective, a reference in ABAP does not refer directly to an object but to a header instead, which contains the address of the actual object and other administrative information. See also Memory Management of Deep Data Objects.
Internally, strings, internal tables, and boxed components are also addressed using references, which do not appear as the content of reference variables.
NON_V5_HINTS
ABAP_HINT_END