SAPABAPMIGO自动生成MRP区域MD-创新互联
MB_MIGO_BADI~POST_DOCUMENT
创新互联建站坚持“要么做到,要么别承诺”的工作理念,服务领域包括:成都网站建设、网站制作、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的莱阳网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!DATA:LS_MSEG TYPE MSEG .
DATA:BEGIN OF TY_MATNR ,
MATNR TYPE MARA-MATNR,
END OF TY_MATNR .
DATA:LT_MATNR LIKE TABLE OF TY_MATNR,
LS_MATNR LIKE TY_MATNR.
DATA: LV_MATNR TYPE MDMA-MATNR,
LV_WERK TYPE MDMA-WERKS,
LV_MRPAREA TYPE MDMA-BERID,
LS_SELFIELDS TYPE SDIBE_MASSFIELDS,
LS_MDMA TYPE MDMA,
LS_DPOP TYPE DPOP,
LS_RETURN TYPE BAPIRETURN1.
LOOP AT IT_MSEG INTO LS_MSEG WHERE BWART EQ '311' AND XAUTO = SPACE
AND UMWRK EQ '2001' AND UMLGO EQ '2008'.
*是否扩展对应的视图。
SELECT
SINGLE
*
INTO @DATA(LS_MDMA_info)
FROM MDMA
WHERE
MATNR EQ @LS_MSEG-MATNR
AND BERID EQ '200800' .
IF SY-SUBRC <>0 .
LS_MATNR-MATNR = LS_MSEG-MATNR .
APPEND LS_MATNR TO LT_MATNR .
ENDIF .
ENDLOOP .
SORT LT_MATNR BY MATNR .
DELETE ADJACENT DUPLICATES FROM LT_MATNR COMPARING MATNR .
DELETE LT_MATNR WHERE MATNR IS INITIAL .
CHECK LT_MATNR IS NOT INITIAL .
LOOP AT LT_MATNR INTO LS_MATNR .
clear :LV_MATNR,
LV_WERK ,
LV_MRPAREA ,
LS_SELFIELDS,
LS_MDMA ,
LS_DPOP ,
LS_RETURN .
LV_MATNR = ls_matnr-matnr .
LV_WERK = '2001'.
LV_MRPAREA = '200800'.
LS_SELFIELDS-XDISLS = 'X'.
LS_SELFIELDS-XDISMM = 'X'.
LS_MDMA-DISLS = 'EX' .
LS_MDMA-DISMM = 'ND' .
LS_MDMA-BERID = LV_MRPAREA.
LS_MDMA-MATNR = LV_MATNR.
CALL FUNCTION 'MD_MRP_LEVEL_CREATE_DATA'
EXPORTING
I_MATNR = LV_MATNR
I_WERK = LV_WERK
I_MRP_AREA = LV_MRPAREA
I_SELFIELDS = LS_SELFIELDS
I_MDMA = LS_MDMA
I_DPOP = LS_DPOP
I_QUEUE_FLAG = 'X'
I_SAVE_FLAG = ''
I_EXTERNAL_COMMIT = 'X'
IMPORTING
E_ERROR_RETURN = LS_RETURN.
CLEAR: LV_MATNR, LV_WERK,LV_MRPAREA,LS_SELFIELDS,LS_MDMA,LS_DPOP.
*和主程序一起提交数据库。
IF LS_RETURN-TYPE = 'E'.
"BAPI失败回滚
* CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
"成功就提交并更新ALV
* CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT = 'X'.
ENDIF.
ENDLOOP .
BAPI BAPI_GOODSMVT_CREATE不触发上述增强,可在BADI MB_DOCUMENT_BADI 中实现上述效果。
你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧
文章题目:SAPABAPMIGO自动生成MRP区域MD-创新互联
网站链接:http://azwzsj.com/article/cspghj.html