‎2008 Aug 28 4:30 PM
data : text type char10.
text = 'ME'.
data : val1 type string.
try.
o_area = zcl_mar_area=>attach_for_write( ).
create object o_sme area handle o_area.
o_area->set_root( o_sme ).
o_sme->value = 'TEXT'.
o_area->detach_commit( ) .
catch cx_shm_attach_error.
endtry.
data : val1 type string.
try.
data : hdl type ref to zcl_mar_area,
root type ref to zcl_mar_shma.
hdl = zcl_mar_area=>attach_for_read( ).
val1 = hdl->root->value.
* TRY.
data : oref type ref to cx_root,
text type string,
text1 type string.
* itab_fms = hdl->root->itab.
catch cx_shm_inconsistent into oref.
text1 = oref->get_text( ).
catch cx_shm_change_lock_active into oref.
text1 = oref->get_text( ).
catch cx_shm_exclusive_lock_active into oref.
text1 = oref->get_text( ).
catch cx_shm_read_lock_active into oref.
text1 = oref->get_text( ).
catch cx_shm_no_active_version into oref.
text = oref->get_text( ).
if hdl is not INITIAL.
hdl->detach( ).
hdl->detach_commit( ).
endif.
*TRY.
data: rc type shm_rc.
CALL METHOD zcl_mar_area=>invalidate_instance
EXPORTING
inst_name = CL_SHM_AREA=>DEFAULT_INSTANCE
terminate_changer = ABAP_TRUE
receiving
rc = rc
.
* CATCH cx_shm_parameter_error .
*ENDTRY.
endtry.
TRY.
CALL METHOD zcl_mar_area=>free_instance
EXPORTING
inst_name = CL_SHM_AREA=>default_instance
terminate_changer = ABAP_TRUE
receiving
rc = rc
.
CATCH cx_shm_parameter_error .
ENDTRY.
I am getting this dump - SYSTEM_SHM_AREA_OBSOLETE
PLease help
‎2008 Aug 28 4:48 PM
Works as designed.
Quote from documentation for free_instance:
After this method has been executed, all programs where area handles still exist for the released area instance versions are terminated with the SYSTEM_SHM_AREA_OBSOLETE runtime error.
Not sure why your are using free instance anyway. The invalidation should be sufficient. Also at the beginning of your code, you use detach and detach_commit in succession, detach_commit is enough to close the changing connection.