CREATE DATA - AREA HANDLE
CREATE DATA dref AREA HANDLE handle ...
handle expects an object reference variable whose static type is CL_ABAP_MEMORY_AREA or one of its subclasses
(area class). When the statement is executed,
handle must point to an
area handle and the area
handle must be associated with an area instance version with a change lock. A reference like this can be created in one of the following ways:
- Inherit the return value of the methods ATTACH_FOR_WRITE or ATTACH_FOR_UPDATE of an area class created using transaction SHMA.
- Inherit the return value of the GET_HANDLE_BY_... method of any area class.
Inherit the return value of the method GET_IMODE_HANDLE of the predefined class CL_IMODE_AREA.
The latter is a reference to an area handle for the current
internal session and
CREATE DATA operates as if the addition
AREA HANDLE is not specified.
The creation of anonymous data objects as shared objects is subject to the following restrictions for data references in the shared objects memory: The storage of data references in closed area instance versions of the shared objects memory is restricted to such dynamic types that are known when loading a program into an internal session.
Therefore, the following data types cannot be used to create anonymous data objects in the shared object memory, if these are to be preserved in a closed area instance version:
GENERATE SUBROUTINE POOL.
Points 3 and 4 include the statement
CREATE DATA with the addition
AREA HANDLE itself. Exceptions to the restrictions listed under points 2 to 4 are:
The restrictions are not valid for data type
The restrictions are not valid for data types
xas long as the storage requirements do not exceed 100 bytes.
If a data reference variable that is stored in the shared objects memory refers to an anonymous data object of a dynamic type that is subject to the restrictions, the exception of the class CX_SHM_EXTERNAL_TYPE is raised when the DETACH_COMMIT method is executed.
The following can be used without restriction:
- All visible data types of global interfaces and classes.
- Data elements, structures, and database tables and table types from ABAP Dictionary.
- Data types from type groups.
Bound data types of anonymous data objects created at program runtime to which a static type with a static length was assigned when they were created with
Bound data types of anonymous data objects created at program runtime to which a fully specified dynamic type was assigned when they were created with
All data types that were created statically in the same program with declarative statements. However,
it should be noted that it is no longer possible to access existing area instances once the creating program is changed.
TABLE OF can be used
until the specified types fulfill above requirements. This also applies for the addition
HANDLE, that means the type description object must have been created with methods of the RTTI from allowed types.
- The only shared object that can be addressed directly from an ABAP program after a connection to an area instance version is the instance of the area root class. All other objects have to be referenced in this instance. In particular, there is no direct access to anonymous data objects possible. Instead, the instance of the area root class must contain references to these anonymous data objects, which can also be indirect.
It is best to use only global data types with
AREA HANDLE. As an occasional replacement for the direct reference to data elements and table types from ABAP Dictionary, the respective types can be created in global interfaces, classes, or even type groups.
Cause: The area handle does not hold any change locks.
Cause: The area handle is not bound to an area instance version.
Cause: There is not enough memory.