SAP采购订单税码增强检查
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 TYPEMEPOITEM.???????????"采購訂單行項目
*--> 取得采購訂單行項目數據
? L_ITEM =?IM_ITEM->GET_DATA( ).
*--> 判斷行項目稅率是否為空
? IF L_ITEM-MWSKZ = '' OR L_ITEM-MWSKZ ISINITIAL.
???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_ITEMSTYPE PURCHASE_ORDER_ITEMS,
??? OBJ_ITEMTYPE PURCHASE_ORDER_ITEM,
??? LW_HEADERTYPE MEPOHEADER,
??? LW_ITEM TYPEMEPOITEM.
*-->取得訂單抬頭信息及明細數據
? 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( ).
*--> 判斷行項目稅率是否為空
??? IFLW_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_ITEMSTYPE PURCHASE_ORDER_ITEMS,
??? OBJ_ITEMTYPE PURCHASE_ORDER_ITEM,
??? LW_HEADERTYPE MEPOHEADER,
??? LW_ITEM TYPEMEPOITEM.
*-->取得訂單抬頭信息及明細數據
? 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( ).
*--> 判斷行項目稅率是否為空
??? IFLW_ITEM-MWSKZ = '' OR LW_ITEM-MWSKZ IS INITIAL.
?????MMPUR_MESSAGE 'E' 'ZMM01' '002' LW_ITEM-EBELN LW_ITEM-EBELP ''''.
??? ENDIF.
? ENDLOOP.
endmethod.
********************************************************************************* Add by Andrew : 在采購訂單增強中報消息信息的方法: 1. ? ??INCLUDE?MM_MESSAGES_MAC.
?????MMPUR_MESSAGE?'W'?'ZMM01'?'002'?ls_mepoitem-EBEln?ls_mepoitem-EBELP?ls_mepoitem-reslo?''?. 2. sy-msgid?=?'ZMM01'. ???sy-msgty?=?'W'.
????sy-msgno?=?003.
????message?id?sy-msgid?type?sy-msgty?number?sy-msgno?WITH?ls_mepoitem-EBEln??ls_mepoitem-EBELP?ls_mepoitem-reslo?.
????set?extended?check?off.
????call?method?cl_message_mm=>create
??????EXPORTING
????????im_msgid?????????=?sy-msgid
????????im_msgty?????????=?sy-msgty
????????im_msgno?????????=?sy-msgno
????????im_msgv1?????????=?sy-msgv1
????????im_msgv2?????????=?sy-msgv2
????????im_msgv3?????????=?sy-msgv3
????????im_msgv4?????????=?sy-msgv4
????????im_force_collect?=?mmpur_yes
??????EXCEPTIONS
????????failure??????????=?01
????????dialog???????????=?02.
????set?extended?check?off. 這兩個方法實現方法是一樣的,只是第一種是SAP 公司已經實現了,包含在include MM_MESSAGES_MAC中,所以直接引用。 消息類:SE91 建立消息類:ZMM01 Message : 002?Item&1 &2 The default issuing storagelocation is &3. Message: 003 Item &1 &2 The defaultissuing storage location is &3.
總結
以上是生活随笔為你收集整理的SAP采购订单税码增强检查的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: FICO入门一句话
- 下一篇: ABAP 对字符串公式进行计算