Skip to Content
avatar image
Former Member

Know alv grid on event click

Hi,

Is it possible to know the alv grid (TYPE REF TO cl_gui_alv_grid) on the event click? In fact, on a screen, I have 2 alv grids and I would like to store the alv grid name for a process at click moment.

Thanks.

Edited by: Xavier Couloumies on Sep 12, 2008 2:07 PM

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 14, 2008 at 07:17 PM

    Hello Xavier

    Every event handler method has the optional IMPORTING parameter SENDER which corresponds to the control that raises the event.

    Thus, you logic could look like this:

    " Method definition:
      METHOD handle_double_click 
        FOR EVENT double_click OF cl_gui_alv_grid
        IMPORTING
          ...
          sender.  " optional parameter.
    
    
    " Implementation of your methods:
    METHOD handle_double_click.
    
      CASE sender.
        WHEN go_grid1.
    
        WHEN go_grid2.
    
        WHEN OTHERS.
          RETURN.
        ENDCASE.
    
    ENDMETHOD.
    

    Regards

    Uwe

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 12, 2008 at 12:21 PM

    I have 2 alv grid on the same screen.

    DATA : wo_grid1 TYPE REF TO cl_gui_alv_grid,

    wo_grid2 TYPE REF TO cl_gui_alv_grid.

    Each grid or field catalog, there is a editable field. This field is the same on the 2 alv grid. I would like the alv grid name or fieldcatalog name when I click on this ediatable field. I hope to be more precise...

    Thanks.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 12, 2008 at 08:55 PM

    you might declare two differents methods for the two grids

    PUBLIC SECTION.

    METHODS:

    HANDLE_DOUBLE_CLICK

    FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID

    IMPORTING E_ROW

    E_COLUMN,

    HANDLE_DOUBLE_CLICK2

    FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID

    IMPORTING E_ROW

    E_COLUMN.

    something like that

    then , in the implementations do something like this

    METHOD HANDLE_DOUBLE_CLICK.

    PERFORM X USING GRID = '1'.

    ENDMETHOD.

    METHOD HANDLE_DOUBLE_CLICK2.

    PERFORM X USING GRID = '2'.

    ENDMETHOD.

    and do the respective validations on that form

    hope this help

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 15, 2008 at 03:10 PM

    I use the method 'handle_f4'. The SENDER parameter in importing don't exist. And, I would like to avoid to duplicate implementation. If, I can to retrive the grid name or the fieldcat name to the different between my 2 alv grid, it will good.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Xavier

      Just add SENDER as last IMPORTING parameter to the method definition. That's all.

      Regards

      Uwe