Search code examples
popupabapdynpro

How to return to previous popup?


I am opening a Popup(1) - Screen_0300

CASE sy-ucomm.
  WHEN 'POPUP1'.
    CALL SCREEN 0300 STARTING AT 10 08 ENDING AT 70 15.
ENDCASE.

From within this Popup I am calling another screen Popup(2) - Screen_0400.

MODULE user_command_0300 INPUT.
  CASE sy-ucomm.
    WHEN 'POPUP2'.
      CALL SCREEN 0400 STARTING AT 10 08 ENDING AT 70 15.
  ENDCASE.
ENDMODULE.

Now when I close Popup(2) I want to return to Popup(1). Currently both Popups get closed simultaneously. I already tried to call Popup(1) in the PAI of Popup(2) with Leave to Screen or Set Screen. Is there any way to achieve this?


Solution

  • To leave a screen displayed using CALL SCREEN, use SET SCREEN 0 during the execution of the PAI (MODULE ... INPUT), and the program will continue after the statement CALL SCREEN.

    0 is a special value to leave the current "Screen Call Sequence".

    NB:

    • For information, a variant of SET SCREEN 0 is LEAVE TO SCREEN 0 which is a short form of SET SCREEN 0 followed by LEAVE SCREEN. LEAVE SCREEN is to not execute the next ABAP statements and modules of the current screen (a little bit like EXIT and RETURN leave the current loop or procedure in classic ABAP).