2013 Dec 19 10:06 AM
I have ALV with customer button:
If i change the button option, the screen charge other information:
If i want to have selected the second row of first screen and I push other option in button i lose this selection when i return to this screen:
Can I get selected row without refresh when I change the button option?
2013 Dec 19 10:31 AM
Hi Jorge,
if you are using OOPS ALV, Have you tried with method 'Get_selected_rows' of cl_gui_alv_grid.
suppose your custom button UCOMM is 'SEL'.
in PAI module on Ok code = 'SEL' you can write
alvgd is object of cl_gui_alv_grid.
CALL METHOD alvgd->get_selected_rows
IMPORTING
et_index_rows = lt_rows.
lt_rows will returns all selected rows of your ALV final output.
Thanks
Deependra
2013 Dec 19 10:39 AM
Yes i Use method 'Get_selected_rows' of cl_gui_alv_grid but this method don´t save the row pushed on screen.
I want that if i select one row and change other option in custom button, when y return, the OO ALV has select the rows selected.
2013 Dec 19 10:46 AM
Jorge,
Could you please paste code whatever you have written in PAI . As per my understanding in PAI event you can get selected row number .
and as you suggested, when you return on screen you want those rows selected, for this you can use set_selected_rows in same event after get_selected_rows fires.
CALL METHOD gr_alvgd->set_selected_rows
EXPORTING
it_index_rows = lt_rows.
Thanks
Deependra
2013 Dec 19 10:40 AM
Hi Jorge,
I can assume the button functionality you given. here when you are coming back to 2000, system is selecting the entries with 2000 value and populating.
here it is repopulating the table entries again and NOT just coming back to the previuos screen.
if we want to highlight the particular line, then we need to handle event for the mouse selection and store the index value in a global variable. so when you select another type of entries , if the global index is having some value you can highlight that.
but this will cause musch malfunction here, lets say we ar in alv for 2000 and selcted 2nd row, when we go for 2100 2nd row will be highlighted , again if we go to 2200 next again 2nd row will be high lighted.
so we cant do this by index, we can do this by layout, like 2000 layout, 2100 layout. but this is also possible if we knew how many values we are getting for the button.
here i just want highlight one point that is, for us its like coming back to previuos screen, but for the system it is just another alv with another value.
Thanks,
Bhaskar