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: 

Back from ALV Grid with multiple refresh

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

former_member206439
Contributor
0 Kudos

try LEAVE TO SCREEN '1000'.

7 REPLIES 7

PedroGuarita
Active Contributor
0 Kudos

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.

0 Kudos

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.

0 Kudos

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.

0 Kudos

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.

0 Kudos

Nice to hear, glad to be of any help.

Greetings.

former_member206439
Contributor
0 Kudos

try LEAVE TO SCREEN '1000'.

Former Member
0 Kudos

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