It has been a while since I created a Module Pool ABAP program but now I’m hard-pressed to create one by the end of the month. While I was coding away I came across a problem.
This is my screen:
The Problem
When I click on the Exit (yellow circle button with sort of arrow pointing upward) or Cancel (red circle with X), the program checks if the fields are filled-in. Obviously this shouldn’t be the case because the user wants to Exit or Cancel the program without doing any changes.
My Solution
I needed to set the Functional Type of the buttons Exit (ENDE) and Cancel (ECAN) to ‘E’ for Exit Command. This will make the button trigger the AT EXIT-COMMAND event of the PAI.
Since it calls the AT EXIT-COMMAND event, I needed to add a new module to my screen’s Flow Logic:
And put code to the MODULE mod_e to exit the program (I put a CALL TRANSACTION to the first screen of the program):
You can put any syntactically and logically correct command(s) inside MODULE mod_e. Bottom-line is by using the AT EXIT-COMMAND event, the program will exit (or do whatever you want) without checking if the required fields of the screen are populated or not.




0 comments:
Post a Comment