原文地址:http://fengan321.blog.163.com/blog/static/61762371201212911542414/
1、SE18查看ME_PROCESS_PO_CUST相关信息
2、SE19创建ME_PROCESS_PO_CUST的BADI实现类
注意类名称定义是按照以下规则:
ZCL_IM_ + BADI
其中CL表示CLASS类的意思,
IM表示Implement实现的意思;
3、SE24实现ZCL_IM_ME_PROCESS_PO_CUST
4、实现PROCESS_ITEM代码:
METHOD IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM.
*&==========================================================
*& 对采购订单行项目增加是否有选择税码检查
*& Added by liangqh 2010-07-28
*&==========================================================
INCLUDE MM_MESSAGES_MAC.
DATA:
L_ITEM TYPE MEPOITEM. "采购订单行项目
*--> 取得采购订单行项目数据
L_ITEM = IM_ITEM->GET_DATA( ).
*--> 判断行项目税率是否为空
IF L_ITEM-MWSKZ = '' OR L_ITEM-MWSKZ IS INITIAL.
MMPUR_MESSAGE 'E' 'ZMM01' '002' L_ITEM-EBELN L_ITEM-EBELP '' ''.
ENDIF.
ENDMETHOD.
METHOD IF_EX_ME_PROCESS_PO_CUST~CHECK.
*&==========================================================
*& 对采购订单行项目增加是否有选择税码检查
*& Added by liangqh 2010-07-28
*&==========================================================
INCLUDE MM_MESSAGES_MAC.
DATA:
OBJ_ITEMS TYPE PURCHASE_ORDER_ITEMS,
OBJ_ITEM TYPE PURCHASE_ORDER_ITEM,
LW_HEADER TYPE MEPOHEADER,
LW_ITEM TYPE MEPOITEM.
*-->取得订单抬头信息及明细数据
LW_HEADER = IM_HEADER->GET_DATA( ).
OBJ_ITEMS = IM_HEADER->GET_ITEMS( ).
LOOP AT OBJ_ITEMS INTO OBJ_ITEM.
LW_ITEM = OBJ_ITEM-ITEM->GET_DATA( ).
*--> 判断行项目税率是否为空
IF LW_ITEM-MWSKZ = '' OR LW_ITEM-MWSKZ IS INITIAL.
MMPUR_MESSAGE 'E' 'ZMM01' '002' LW_ITEM-EBELN LW_ITEM-EBELP '' ''.
ENDIF.
ENDLOOP.
ENDMETHOD.
method IF_EX_ME_PROCESS_PO_CUST~POST.
*&==========================================================
*& 对采购订单行项目增加是否有选择税码检查
*& Added by liangqh 2010-07-28
*&==========================================================
INCLUDE MM_MESSAGES_MAC.
DATA:
OBJ_ITEMS TYPE PURCHASE_ORDER_ITEMS,
OBJ_ITEM TYPE PURCHASE_ORDER_ITEM,
LW_HEADER TYPE MEPOHEADER,
LW_ITEM TYPE MEPOITEM.
*-->取得订单抬头信息及明细数据
LW_HEADER = IM_HEADER->GET_DATA( ).
OBJ_ITEMS = IM_HEADER->GET_ITEMS( ).
LOOP AT OBJ_ITEMS INTO OBJ_ITEM.
LW_ITEM = OBJ_ITEM-ITEM->GET_DATA( ).
*--> 判断行项目税率是否为空
IF LW_ITEM-MWSKZ = '' OR LW_ITEM-MWSKZ IS INITIAL.
MMPUR_MESSAGE 'E' 'ZMM01' '002' LW_ITEM-EBELN LW_ITEM-EBELP '' ''.
ENDIF.
ENDLOOP.
endmethod.