ABAP-MB21,MB22保存校验

如果想检查单行的话可以通过BADI:MB_RESERVATION_BADI,本文是检查重复物料,所以不好使用这个BADI,用了隐式增强

隐式增强位置,程序:MM07RFD0

ABAP-MB21,MB22保存校验

 

 

 1   TYPES:
 2     BEGIN OF TY_MATNR,
 3       MATNR TYPE MARA-MATNR,
 4     END OF TY_MATNR.
 5 
 6   DATA:
 7     LS_MATNR  TYPE TY_MATNR,
 8     LT_MATNR  TYPE TABLE OF TY_MATNR.
 9 
10   IF FCODE_NEXT = FCOD-BU.
11     IF SY-TCODE = 'MB21'
12     OR SY-TCODE = 'MB22'.
13       LOOP AT YRSEG
14         WHERE XLOEK <> 'X'.
15         READ TABLE LT_MATNR TRANSPORTING NO FIELDS
16           WITH KEY MATNR = YRSEG-MATNR.
17 
18         IF SY-SUBRC <> 0.
19           LS_MATNR-MATNR = YRSEG-MATNR.
20           APPEND LS_MATNR TO LT_MATNR.
21         ELSE.
22           MESSAGE '物料' && YRSEG-MATNR && '有重复项!' TYPE 'E'.
23         ENDIF.
24       ENDLOOP.
25     ENDIF.
26   ENDIF.

 

上一篇:Java 持久层框架之 MyBatis


下一篇:C++贪吃蛇(控制台 + 集合版)