2019 Aug 22 9:22 AM
I 'm doing an ALV report with a header and detail grid. By click the line in header grid ,detail info appeared in detail grid. I can do it with double_click event and now I want to try single click with link_click event. I tried it with one column using below code and it worked. But I wonder how to use it to implement row click. If I want to click any cell in the row, do I have to create column object for each column in the table or any better solution? Thx.
o_columns = so_alv->get_columns( ).
o_columns->set_optimize( abap_true ).
TRY.
column ?= o_columns->get_column( 'VBELN' ).
o_column->set_cell_type( if_salv_c_cell_type=>hotspot ).
CATCH cx_salv_not_found.
ENDTRY.
CREATE OBJECT gr_event_handler_c.
set HANDLER gr_event_handler->on_link_click FOR gr_event.
2019 Aug 22 2:42 PM
There's no "row click", there's only "link click". If you want to implement a "link click" everywhere to simulate a "row click", it will be very ugly. Anyway, you have to define all columns with the cell type hotspot one by one, as you imagined.
There's another solution which renders exactly the same but is achieved differently by using a "cell type column", which allows to define the type of every cell in the grid, but it's more ugly and less efficient.
2019 Aug 23 6:55 AM
if you don't need right click, you may handle CONTEXT_MENU_REQUEST event for single right click...