Skip to content

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 thus 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 perform reads or writes on objects in area instances of the shared memory from an internal session, a suitable area lock must be set by binding an area handle to an area instance version. The root object, that can reference additional objects, is used for the initial access to the objects in an area instance version.

Objects of the area instance version can be used in the internal session and references can be made from the area instance version to objects in the session (but only if an area handle exists for an area instance version in the session). The references can be used as usual for lifetime of an area lock, with the restriction that the type of lock determines whether or not the referenced objects of the area instance version can be modified. If a read or write is performed on the content of an object in the area instance version despite there being no associated lock, 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 get 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 kind of reference is generally 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 writes, no references from an area instance version are allowed to point to anything external. After the method DETACH_COMMIT, any external references that reference objects of the area instance version can no longer be used to access these objects. The shared objects within a completed area instance version can be associated 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 specified under the addition AREA HANDLE of the statement CREATE DATA.