Scenario : Generally if a screen contains any obligatory(Required) input field & we execute the MP program , the screen appears & if we want to come out of the program it will not allow us . We have to fill the mandatory field on the screen and then we can come out of the program by clicking on the application tool bar buttons. To overcome this problem , generally we use AT EXIT-COMMAND at PAI of the screen to force exit from the screen that contains a required field without filling any value to it.
Here we have two screens 9000 and 9001. In the 9000 screen we have an required i/p field & a single record is displayed on 9001 screen based on the i/p.
data : p_carr type spfli-carrid,
wa_spfli type spfli,
ok_code type sy-ucomm.
module STATUS_9000 output.
SET PF-STATUS ‘STATUS’. ” DOUBLE CLICK ON ‘STATUS’ TO CREATE IT
* SET TITLEBAR ‘xxx’.
endmodule. ” STATUS_9000 OUTPUT
module FORCE_EXIT input.
CASE OK_CODE.
WHEN ‘EXIT’ OR ‘CANCEL’.
LEAVE PROGRAM.
ENDCASE.
endmodule. ” FORCE_EXIT INPUT
module USER_COMMAND_9000 input.
case ok_code.
WHEN ‘DISP’.
CALL SCREEN 9001.
WHEN ‘BACK’.
LEAVE PROGRAM.
endcase.
endmodule. ” USER_COMMAND_9000 INPUT
module STATUS_9001 output.
* SET PF-STATUS ‘xxxxxxxx’.
* SET TITLEBAR ‘xxx’.
SELECT SINGLE * FROM SPFLI INTO WA_SPFLI WHERE CARRID = P_CARR.
endmodule. ” STATUS_9001 OUTPUT
module USER_COMMAND_9001 input.
case ok_code.
when ‘BACK’.
LEAVE TO SCREEN 0.
endcase.
endmodule. ” USER_COMMAND_9001 INPUT
TO CREATE PF STATUS
STEP-1 : Double click on ‘STATUS’ to create pf status and click on yes button.
STEP-2: Give a short description.
STEP-3: Click on the ‘+’ button of the Function key & fill values ‘BACK’, ‘EXIT’ & ‘CANCEL’.
STEP-4: Double click on ‘EXIT’ & the following screen will appear. Click of the value help of theFunction Type field and choose the first entry. ‘E’ type.
STEP-5 : Click yes to set ‘E’ for the EXIT and also set ‘E’ type also for ‘CANCEL’
FLOW LOGIC OF SCREEN 9000
PROCESS BEFORE OUTPUT.
MODULE status_9000.
PROCESS AFTER INPUT.
MODULE force_exit AT EXIT-COMMAND.
MODULE user_command_9000.
FLOW LOGIC OF SCREEN 9001
PROCESS BEFORE OUTPUT.
MODULE STATUS_9001.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_9001.
OUTPUT: