Ansicht
Dokumentation

ABAPCREATE_DATA_AREA_HANDLE - CREATE DATA AREA HANDLE

ABAPCREATE_DATA_AREA_HANDLE - CREATE DATA AREA HANDLE

Vendor Master (General Section)   General Material Data  
This documentation is copyright by SAP AG.
SAP E-Book

CREATE DATA, AREA HANDLE

Short Reference



CREATE DATA dref AREA HANDLE handle ...

Effect

This statement creates an anonymous data object as a shared object in the area instance version of the shared memory to which the area handle referenced by handle is bound.

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 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 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 DATA works in the same way as without the addition AREA HANDLE.

Restrictions

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 those 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:

  1. All data types created in a temporary subroutine pool created using GENERATE SUBROUTINE POOL.
  2. Data types created dynamically at program runtime using methods of the RTTC.
  3. Bound data types of anonymous data objects created at program runtime, to which a dynamic length was assigned when they were created with CREATE DATA.
  4. Bound data types of anonymous data objects created at program runtime and that were assigned a dynamic type that requires a length specification when they were created using CREATE DATA.

Points 3 and 4 particularly include the statement CREATE DATA with the addition AREA HANDLE itself. Exceptions to the restrictions listed in points 2 to 4 are:

  • The restrictions do not apply to the data type p.
  • The restrictions do not apply to the data types c, n, and x, as long as the memory requirement does 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 restrictions:

  • All visible data types of global interfaces and classes.
  • Data elements, DDIC structures, and DDIC database tables and DDIC table types of the ABAP Dictionary.
  • Data types from type pools.
  • 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 using CREATE DATA.
  • Bound data types of anonymous data objects created at program runtime to which a fully specified dynamic type was assigned when they were created using CREATE DATA.
  • All data types that were created statically in the same program using declarative statements. It should be noted, however, that it is no longer possible to access existing area instances after each change to the creating program.

The additions REF TO and TABLE OF can be used as long as the specified types meet the above requirements. This also applies to the addition HANDLE, which means the type description object must have been created with methods of the RTTI from allowed types.

Notes

  • The only shared object that can be addressed from an ABAP program directly after an area instance version is bound is the instance of the area root class. All other objects must be referenced in this instance. In particular, no direct access to anonymous data objects is possible. Instead, the instance of the area root class must contain references to these anonymous data objects, which can also be indirect.
  • It is recommended that only global data types together with AREA HANDLE are used. As an occasional replacement for the direct reference to data elements and table types of the ABAP Dictionary, the respective types can be created in global interfaces, classes, or even type pools.

Example

Creation of an anonymous structure in an area instance version of area CL_DEMO_AREA.

Creating a Data Object as a Shared Object

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.





TXBHW - Original Tax Base Amount in Local Currency   rdisp/max_wprun_time - Maximum work process run time  
This documentation is copyright by SAP AG.

Length: 8382 Date: 20240616 Time: 102715     sap01-206 ( 113 ms )