Ansicht
Dokumentation

ABENSHARED_OBJECTS2_ABEXA - SHARED OBJECTS2 ABEXA

ABENSHARED_OBJECTS2_ABEXA - SHARED OBJECTS2 ABEXA

Vendor Master (General Section)   ABAP Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

- Writing to and Reading from Area

This example demonstrates the writing to and reading from an area.

Source Code

Execute

Description

Area Root Class

The global class CL_DEMO_SO_ROOT is used as an area root class. It contains three data objects number, first_name and last_name as private attributes. The methods WRITE and READ are used to set values for the data objects and read those values.

Area

CL_DEMO_SH_OB_AREA is used as an area whose properties are maintained in the transaction SHMA. The lifetime after the last access is limited to five minutes to prevent memory space from being occupied in the shared memory without a program requiring it.

Description

The internal table values is filled with data the writing and reading procedure is based on. It also provides instance names.

The table is looped across to write the entries to the area. First, an area is created before any data can be written to the shared memory using the method ATTACH_FOR_WRITE. This method call includes the instance name that is provided in the internal table. This method returns a handle to the area (or instance), that has just been created in the shared memory. Then, a root object is created for the instance using a CREATE OBJECT ... AREA HANDLE ... statement that includes the handle returned by the method call before. The WRITE method of the root reference is called providing the values for the attributes that are stored in the shared memory. Calling the DETACH_COMMIT method releases the change lock.

The internal table is looped across again to read from the instances using the instance names. The ATTACH_FOR_READ method is called using those instance names and the area handle as parameters. Using the READ method, the values of the attributes of the individual instances that have been created before are retrieved from the shared memory. Calling the DETACH method releases the read lock.

After the program call, the area instance versions can be examined in transaction SHMM.






BAL_S_LOG - Application Log: Log header data   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.

Length: 3352 Date: 20240426 Time: 065802     sap01-206 ( 65 ms )