SAP ABAP Enhancement Purpose:For Migo,When it is Purchase Order (PO), Delevey Nunmber is Must key in (Requred)
MIGO 对采购订单收获时候,交货单字段必须是必填的.
Steps:
1、T-code SE19 创建MB_MIGO_BADI的实现
2、新增G_CECHK属性(Attribute)
3、Write Sample abap code in MODE_SET POST_DOCUMENT CHECK_HEADER 3 method.
METHOD:MODE_SET
************************************************************************
* * 检查标识
************************************************************************
IF i_action = ‘A01’ AND i_refdoc = ‘R01’.“
g_check = ‘X’.
ELSEIF i_action = ‘A01’ AND i_refdoc = ‘R08’.“.生产订单入库
g_check = ‘P’.
ELSE.
g_check = ”.
ENDIF.
METHOD:POST_DOCUMENT
*&——————————————————————————–*
*& 收货时检查抬头交货字段是否为空 *
*&——————————————————————————–*
DATA:lt_marc TYPE TABLE OF marc,
ls_marc TYPE marc.
READ TABLE it_mseg INTO wa_mseg INDEX 1.
IF g_check = ‘X’
AND ( wa_mseg-bwart = ‘101’ OR wa_mseg-bwart = ‘103’ )
AND is_mkpf-xblnr IS INITIAL
AND ( wa_mseg-werks = ‘3710’ OR wa_mseg-werks = ‘3720’ ) .
MESSAGE e029(zgr_xm_31_001).
ENDIF.
METHOD:CHECK_HEADER
*&—————————————————————————–*
** 采购订单收获 交货单必输增强
*&——————————————————————————*
FIELD-SYMBOLS:
<fs_gohead> TYPE gohead,
<fs_goitem> TYPE goitem,
<fs_bwart> TYPE bwart.
DATA:
ls_bapiret2 TYPE bapiret2.
ASSIGN (‘(SAPLMIGO)GODEFAULT_TV-BWART’) TO <fs_bwart>.
ASSIGN (‘()GOHEAD’) TO <fs_gohead>.
READ TABLE gt_goitem ASSIGNING <fs_goitem> INDEX 1.
IF g_check = ‘X’
AND ( <fs_bwart> = ‘101’ OR <fs_bwart> = ‘103’ OR <fs_bwart> = ‘105’ )
AND <fs_gohead>-lfsnr IS INITIAL
AND ( <fs_goitem>-werks = ‘3710’ OR <fs_goitem>-werks = ‘3720’ ).
* 检查交货单不为空
CLEAR ls_bapiret2.
ls_bapiret2-type = ‘E’.
ls_bapiret2-id = ‘ZGR_XM_31_001’.
ls_bapiret2-number = ‘029’.
APPEND ls_bapiret2 TO et_bapiret2.
ENDIF.
我的微信公众号【 hot583 】 或者在这个链接联系我
本文链接 :http://www.hot583.com/2022/06/22/mb_migo_badi_migo/
本文为作者原创,如果这篇文章对您有用,欢迎转载,
转载请务必注明来源《今日热点在看》http://www.hot583.com/
微信原文《全文完》