Hi Imran,
You can let the screen exit without entering the mandatory fields by using a module with the addition AT EXIT-COMMAND in the PAI block.
We use AT EXIT-COMMAND, when we want to cancel out the screen or exit the screen, despite errors. Otherwise, screen would hang-up asking for correcting errors.
Also do check whether you have assigned Exit Command Type to your buttons or not; in order to do that, go to the specific screen->PF-Status->Choose any standard button(you have assigned)->double-click->Set FUNCTIONAL TYPE.
E Exit Command (MODULE xxx AT EXIT-COMMAND)
S System Function
T Call a Transaction
Normal Application Function
P Local GUI Functions
H Internal Use
Code:
PROCESS AFTER INPUT.
MODULE exit AT EXIT-COMMAND.
MODULE exit INPUT.
CASE ok_code.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE.
Hope this helps.
Regards-
Chirag Keswani