SAP OS PERSISTENCE REFS
Get Example source ABAP code based on a different SAP table
ABAP_OS - Persistent Object References
At runtime, the persistence service works with the instances of persistent classes, which are generally addressed and kept alive using references, as is usual in ABAP Objects. If a reference to a persistent object is to be persisted beyond the runtime of an ABAP program, for example, to work with the same object later in another ABAP program, it must be stored persistently.
To store this information in a database, two table fields of the type
Both fields of an OID of this type can be mapped to a single attribute of a persistent class. This attribute provides a reference to the relevant persistent object. The persistence service then handles this reference, which is not a reference variable in the original ABAP Objects sense. It also loads the persistent object to which the reference points from the database.
Creating these two fields for the class GUID and the instance GUID does not make sense unless the tables are used as the basis for a persistent class. The most common use case is to save references to other persistent objects in a persistent object accessed by a semantic key (business key), where these other objects are managed by instance GUIDs, and cannot be accessed otherwise, that is, where objects are closely interlinked.
Latest notes:
When a persistent object is loaded that contains a reference to another persistent object as an attribute, an instance is created in the memory for the latter, but its persistent attributes are only loaded when required and not straight away.
ABAP_HINT_END