09-12-2008 1:06 PM
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
09-14-2008 8: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
09-12-2008 1: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.
09-12-2008 9: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
09-14-2008 8: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
09-15-2008 4: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.
09-15-2008 4:11 PM
Hello Xavier
Just add SENDER as last IMPORTING parameter to the method definition. That's all.
Regards
Uwe