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.