ABAP Keyword Documentation → ABAP - Reference → Creating Objects and Values → Shared Objects → Shared Objects - Objects
Shared Objects - References
Objects in area instance versions are instances of classes or anonymous data objects and therefore they can only really be addressed using heap references.
Other versions:
7.31 | 7.40 | 7.54
Access to Shared Objects
To use a reference of this type to read or write to objects in area instances of the shared memory from within an internal session, it is necessary to connect an area handle to an area instance version, to set a suitable area lock. The root object that can reference additional objects is used for the initial access to the objects in an area instance version.
References from the area instance version to internal session objects can exist and objects of the area instance version can be used in the internal session (but only if an area handle exists for an area instance version in an internal session). As long as an area lock exists, the references can be used as usual, with the restriction that the type of lock determines whether or not the referenced objects of the area instance version can be changed. If there is a read or change access to the content of an object of the area instance version, although there is no corresponding lock, then a runtime error occurs.
Note
The static methods GET_HANDLE_BY_OREF, GET_HANDLE_BY_DREF, and GET_HANDLE_BY_DATA can be used to obtain a reference to the area handle of an object. The corresponding return value is of general type CL_ABAP_MEMORY_AREA, which is why this sort of reference is really only suitable for creating objects.
Completed Area Instance Versions
Area instances that are not bound to any area handles are self-contained. If the lock is released using the method DETACH_COMMIT of the area handle after change accesses, no references from an area instance version are allowed to point to anything external. After the method DETACH_COMMIT, any external references that refer to objects of the area instance version can no longer be used to access these objects. Links between the shared objects of a completed area instance version can be created by using object references and data references.
A special restriction applies to data references in completed area instance versions: the
dynamic type of these
references must be a known type when a program is loaded in an internal session. The data types that
cannot be used to create anonymous data objects as shared objects are listed under the addition
AREA HANDLE
of statement CREATE DATA
.