简体   繁体   中英

Is there a way to close a nested pop up window in SAP ABAP and go back to the previous one?

so I have an ABAP Module Pool Program where I have created 4 different screens in total (screen 101, 102, 103, 104). While screen 101 is my main screen, the other three of them come up as pop up windows in a sequence, so from 101 a pop up window brings screen 102 forward, from there on a pop up window brings 103 forward etc. My problem is that when I end up in pop up window 104, I want to view some data which is executed properly and then quit this pop up window and go back to the previous one, which contains screen 103. I cannot find any statements that solve my problem. I've tried "leave screen", "set screen to 0", "leave program", "leave to screen 0" and pretty much anything of that nature, but all that happens most of the time is it goes back to screen 103 but within the same pop up window without closing it, so I basically end up with two pop up windows previewing the same screen (103). Does anybody know how i should approach this? Hope I made myself clear and thanks in advance.

You need implement some sort of controller in the logic of the parent screen. There is no way to simply change the content of a popup, you need to open it using CALL SCREEN... and when you want to change the content you need to close it using LEAVE TO SCREEN 0. Before closing the popup, you can store additional information in a global variable (or in the user commend) so the controller knowns which screen needs to be displayed next. The next screen is then displayed using another CALL SCREEN.

A very simple example to describe the approach: The controller in your main dynpro could look like this:

* This needs to be a global variable!
DATA next_screen TYPE SY-DYNNR VALUE '0101'.

...

WHILE next_screen IS NOT INITIAL.
 CALL SCREEN next_screen STARTING AT 3 3.
ENDWHILE.

Initially this will display screen 101 as a popup. When popup 101 decides to jump to screen 102, it executes the following code:

next_screen = '0102'.
LEAVE TO SCREEN 0.

The close the popup use

CLEAR next_screen.
LEAVE TO SCREEN 0.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM