sapdev logo background
sapdev logo sapdev logo
Comments

SAP DATA REFERENCES documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

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.
  • Data References

  • Object References

  • Heap references and stack references


  • 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.

  • Internally, strings , internal tables , and boxed component s are also addressed using references (however these references do not appear as the content of reference variables).
    Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




  • DATA_PROCESS_FIELDS_ABEXA
    DATA_REFERENCE_GLOSRY




    comments powered by Disqus