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: 

Please select entry Error with cl_gui_alv_grid

0 Kudos

Hello Experts,

I try to select a entry of a table using the class "cl_gui_alv_grid". When I select the first entry and push a button and go through my code, working with the entry, it works perfectly fine. But the second time it wont select the entry or rather the table lt_selected_rows is empty. Heres my code:

CALL METHOD grid1->get_selected_rows
IMPORTING
et_index_rows = lt_selected_rows.
CASE lines( lt_selected_rows ).
WHEN 0.
MESSAGE 'Please select entry' TYPE 'I' DISPLAY LIKE 'E'.
WHEN 1.
READ TABLE gt_output INTO ls_output INDEX lt_selected_rows[ 1 ]-index.



WHEN OTHERS.
MESSAGE 'Please select one entry' TYPE 'I' DISPLAY LIKE 'E'.
ENDCASE.
Your help would be appreciated
1 REPLY 1

Sandra_Rossi
Active Contributor
0 Kudos

I guess the problem is that you have re-instantiated the ALV grid. Only the first-instantiated grid is displayed, the next ones are lost somewhere... I mean grid1 is referencing the one which is not displayed, so there are no selected rows.