‎2010 Jan 19 7:24 AM
Hello experts,
I have added one field using append structure in table MARC. I want to updated this field usnign BAPI_MATERIAL_SAVEDATA. can anybody tell me the procedure to do that?
Thanks in advance.
‎2010 Jan 19 7:49 AM
Hello,
Check the documentation of the function module BAPI_MATERIAL_SAVEDATA. There is a parameter in the FM - EXTENSIONIN where in new fields added to the table can be used to be updated.
The documentation of that parameters tells you how this can be achieved.
Create 2 structures of the type BAPI_TE_MARA and BAPI_TE_MARAX
Now assign the field structure of the workarea of type BAPIPAREX. Assume gs_extensionin is of type BAPIPAREX and gs_bapi_te_mara is of type BAPI_TE_MARA (this should have the fields that have been added in the table)
gs_extensionin-structure = 'BAPI_TE_MARA'.
gs_extensionin-valuepart+0(18) = gs_bapi_te_mara-matnr.
gs_extensionin-valuepart+18(length of the new field) = ga_bapi_te_mara-<new field added in the structure>.
append gs_extensionin to gt_extensionin.
gs_extensioninx-structure = 'BAPI_TE_MARAX'.
gs_extensioninx-valuepart+0(18) = gs_bapi_te_mara-matnr.
gs_extensioninx-valuepart+18(1) = 'X'..
append gs_extensioninx to gt_extensioninx.
Now pass these tables gt_extensionin and gt_extensionx to the parameters extensionin and extensioninx of the function module BAPI_MATERIAL_SAVEDATA.
Also try searching SDN using Extending BAPI's
Hope this will help in solving your query.
Regards,
Sachin