SAP CREATE OBJECT AREA HANDLE ABAP Statements



Get Example source ABAP code based on a different SAP table
  


ID CREATE-OBJECT-AREA-HANDLE
• AREA HANDLE CREATE OBJECT

CREATE OBJECT, AREA HANDLE
Short Reference

ABAP_SYNTAX
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, to which the area handle referenced by handle is bound. The implicitly or explicitly specified class must be defined as a shared-memory-enabled class using the addition SHARED MEMORY ENABLED of the statement CLASS.
For handle, an object reference variable whose static type is CL_ABAP_MEMORY_AREA or one of its subclasses (area class) must be specified. When the statement is executed, handle must point to an area handle and the area handle must be bound to an area instance version with a change lock. A reference like this can be created in one of the following ways:
By inheriting the return value of the methods ATTACH_FOR_WRITE or ATTACH_FOR_UPDATE of an area class created using transaction SHMA.
By inheriting the return value of the method GET_HANDLE_BY_... of any area class.
By inheriting 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 ABAP_ISESS and the statement CREATE OBJECT works in the same way as without the addition AREA HANDLE.



Latest notes:

The only shared object that can be addressed from an ABAP program directly after a binding is made to an area instance version is the instance of the area root class. All other objects must be referenced in this instance.
The static attributes of a shared object are not created in the shared memory, but when the shared-memory-enabled class is loaded into the ABAP_ISESS of a program, as for every class. This means that they can exist multiple times and independently of one another in different programs.
ABAP_HINT_END



Example ABAP Coding

Creation of a shared object in an area instance version of the area CL_DEMO_AREA.
ABEXA 00162
ABAP_EXAMPLE_END

ABAP_EXAMPLE_ABEXA
Creating an Instance of a Class as a Shared Object
ABAP_EXAMPLE_END



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:
In an area instance displaceable using backup and recovery, an attempt was made to create an object that cannot be serialized.

Return to menu