Hello again!
This one is for the newbies out there or for those experienced ones who are new to Module Pool programming or Dynpro I must say. Main and the foremost objective of this post is to leave screen when any field is made mandatory in Module Pool (dialog) program. You should know how to program a module pool program including screens, PF-STATUS and user commands.
Create a new program and call a screen with any number. I give it as 0100.
Now double click on screen number and create a screen as shown below.
Now you need to implement PBO and PAI modules. Do them as shown below.
Now make a note in PAI that it is implemented as
MODULE USER_COMMAND_0100 AT EXIT-COMMAND.
AT EXIT COMMAND means that program will exit when you will press the exit button.
Now create a PF-STATUS as follows.
Now double click on EXIT button and follow the screenshots.
Here you need to select Function Type as E. This will exit you program on exit click while field is made mandatory. Activate you PF-STATUS, activate your screen and activate your program. Now run it. You will see it won't go back on BACK or CANCEL but it will leave program when EXIT is clicked.
Here you have implemented how to exit the program while any field is mandatory. It is a standard behavior like we see in IW52 or any other T-code.
Hope this helps!
Comments are welcome!