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: 

ALV row click event with link_click

former_member625844
Participant
0 Kudos
349

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.

2 REPLIES 2

Sandra_Rossi
Active Contributor
0 Kudos
176

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.

DoanManhQuynh
Active Contributor
0 Kudos
176

if you don't need right click, you may handle CONTEXT_MENU_REQUEST event for single right click...