SAP CREATE OBJECT AREA HANDLE ABAP Statements

Get Example source ABAP code based on a different SAP table
  



CREATE OBJECT - AREA HANDLE

Short Reference
• AREA HANDLE CREATE OBJECT

ABAP_BASIC_FORM_3 CREATE OBJECT oref AREA HANDLE handle ... .

What does it do? 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 refer to an area handle and the area handle must be associated to an area instance version with a change lock. To create such a reference, you can do either of the following: 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.
Inheritthe 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 mode and the statement CREATE OBJECT acts as if without the addition AREA HANDLE.

Latest 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, but when you load the shared memory-enabled class 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.



Example ABAP Coding
See Creating an
Instance of a Class as a Shared Object



Runtime Exceptions

Catchable Exceptions
CX_SHM_WRONG_HANDLE
Reason for error:
The area handle does not hold any change locks.

CX_SHM_ALREADY_DETACHED
Reason for error:
The area handle is not bound to an area instance version.

CX_SHM_OUT_OF_MEMORY
Reason for error:
There is not enough memory.

CX_SHM_OBJECT_NOT_SERIALIZABLE
Reason for error:
An attempt was made to create an object that cannot be serialized in an area instance that can be displaced with backup and recovery.

Return to menu