09-23-2008 1:07 PM
Hi guys!
hope someone can help me out.
In my program i have three dynpros with differt alv of cl_gui_alv_grid.
In each of these grids i want to implement a "handle_double_click" event.
How can i do this?
acually i have my class lcl_event_receiver and there i have implemented the handle_double_click method.
but how can i figure out which grid triggered the event?
in each dynpro i have
SET HANDLER event_receiver->handle_double_click FOR grid1.
SET HANDLER event_receiver->handle_double_click FOR grid2.
SET HANDLER event_receiver->handle_double_click FOR grid3.
now in the class implementation i need something like
if grid 1 X
if grid 2 Y
09-23-2008 1:15 PM
using the sender addition you can differentiate.
double_click for event double_click
of cl_gui_alv_grid
importing e_row
e_column
es_row_no
sender, "<====This can be used
sender hold the Current Grid reference , based on that you can differentiate.
09-23-2008 1:15 PM
using the sender addition you can differentiate.
double_click for event double_click
of cl_gui_alv_grid
importing e_row
e_column
es_row_no
sender, "<====This can be used
sender hold the Current Grid reference , based on that you can differentiate.
09-23-2008 1:24 PM
thanks for that
but i can't find the information in "sender" which helps me.
can you show me where it is?
how can i figure out if the caller is e.g. "grid1"
09-23-2008 1:35 PM
you can add sender addition to your double_click method.
Defintion
double_click for event double_click
of cl_gui_alv_grid
importing e_row
e_column
es_row_no
sender.
sender will return the Current Grid object. you can freely add the extra parameter sender. that will tell you which grid it is ..
implementation.
method double_click.
if sender = gid1.
"here you can handle the Grid1
endif.
if sender = gid2.
"here you can handle the Grid2
endif.
endmethod. "double_click
I hope you got what i am saying...
09-23-2008 1:36 PM
I did this by defining a totally separate event receiver for each grid so that you always know which grid you are dealing with.
DATA:
event_receiver1 TYPE REF TO lcl_event_receiver,
event_receiver2 TYPE REF TO lcl_event_receiver.
CREATE OBJECT event_receiver1.
SET HANDLER event_receiver1->double_click_versions for g_grid1.
CREATE OBJECT event_receiver2.
SET HANDLER event_receiver2->double_click_payments FOR g_grid2.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
double_click_versions
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column,
double_click_payments
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column,
ENDCLASS.
09-23-2008 1:41 PM
This is possible, but you may need to have n number of handlers when you are dealing with n no of grids, to avoid that we can do with one grid.
09-25-2008 10:14 AM
Yes, using one handler is much better but I didn't know how to do it at the time.....I'll know next time, thanks.
09-23-2008 1:29 PM
Hi,
Instead of using different double click even
use the below method to get selected row and based on that go for next detail display in user command
* Get selected Rows to Update New Entries
CALL METHOD g_alvgrid->get_selected_rows
IMPORTING
et_index_rows = i_index_rows.
It will be helpful.
Regards,
Nandha
09-23-2008 1:36 PM
it works like this
Data:
grid1 TYPE REF TO cl_gui_alv_grid.
in the handle_double_click method you can do
if sender = grid1.
this works!
thanks