‎2009 Jul 31 10:48 AM
I have 2 screens (9000 , 9001). In PAI of 9000 I CALL SCREEN 9001 to display an ALV report. At 9001, I set next screen to 9000. Also, when ok_code = 'BACK', I set LEAVE SCREEN. But when I click the BACK button, I will still see screen 9001, but without the ALV. Click BACK again only it will go back to screen 9000. Why is it so? How do I set so that I only need to click one time BACK to bring me back to screen 9000.
‎2009 Jul 31 10:50 AM
HI,
Do not give the next screen as 9000 on screen 9001.
And when ok code is BACK give LEAVE TO SCREEN 0 instead of LEAVE SCREEN.
SAP will take care of the sequence of screen calls.
Regards,
Ankur Parab
‎2009 Jul 31 11:10 AM
I replaced NEXT SCREEN = 9000 to blank and also used LEAVE TO SCREEN 0, but I still get exactly the same error. FYI, right before screen 9001 is loaded for the first time (to show the ALV), there is a pop up screen I added in. Not sure this is the reason why I got such problem
‎2009 Jul 31 11:10 AM
Hi,
Please check this for your reference.
SET SCREEN is used to dynamically override the u201CNEXT SCREENu201D attribute of the screen.
CALL SCREEN is used to insert a set of screen sequences dynamically. Processing will return to the current screen.
LEAVE SCREEN will leave the processing of the current screen immediately and leave to the processing of the next screen which is defined either statically or dynamically. Processing will not return to the current screen.
LEAVE TO SCREEN behaves like set screen + leave screen together.
Your scenario will work perfectly provided there are no bugs in the code that you have written. What I would suggest you to do is debug your code and check why your ALV is disappearing on clicking 'BACK'. There could be some discrepancy somewhere.
‎2009 Jul 31 11:11 AM
Do as Ankur has suggested but change one thing.
For screen 9001 set next screen as 9001. This will result that if any action is triggered on screen 9001 (excluding BACK), it will be just redisplayed.
Once you push BACK, you will leave 9001 entirely (with LEAVE TO SCREEN 0) and be back on screen 9000.
The code would be like:
MODULE pai_9000 INPUT.
IF sy-ucomm = 'BACK'.
LEAVE TO SCREEN 0. "leave screen 9000
ELSE.
CALL SCREEN 9001.
ENDIF.
ENDMODULE.
MODULE pai_9001 INPUT.
IF sy-ucomm = 'BACK'.
LEAVE TO SCREEN 0. "go back to screen 9000
ENDIF.
ENDMODULE.
Regards
Marcin
‎2009 Jul 31 11:15 AM
Hi
In PAI of 9001 use CALL SCREEN 9000 instead of leave screen when ever the ok_code = 'BACK' and check if it works
Regards,
Sagar
‎2009 Aug 03 3:36 AM
Hi,
Thanks for the replies, but none works. Currently I set Next Screen at 9001 with 0. When I first clicked 'BACK' on screen 9001, if doesn't load the PAI of the screen. Only the second time of clicking 'BACK' button it loads the PAI and goes back to screen 9000.
Edited by: big mug on Aug 3, 2009 4:48 AM