使用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执行结果,不会去更新扩展字段值
本人常年接收SAP运维和远程项目,ECC,S/4HANA,CRM,WDA.
远程人天可谈,终身售后,有活请联系V信:18925782767(问问题免费,欢迎交流!)
!!请关注本人技术分享公众号:SAP翔子(可扫头像二维码)
每天分享新知识,博客文章也会陆续整理并迁移至公众号,与您一起共同学习