使用BAPI_MATERIAL_SAVEDATA无法写入扩展字段

Posted Rainystuday

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用BAPI_MATERIAL_SAVEDATA无法写入扩展字段相关的知识,希望对你有一定的参考价值。

 

1.目的: 导入MARC增强字段 ZZJYFS, ZZBLBM, ZZBLTXT

 

 

 

 

 



 

 

 2. BAPI结构已经加上了增强字段

 

 

 

 

 

 3. 程序代码

    IF bapi_te_marc IS NOT INITIAL.
      bapi_te_marc-plant  = plantdata-plant.
      bapi_te_marcx-plant = plantdata-plant.
      CLEAR: extensionin, lv_marc_value.
      lv_marc_value  = bapi_te_marc.
      extensionin-structure  = \'BAPI_TE_MARC\'.
      extensionin-valuepart1 = lv_marc_value(240).
      extensionin-valuepart2 = lv_marc_value+240(240).
      extensionin-valuepart3 = lv_marc_value+480(240).
      extensionin-valuepart4 = lv_marc_value+720(240).
      APPEND extensionin.

      CLEAR: extensioninx, lv_marc_valuex.
      lv_marc_valuex = bapi_te_marcx.
      extensioninx-structure  = \'BAPI_TE_MARCX\'.
      extensioninx-valuepart1 = lv_marc_valuex(240).
      extensioninx-valuepart2 = lv_marc_valuex+240(240).
      extensioninx-valuepart3 = lv_marc_valuex+480(240).
      extensioninx-valuepart4 = lv_marc_valuex+720(240).
      APPEND extensioninx.
    ENDIF.

***************"执行bapi*************************
    CALL FUNCTION \'BAPI_MATERIAL_SAVEDATA\'
      EXPORTING
        headdata             = headdata
        clientdata           = clientdata
        clientdatax          = clientdatax
        plantdata            = plantdata
        plantdatax           = plantdatax
        forecastparameters   = forecastparameters
        forecastparametersx  = forecastparametersx
        planningdata         = planningdata
        planningdatax        = planningdatax
        storagelocationdata  = storagelocationdata
        storagelocationdatax = storagelocationdatax
        valuationdata        = valuationdata
        valuationdatax       = valuationdatax
        warehousenumberdata  = warehousenumberdata
        warehousenumberdatax = warehousenumberdatax
        salesdata            = salesdata
        salesdatax           = salesdatax
        storagetypedata      = storagetypedata
        storagetypedatax     = storagetypedatax
        flag_online          = \' \'
        flag_cad_call        = \' \'
        no_dequeue           = \' \'
        no_rollback_work     = \' \'
      IMPORTING
        return               = return
      TABLES
        materialdescription  = materialdescription
        unitsofmeasure       = unitsofmeasure
        unitsofmeasurex      = unitsofmeasurex
        internationalartnos  = internationalartnos
        materiallongtext     = materiallongtext
        taxclassifications   = taxclassifications
        returnmessages       = returnmessages
        prtdata              = prtdata
        prtdatax             = prtdatax
        extensionin          = extensionin
        extensioninx         = extensioninx.
    IF return-type = \'S\' AND gv_test IS INITIAL."执行成功
      CALL FUNCTION \'BAPI_TRANSACTION_COMMIT\' "提交该BAPI
        EXPORTING
          wait = \'X\'.
    ELSE.
      CALL FUNCTION \'BAPI_TRANSACTION_ROLLBACK\'.
    ENDIF.

导入数据:

 

 值已经写到扩展结构:

 

 

 

 

 

BAPI执行结果,不会去更新扩展字段值

 

 

 

 

以上是关于使用BAPI_MATERIAL_SAVEDATA无法写入扩展字段的主要内容,如果未能解决你的问题,请参考以下文章

SAP中查询系统BAPI列表的TCODE是什么?

BAPI

ABAP 创建物料主数据

请问怎么批量扩充物料(mm01)

SAP 调用BAPI创建物料主数据

是否可以使用无状态逻辑(无数据库)使令牌无效?