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: 

Know alv grid on event click

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

uwe_schieferstein
Active Contributor
0 Kudos

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

5 REPLIES 5

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

uwe_schieferstein
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

0 Kudos

Hello Xavier

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

Regards

Uwe