Skip to Content
0
Former Member
Nov 27, 2009 at 10:18 PM

cant get different instances of shared object

41 Views

Hi all,

I am encountering a problem in setting a handle of a shared object...

I programmed a solution similar to the example in the sap help portal:

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 objectu2019s 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.

My Problem is now, I am having a root class with an internal table as an attribute.

This internal table gets instanced every time I am creating my Object. But I want

ONLY ONE INSTANCE of my object. Because I want to read from the same internal

table that I am writing to before.

<< Removed >>

Regards,

HProkoph

Edited by: HProkoph on Nov 27, 2009 11:18 PM

Edited by: Rob Burbank on Nov 27, 2009 5:28 PM