11-11-2010 2:40 PM
I have a report that from a selection screen shows an editable ALV Grid, and after I save it, it will refresh the grid.
My problem is when I hit the BACK button it returns to the "previous grid" instead of the selection screen
I am using the following:
WHEN 'BACK_C'.
LEAVE to SCREEN '0'.
How can I force it to go back to the selection screen?
sidenote: I have tried using call
selection-screen '1000'
but it adds a new problem as in the selection screen hitting back will return to the grid and I can never exit the report.
11-11-2010 3:00 PM
11-11-2010 2:56 PM
In the user command section you can set the flag exit of structure of type slis_selfield to 'X'.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN 'EXIT'.
rs_selfield-exit = 'X'.
ENDCASE.
ENDFORM.
11-11-2010 4:11 PM
Neither solution works.
If it helps, I'm refreshing the grid with:
DATA : ref_grid TYPE REF TO cl_gui_alv_grid.
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
CALL METHOD ref_grid->refresh_table_display( ).
It seems when I refresh the grid it generates a completely independent grid screen and there's no way to skip them all and return to the selection screen.
11-11-2010 4:17 PM
What i posted was just an example, you should replace EXIT with the user command from the exit button, of course. This works pretty well usually. Also, refresh could be done the same way, after save user command the flag refresh = 'X' does the trick.
11-11-2010 4:31 PM
I did replace it by the back button, but the problem was another.
There was still a call to the 'REUSE_ALV_GRID_DISPLAY' function in the code, which forced the creation of a new ALV. This is the expected behavior and a good one. I've replaced it with a call to refresh_table_display and now it works great.
Thanks for the help.
11-11-2010 4:35 PM
11-11-2010 3:00 PM
11-11-2010 4:20 PM
Keep track of what report level you are on and based on that either
set_table_for_first_display
or
leave to screen 0
Rob