MODULE POOL PROGRAM – AT EXIT COMMAND

Usually if the screen contains any required or mandatory input field & we run the Module pool program, the screen appears & if we want to come out of the program it will not allow us. We have to give the mandatory field on the screen & then we can come out of the program by clicking on the application tool bar buttons. To overrule this issue, generally we use AT EXIT-COMMAND at PAI of the screen to force come out from the screen that contains a required field without filling any value to it.

Lets take an example that we have two screens 9000 & 9001. In the 9000 screen we have required input field and a single record is displayed on 9001 screen based on the input.

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

STEPS TO CREATE A “PF STATUS” 

STEP-1 : Double click on ‘STATUS’ to create a pf status.

STEP-2:  Provide a short description.

 STEP-3: Now click on the ‘+’ plus button of the Function key & fill values ‘BACK’,  ‘EXIT’ & ‘CANCEL’.

 STEP-4: After this Double click on ‘EXIT’ & the following screen will come. Click on the value help of the Function Type field and choose the first entry. ‘E’ type as shown below.

STEP-5 : Now click yes to set ‘E’ for the EXIT & 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:

Advertisement

Leave a Comment