LEAVE TO LIST-PROCESSING : This statement is used when we are processing a screen and want to print our output in a list. In order to navigate from a screen to list LEAVE TO LIST-PROCESSING statement is used with some conditions. The below post describes some of those:
Step1. Create a report program and create a screen 9999 to take the input & result screen is 9998.
Step2. Flow logic of 9999 screen.
Step3. The flow logic of screen 9998.
Step4. Screen design of 9999 that takes input of the field SCARR-CARRID.
Step5. The pf status of screen 9999.
Step6. Execute the report & provide an input value AA and Hit the Enter key to trigger the PAI of screen 9999 which calls the screen 9998 and the PBO of the screen 9998 triggers.
Step7. This is the screen 9998. Click on the Back button.
Step8. Here the list appears and hit the back button.
Step9. The plain screen of the list still appears. Now click on the back button.
Step10. Again the list with values appears. Hit again the back button.
Step11. Again the Plain list appears.
Conclusion: If in a PBO of the screen we mention : Leave to list-processing, then we unconditionally leave the calling screen ( here the calling screen is – 9999) and the called screen appears( here the called screen is 9998). As we unconditionally left the calling screen, after reaching the called screen (here from 9998 we move to the list ) we can not go back . That why after a several back we can not reach the calling screen.
Step12. Let’s make some change to the statement LEAVE TO LIST-PROCESSING and add some extra to it : LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0. Execute the report.
This is a conditional call from the calling screen 9999 and after reaching the called screen 9998 it can reach the calling screen by the keyword : RETURN TO SCREEN 0. This keyword RETURN TO SCREEN 0 makes the control reach from the list to the calling screen.
Step13. Provide the I/P and hot enter key.
Step14. The below screen 9998 appears. Click on Back button.
Step15. Hence the list appears. now again click on the back button.
Step16. Oh great it calls the I/P screen.
Conclusion: Hence the Leave to screen 0 calls the calling screen from the list so the user can provide again a different value in the I/P screen and see the details of the records in the list output. But here also facing some issue.After providing the I/P in the first screen when we hit enter a blank screen of 9998 appears and if we then select the back button then the list appears. So this is not the ideal O/P the user want to accept. So we have to skip this blank screen 9998 and direct proceed to the list O/P.
Step17. Then put one extra statement SUPPRESS DIALOG & Execute the report.
Step18. Provide the i/P and hit enter key from keyboard.
Step19. So the first blank screen of 9998 is suppressed ad directly the list appears. click the back button.
Step20. Again the I/P screen appears bcoz we have mentioned a conditional call Leave to Screen 0.
Again change the I/P and hit Enter key.
Step21. Again the List appears with fresh set of records.