SAP BAPI:BAPI_MATERIAL_SAVEDATA 与 BAPI_MATERIAL_SAVEDATAREPLICA差别

这两天创建批次物料,用BAPI_MATERIAL_SAVE_DATA发现 无论如何传参数,创建成功了

但是在MARA-xchpf 和marc-xchpf 有一个是不成功的。

具体如下,可以实测


*      is_head-material = lv_matnr.
*      is_head-ind_sector = 'M'.
*      is_head-matl_type = ls_mtype.
*      is_head-basic_view = 'X'.
*      is_mara-base_uom = -meins."基本单位
*      is_mara-item_cat = 'NORM'.
*      is_marax-item_cat = 'X'.
*      is_marax-base_uom = 'X'."基本单位
*      is_mara-batch_mgmt = 'X'."批次管理
*      is_marax-batch_mgmt = 'X'."批次管理
*      is_mara-division   = '00'."产品组
*      is_marax-division   = 'X'."产品组
*      is_head-storage_view = 'X'.
*      is_mard-plant = '100Z'.
*      is_mard-stge_loc = -vkorg.
*      is_mardx-plant = '100Z'.
*      is_mardx-stge_loc = -vkorg.
*      is_marc-plant  = '100Z'."工厂
*      is_marcx-plant  = '100Z'."工厂
*      is_marcx-batch_mgmt = 'X'."批次管理
*      is_marc-batch_mgmt = 'X'."批次管理
*
*      CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
*        EXPORTING
*          headdata             = is_head
*          clientdata           = is_mara
*          clientdatax          = is_marax
*          plantdata            = is_marc
*          plantdatax           = is_marcx
*          storagelocationdata  = is_mard
*          storagelocationdatax = is_mardx
*        IMPORTING
*          return               = is_return
*        TABLES
*          materialdescription  = is_makt.
*

BAPI_MATERIAL_SAVEDATAREPLICA 经过测试是可以正常更新批次管理的

      i_testrun = ''.
      CLEAR lt_headdata[].CLEAR lt_clientdata[].CLEAR lt_clientdatax[].
      CLEAR lt_plantdata[].CLEAR lt_plantdatax[].CLEAR lt_storagelocationdata[].
      CLEAR lt_storagelocationdatax[].
      CLEAR lt_materialdescription[].
      CLEAR lt_returnmessages.
      ls_headdata-material = lv_matnr.
      ls_headdata-basic_view = 'X'.
      ls_headdata-matl_type  = ls_mtype.
      ls_headdata-ind_sector = 'M'.
      ls_headdata-purchase_view = 'X'.
      ls_headdata-storage_view = 'X'.
      APPEND ls_headdata TO lt_headdata.

      ls_clientdata-material =  lv_matnr.
      ls_clientdata-base_uom = -meins."基本单位
      ls_clientdata-base_uom_iso = -meins."基本单位
      ls_clientdata-batch_mgmt  = 'X'.
      ls_clientdata-item_cat = 'NORM'.
      ls_clientdata-division = '00'.
      APPEND ls_clientdata TO lt_clientdata.

      ls_clientdatax-material =  lv_matnr.
      ls_clientdatax-base_uom = 'X'.
      ls_clientdataX-base_uom_iso  = 'X'.
      ls_clientdatax-batch_mgmt  = 'X'.
      ls_clientdatax-item_cat = 'X'.
      ls_clientdatax-division = 'X'.
      APPEND ls_clientdatax TO lt_clientdatax.

      ls_plantdata-material =  lv_matnr.
      ls_plantdata-plant = '100Z'.
      ls_plantdata-batch_mgmt = 'X'.
      ls_plantdata-neg_stocks = 'X'.

      APPEND ls_plantdata TO lt_plantdata.

      ls_plantdatax-plant = '100Z'.
      ls_plantdatax-material =  lv_matnr.
      ls_plantdatax-batch_mgmt = 'X'.
      ls_plantdatax-neg_stocks = 'X'.
      APPEND ls_plantdatax TO lt_plantdatax.

      ls_storagelocationdata-material =  lv_matnr.
      ls_storagelocationdata-plant = '100Z'.
      ls_storagelocationdata-stge_loc = '1000'.
      APPEND ls_storagelocationdata TO lt_storagelocationdata.

      ls_storagelocationdatax-material =  lv_matnr.
      ls_storagelocationdatax-plant = '100Z'.
      ls_storagelocationdatax-stge_loc = '1000'.
      APPEND ls_storagelocationdatax TO lt_storagelocationdatax.

      ls_materialdescription-material = lv_matnr.
      ls_materialdescription-langu = '1'.
      ls_materialdescription-matl_desc = is_lmakt-matl_desc.
      APPEND ls_materialdescription TO lt_materialdescription.

      CALL FUNCTION 'BAPI_MATERIAL_SAVEREPLICA'
        EXPORTING
          noappllog            = ''
          nochangedoc          = ''
          testrun              = i_testrun
          inpfldcheck          = 'E'
        IMPORTING
          return               = ls_return
        TABLES
          headdata             = lt_headdata
          clientdata           = lt_clientdata
          clientdatax          = lt_clientdatax
          plantdata            = lt_plantdata
          plantdatax           = lt_plantdatax
          storagelocationdata  = lt_storagelocationdata
          storagelocationdatax = lt_storagelocationdatax
          materialdescription  = lt_materialdescription
          returnmessages       = lt_returnmessages.

你可能感兴趣的:(ABAP,PP,MM,其他,经验分享)