ABAP Keyword Documentation → ABAP - Reference → Creating Objects and Values → CREATE OBJECT
CREATE OBJECT - AREA HANDLE
Other versions: 7.31 | 7.40 | 7.54
Syntax
CREATE OBJECT oref AREA HANDLE handle ...
Effect
This statement creates an object as a shared object in the
area instance version of the
shared memory, which is bound to the
area handle referenced by handle
. The implicitly or explicitly specified class must be defined as a
shared memory enabled class
using the SHARED
MEMORY ENABLED addition of the CLASS
statement.
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
the statement CREATE OBJECT
operates as if the addition AREA HANDLE
is not specified.
Notes
- 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.
-
The static attributes of a shared object are not created in the shared memory. Instead, they are created
when the shared memory-enabled class is loaded in the internal session of a program, like for every class. They can thus occur more than once and independently of one another in different programs.
Exceptions
Catchable Exceptions
CX_SHM_WRONG_HANDLE
-
Cause: The area handle does not hold any change locks.
CX_SHM_ALREADY_DETACHED
-
Cause: The area handle is not bound to an area instance version.
CX_SHM_OUT_OF_MEMORY
-
Cause: There is not enough memory.
CX_SHM_OBJECT_NOT_SERIALIZABLE
-
Cause: An attempt was made to create an object that cannot be serialized in an area instance that can be displaced using backup and recovery.