Area MY_AREA is created in Transaction SHMA with the area root class CL_MY_DATA.
Once an area handle that is referenced by my_handle has been created, which is bound to an area instance version of the MY_AREA area with write authorization, an instance of the area root class CL_MY_DATA of the area is created, sets it as a root object and calls a method there that imports the data into the object.
DATA: my_handle TYPE REF TO cl_my_area,
my_data TYPE REF TO
cl_my_data.
TRY.
my_handle = cl_my_area=>attach_for_write(
).
CREATE OBJECT my_data AREA HANDLE
my_handle.
my_handle->set_root( my_data ).
my_data->read_spfli( ).
my_handle->detach_commit( ).
CATCH cx_shm_attach_error.
...
ENDTRY.
In a different program, the shared object can be accessed as follows, by calling a method here that outputs the object’s data.
DATA my_handle TYPE REF TO cl_my_area.
TRY.
my_handle = cl_my_area=>attach_for_read(
).
my_handle->root->output_spfli( ).
my_handle->detach( ).
CATCH cx_shm_attach_error.
...
ENDTRY.