ARTICLE
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 .
Access to Shared Objects
If you are in an internal session and you want to use a reference of
this type to read or write to objects in area instances of the shared
memory, you need to connect an area handle
to an area instance version, in order 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,
you can work with the references 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
You can use the static methods
GET_HANDLE_BY_OREF ,
GET_HANDLE_BY_DREF , and
GET_HANDLE_BY_DATA 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
DETACH_COMMIT method of the area
handle after change accesses, no references from an area instance
version are allowed to point to anything external. After the
DETACH_COMMIT method, 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 .
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved