此博客为原创博客,都是个人工作经历所得,转载请注明出处

屏幕里输入字段值后的检查 SCREEN FIELD CHECK ON INPUT

 

  FIELD: zbpmt003-equnr
 MODULE zbpmt003_equnr_change ON INPUT.

 

*&---------------------------------------------------------------------*
*&      Module  ZBPMT003_EQUNR_CHANGE  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE zbpmt003_equnr_change INPUT.

  PERFORM frm_equnr_change.

ENDMODULE.

*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM frm_equnr_change .

  IF zbpmt003-equnr IS NOT INITIAL.
    "select EQKT-EQKTX
    CLEAR: zbpmt003-eqktx.
    SELECT SINGLE eqktx INTO zbpmt003-eqktx
             FROM eqkt
            WHERE equnr EQ zbpmt003-equnr
              AND spras EQ sy-langu.
    IF sy-subrc NE 0.
      SHIFT zbpmt003-equnr LEFT DELETING LEADING '0'.
      CONCATENATE TEXT-021 zbpmt003-equnr TEXT-022 INTO DATA(lv_msg) SEPARATED BY space.
* DATA(lv_msg) = '设备' && zbpmt003-equnr && '不存在'.
      MESSAGE e003 WITH lv_msg.
    ENDIF.

    CLEAR: zbpmt003-tplnr,zbpmt003-kostl.
    "EQUZ-EQUNR=ZBPMT002-EQUNR, EQUZ-DATBI=”9999.12.31”,
    "ILOA-ILOAN=EQUZ-ILOAN, select ILOA-TPLNR
    SELECT SINGLE b~tplnr b~kostl INTO ( zbpmt003-tplnr,zbpmt003-kostl )
             FROM equz AS a
             JOIN iloa AS b
               ON a~iloan EQ b~iloan
            WHERE a~equnr EQ zbpmt003-equnr
              AND a~datbi EQ '99991231'.
    IF zbpmt003-tplnr IS INITIAL.
      MESSAGE i003 WITH TEXT-023. "'设备号找不到功能位置'.
    ENDIF.
    IF zbpmt003-kostl IS INITIAL.
      MESSAGE i003 WITH TEXT-024."'设备号找不到成本中心'.
    ENDIF.

    "get Submit Department提出部门
    CLEAR: zbpmt003-ingpr1.
    SELECT SINGLE ingrp INTO zbpmt003-ingpr1
             FROM equz
            WHERE equnr EQ zbpmt003-equnr
              AND datbi EQ '99991231'.
    IF zbpmt003-ingpr1 IS INITIAL.
      MESSAGE i003 WITH TEXT-025."'设备号找不到提出部门'.
    ENDIF.
  ENDIF.

ENDFORM.

 

posted @ 2020-12-30 22:27  Rainystuday  阅读(183)  评论(0编辑  收藏  举报