330 likes | 396 Views
Screen Element s for Input/Output . Checkboxes and Radio Button Groups Error Checking in Input/Output fields. 1. Checkboxes and Radio Button Groups. Checkboxes and Radio Buttons: Attributes. Creating a Checkbox. Creating a Radio Button Group. 也可用滑鼠框起來, 按右鍵,將其定義為 group.
E N D
Screen Elements for Input/Output • Checkboxes and Radio Button Groups • Error Checking in Input/Output fields
Creating a Radio Button Group 也可用滑鼠框起來, 按右鍵,將其定義為group 宣告按鈕,並讓display為預設選項
主程式 DATA: CHECK1, CHECK2, RADIO1, RADIO2. CHECK1 = 'X'. RADIO2 = 'X'. DATA: RESULT1(20) TYPE C, RESULT2(20) TYPE C. DATA OK_CODE TYPE SY-UCOMM. CALL SCREEN 9000.
Screen 9000的Layout: Checkbox Result1
Screen 9000的Layout: Radio Button Result2
Screen 9000的flow logic PROCESS BEFORE OUTPUT. * MODULE STATUS_9000. * PROCESS AFTER INPUT. MODULE USER_COMMAND_9000.
MODULE USER_COMMAND_9000 MODULE USER_COMMAND_9000 INPUT. CASE OK_CODE. WHEN 'END'. LEAVE PROGRAM. WHEN 'SHOW'. RESULT1 = ''. IF NOT CHECK1 IS INITIAL. RESULT1 = 'ABAP; '. ENDIF. IF CHECK2 = 'X'. CONCATENATE RESULT1 'FI; ' INTO RESULT1. ENDIF. IF RADIO1 = 'X'. RESULT2 = 'You are Male...'. ELSE. RESULT2 = 'You are Female...'. ENDIF. ENDCASE. ENDMODULE. " USER_COMMAND_9000 INPUT
2. Error Checking in Input/Output fields • 範例程式:SAPBC410INPD_C_CHECK_INPUT
Automatic Field Input Checks 強制 (例如必填欄位之檢查)
主程式 DATA: A TYPE I, B TYPE I, C TYPE I. DATA OK_CODE TYPE SY-UCOMM. CALL SCREEN 9000.
Screen 9000 PAI PROCESS AFTER INPUT. MODULE USER_COMMAND_9000. FIELD A MODULE CHECK_A.
MODULE USER_COMMAND_9000 INPUT. CASE OK_CODE. WHEN 'END'. LEAVE PROGRAM. ENDCASE. ENDMODULE. MODULE CHECK_A INPUT. IF A < 0 OR A > 50. MESSAGE 'Please input A Between 0~50' TYPE 'W' . ENDIF. ENDMODULE.
Screen 9000 PAI PROCESS AFTER INPUT. MODULE USER_COMMAND_9000. FIELD A MODULE CHECK_A. CHAIN. FIELD: A, B, C. MODULE CHECK_ABC ON CHAIN-INPUT. ENDCHAIN.
MODULE CHECK_ABC INPUT. DATA SUM TYPE I. SUM = A + B + C. IF SUM <> 50. MESSAGE 'A + B + C is not equal 50' TYPE 'W' . ELSE. MESSAGE 'A + B + C is equal 50' TYPE 'S' . ENDIF. ENDMODULE.