SCREEN 实例(重点在于FIELD的验证结合CHAIN的用法)

REPORT中代码------------------------------------------------------------------------------------------

TABLES SPFLI.
DATAOK_CODE TYPE SY-UCOMM.
DATASAVE_OK TYPE SY-UCOMM.
DATAFLD1(20TYPE C,
          FLD2(20TYPE C,
          FLD3(20TYPE C,
          FLD4(20TYPE C,
          ACTION(50TYPE C.
*&---------------------------------------------------------------------*
*&      Module  CANCEL  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
CALL SCREEN 100.
module CANCEL input.
  LEAVE PROGRAM.
endmodule.                 " CANCEL  INPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module USER_COMMAND_0100 input.
  SAVE_OK OK_CODE.
  CLEAR OK_CODE.
  CASE SAVE_OK.
    WHEN 'EXIT'.
      LEAVE PROGRAM.
  ENDCASE.
*  SELECT SINGLE *
*    INTO CORRESPONDING FIELDS OF SPFLI
*    FROM SPFLI
*    WHERE CARRID EQ SPFLI-CARRID AND CONNID EQ SPFLI-CONNID.
*IF sy-subrc ne 0.
*  CLEAR spfli.
*ENDIF.
  ACTION ''.
  CONCATENATE FLD1 FLD2 FLD3 FLD4 INTO ACTION.
endmodule.                 " USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module STATUS_0100 output.
  SET PF-STATUS 'STATUS1'.
*  SET TITLEBAR 'xxx'.

endmodule.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  CHECK1  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module CHECK1 input.
IF fld1 'FLD1'.
  MESSAGE e398(00WITH 'FLD1 ERROR'.
ENDIF.
IF FLD1 'FLD11'.
  MESSAGE I398(00WITH 'FLD1 WARNING'.
ENDIF.
IF FLD1 'FLD111'.
  MESSAGE S398(00WITH 'FLD1 OK'.
ENDIF.
endmodule.                 " CHECK1  INPUT
*&---------------------------------------------------------------------*
*&      Module  CHECK2  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module CHECK2 input.
IF FLD3 'FLD3'.
  MESSAGE E398(00WITH 'FLD3 ERROR'.
ENDIF.
IF FLD3 'FLD33'.
  MESSAGE I398(00WITH 'FLD3 WARNING'.
ENDIF.
IF FLD3 'FLD333'.
  MESSAGE S398(00WITH 'FLD3 OK'.
ENDIF.
endmodule.                 " CHECK2  INPUT
*&---------------------------------------------------------------------*
*&      Module  CHECK3  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module CHECK3 input.
  MESSAGE I398(00WITH 'FLD2 * WARNING'.
endmodule.                 " CHECK3  INPUT

 

 

 

 

 

 

 

 

 

 

 

屏幕100的逻辑流---------------------------------------------------------------------------------------

 PROCESS BEFORE OUTPUT.
 MODULE STATUS_0100.
*
PROCESS AFTER INPUT.
  CHAIN.
    FIELDFLD1FLD2.
    MODULE CHECK1.
  ENDCHAIN.
  CHAIN.
    FIELDFLD3FLD4.
    MODULE CHECK2.
  ENDCHAIN.
  FIELD FLD2 MODULE CHECK3 ON *-INPUT.
 MODULE CANCEL AT EXIT-COMMAND.
 MODULE USER_COMMAND_0100.

你可能感兴趣的:(05,Dialog)