ITPub博客

首页 > 数字化转型 > ERP > 用BAPI_MATERIAL_SAVEDATA对MRP Controller(MM01的MRP1视图中)作change的方法

用BAPI_MATERIAL_SAVEDATA对MRP Controller(MM01的MRP1视图中)作change的方法

原创 ERP 作者:qiujun 时间:2007-10-15 07:45:19 0 删除 编辑

FORM change_mpr_controller .
DATA: st_headdata LIKE bapimathead ,
st_plantdata LIKE bapi_marc ,
st_plantdatax LIKE bapi_marcx ,
st_return LIKE bapiret2 .

LOOP AT it_tab.
CLEAR: st_headdata, st_plantdata, st_plantdatax, st_return.
st_headdata-material = it_tab-matnr .
st_headdata-mrp_view = 'X' .

st_plantdata-plant = it_tab-werks .
st_plantdata-mrp_ctrler = it_tab-new .

st_plantdatax-plant = it_tab-werks .
st_plantdatax-mrp_ctrler = 'X' .

* Call Function to change the MRP Controller.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = st_headdata
plantdata = st_plantdata
plantdatax = st_plantdatax
IMPORTING
return = st_return.

IF st_return-type = 'E' OR st_return-type = 'A'.
CLEAR it_err.
MOVE-CORRESPONDING it_tab TO it_err .
it_err-errmg = st_return-message .
APPEND it_err.
CLEAR it_err.
DELETE it_tab INDEX sy-index.

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = '1'.
ENDIF.
ENDLOOP.

ENDFORM. " change_mpr_controller

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/90072/viewspace-976691/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 精辟的英文
请登录后发表评论 登录
全部评论
  • 博文量
    107
  • 访问量
    850939