2023 Sep 14 7:33 AM
Hello Experts, Im trying to call 3 methodes in one class. so i habe a report wich is SALV and there is 3 cells each one should be clickable. one with link_click and the others with double_click.
TERMN : link_click
LIGHT : double_click
Bearbeiter: double_click_pool
this how should it be but in my case Light calls double_click and double_click_pool when i click on it.
Bearbeiter calls link_click.
could u guys help or tell me where my problem is?
class def.
CLASS lcl_handle_events DEFINITION.
PUBLIC SECTION.
METHODS:
on_double_click
FOR EVENT double_click OF cl_salv_events_table
IMPORTING
row
column .
METHODS: on_link_click FOR EVENT link_click OF
cl_salv_events_table
IMPORTING row column.
METHODS:
on_double_click_pool
FOR EVENT double_click OF cl_salv_events_table
IMPORTING
row
column .
ENDCLASS.
here where i create the objekt
SET HANDLER event_handler->on_link_click FOR gr_events.
lr_column ?= lr_columns->get_column( 'TERMN' ).
lr_column->set_cell_type( if_salv_c_cell_type=>hotspot ).
CREATE OBJECT event_handler.
SET HANDLER event_handler->on_double_click FOR gr_events.
lr_column ?= lr_columns->get_column( 'LIGHT' ).
lr_column->set_cell_type( if_salv_c_cell_type=>hotspot ).
CREATE OBJECT event_handler.
SET HANDLER event_handler->on_double_click_pool FOR gr_events.
lr_column ?= lr_columns->get_column( 'BEARBEITER' ).
lr_column->set_cell_type( if_salv_c_cell_type=>hotspot ).
lr_salv->display( ).
Implement
cLASS lcl_handle_events IMPLEMENTATION.
METHOD on_double_click.
#logic
ENDMETHOD.
METHOD on_link_click.
#logic
METHOD on_double_click_pool.
#logic
ENDMETHOD.
ENDCLASS.
2023 Sep 14 7:48 AM
Your methods on_double_click and on_double_click_pool are both listening to event double_click.
That's why they're both called at the same time.
If you want a different behavior for double click for various fields, you need to handle it in one method:
METHOD on_double_click.
CASE column.
WHEN 'COLUMN1'.
" Do something
WHEN 'COLUMN2'.
" Do something else
ENDCASE.
ENDMETHOD.
2023 Sep 14 7:43 AM
2023 Sep 14 7:48 AM
Your methods on_double_click and on_double_click_pool are both listening to event double_click.
That's why they're both called at the same time.
If you want a different behavior for double click for various fields, you need to handle it in one method:
METHOD on_double_click.
CASE column.
WHEN 'COLUMN1'.
" Do something
WHEN 'COLUMN2'.
" Do something else
ENDCASE.
ENDMETHOD.
2023 Sep 14 7:57 AM
ok cool now Light column ist calling the wrong methode, but Bearbeiter still calling link_click
2023 Sep 14 8:15 AM
2023 Sep 14 8:33 AM
oh i sat the hotspot twice for the doubl_click cells it should be only one for light and bearbeiter. now it works thx alot
2023 Sep 14 7:48 AM
3a9e4ce873a94034b33dc62b0ce600ee its har to use always takes a few lines into the Code layout.
now should be better i guess
2023 Sep 14 7:53 AM
There should be a hotkey to add this comment, really: remember to format the code with the CODE button above, to make it readable. Take care to copy from the editor in display mode (not edit), otherwise you get html nodes mixed in.
2023 Sep 14 7:57 AM
2023 Sep 14 7:59 AM
2023 Sep 14 8:05 AM
After posting, you should systematically refresh the page and review the formatting (it's how to deal with the forum quirks).