Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to identify the sender in an event handler of alv grid

Koja78
Participant
0 Kudos

Hi,

I have two objects of a cl_gui_alv_grid class, both tied to the same event handler object.

In handling the user_command event of cl_gui_alv_grid, I need to know which one of both grids is actually the one calling. ( I need to know which internal table to edit)

How do I do that as you only receive the sy-ucomm and that's it?

Thanks in advance

4 REPLIES 4

Former Member
0 Kudos

Create diferent handler object for each grid

Koja78
Participant
0 Kudos

The idea was to create one handler object for all alv grids....

Former Member
0 Kudos

I'm not sure but try something like following

MODULE PBO_100.

    CREATE OBJECT GRID1
      EXPORTING
        I_PARENT = CUSTOM_CONTAINER1.
      GRID1->SET_NAME( 'GRID1' ).

    CREATE OBJECT GRID2
      EXPORTING
        I_PARENT = CUSTOM_CONTAINER1.
      GRID2->SET_NAME( 'GRID2' ).
ENDMODULE.

METHOD HANDLE_USER_COMMAND.
     DATA LV_NAME TYPE STRING.
    CALL METHOD CUSTOM_CONTAINER1->CUR_EVENT->EVENT_SRC->GET_NAME
      RECEIVING
        NAME = LV_NAME.

    CASE LV_NAME.
       WHEN 'GRID1'.
           EDIT TABLE 1
        WHEN 'GRID2'
           EDIT TABLE 2.
   ENDCASE.
ENDMETHOD.

Koja78
Participant
0 Kudos

The obvious was overlooked... you can transfer the "sender" towards a handler.