Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ALV table - get row number clicked

I have a very simple ALV table in a view in my application. The view also contains a button. On clicking the button, I need to add code to the method to determine the row number selected in the ALV table. Someone suggested using:

DATA lt_selected_rows TYPE lvc_t_roid .
DATA ls_selected_row TYPE lvc_s_roid .
CALL METHOD gr_alvgrid->get_selected_rows
IMPORTING
et_row_no = lt_selected_rows .
READ TABLE lt_selected_rows INTO ls_selected_row INDEX 1 .
IF sy-subrc ne 0 .
ENDIF

but the code is missing the declaration and the initialization of the variable gr_alvgrid.

Any help would be truly appreciated.

Not what you were looking for? View more on this topic or Ask a question