Skip to Content
author's profile photo Former Member
Former Member

ALV OOPS, Returning back to selection screen after displaying the ALV


We have a report with a selection screen and the report is displayed using ALV oops. On pressing the back button, the control should come back to the selection screen with all the selections retained ( The same way as it happens in REUSE_ALV_GRID_DISPLAY function).

To achieve do this , in the PAI of the screen that is defined for the ALV grid, we are calling the module pai within that we call a subroutine exit_program.

Code for subroutine exit program is as follows : (this I have copied, a few lines, from the subroutine PAI of program LSLVC_FULLSCREENF01

FORM exit_program.

DATA l_okcode TYPE sy-ucomm.

l_okcode = sy-ucomm.

  CASE l_okcode.
    WHEN 'BACK'.
      l_okcode = '&F03'.
    WHEN 'RW'.
      l_okcode = '&F12'.
    WHEN '%EX'.
      l_okcode = '&F15'.

do 2 times.  " Not sure why the standard program does this twice

  CALL METHOD grid1->set_function_code
      c_ucomm = l_okcode.

  CALL METHOD custom_container->free.
  CALL METHOD cl_gui_cfw=>flush.
  IF sy-subrc NE 0.
* add your handling, for example
        titel = g_repid
        txt2  = sy-subrc
        txt1  = 'Error in FLush'(500).



But when I press the back button, I see a blank screen. On pressing the back button again, the program is dumps.

I noticed that when using the REUSE_ALV_GRID_FUNCTION, the set screen 0. leave screen. actually leaves the screen 500 and the control comes to the next statment after CALL SCREEN 500. But in my program, where I have defined screen 100 for the ALV , the same statment is calling the screen 100 again and goes to the PBO of the screen.

Your help will be highly appreciated.



Edited by: Advait Gode on Oct 31, 2008 12:17 PM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Oct 31, 2008 at 12:42 PM

    For this you don't need to do anything.

    if you are calling the screen using call screen then in the pai if you use leave to screen 0, then it comes automatically to the selection-screen.

    call screen 100.

    in user_command module

    case sy-ucomm.
    when 'BACK'.
    leave to screen 0.

    you don't need to do any extra coding.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.