‎2007 Feb 13 6:04 AM
HI,
I am facing a problem in updating custom fields using bapi_material_savedata.
I am doing everything correctly but custom fields are not getting updated.
I am passing EXTENSION and EXTENXIONX structure also.extended BAPI_TE_MARC and BAPI_TE_MARCX structures also.
and i committed also.
what may be the problem,
PLEASE HELP ME. OR ANYBODY PLEASE GIVE SOME SAMPLE CODE WHICH WORKED PROPERLY.
THANKS,
anil.
‎2007 Feb 13 6:20 AM
Hi anil,
u can create all types of materials thru this fm..
for further reference use the following link...
http://sap-img.com/abap/bapi-to-copy-materials-from-one-plant-to-another.htm
hope this helps u a bit,
all the best,
regards,
sampath
mark helpful answers
‎2007 Feb 13 6:21 AM
Hi anil,
Have you flagged the fields you need to be updated? Refer to codes below:
FORM f_update_marc_table USING p_t_so_baseline LIKE t_so_baseline.
CLEAR: s_bapimathead,
s_plantdata,
s_plantdatax.
p_t_so_baseline holds updated data to modify material status in marc
IF NOT p_t_so_baseline IS INITIAL.
Update through bapi will be per line basis
LOOP AT p_t_so_baseline INTO s_so_baseline
WHERE z_item_status = c_surplus.
Structure for bapi header
s_bapimathead-material = s_so_baseline-z_matnr.
s_bapimathead-purchase_view = c_x.
Structure for plantdata where values are to be transferred
s_plantdata-plant = s_so_baseline-z_werks.
For module 3, enter surplus values identified by NB81
IF w_flag EQ 3.
IF s_so_baseline-z_werks = c_us06.
s_plantdata-pur_status = c_skipmat.
ELSEIF s_so_baseline-z_werks = c_us05.
s_plantdata-pur_status = c_sur_lvll.
ENDIF.
For module 5, clear surplus status of materials
ELSEIF w_flag EQ 5.
s_plantdata-pur_status = space.
ENDIF.
Structure for update flag. Values being flagged with 'x'
will be updated with the values in s_plantdata
s_plantdatax-plant = s_so_baseline-z_werks.
s_plantdatax-pur_status = c_x.
Call bapi BAPI_MATERIAL_SAVEDATA to update mm02-purchase view
and table marc
PERFORM f_bapi_material_savedata CHANGING w_retcode1.
CLEAR: s_plantdata,
s_plantdatax,
s_so_baseline,
s_bapimathead.
ENDLOOP.
ENDIF.
ENDFORM.
----
FORM f_bapi_material_savedata CHANGING p_w_retcode1.
CLEAR: p_w_retcode1,
s_return.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = s_bapimathead
plantdata = s_plantdata
plantdatax = s_plantdatax
IMPORTING
return = s_return. "bapi return messages
Commit work after bapi call
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
IMPORTING
return = s_return2. "bapi return messages
p_w_retcode1 = sy-subrc.
ENDFORM.
‎2007 Feb 13 6:30 AM
sorry friends,
i forgot to mention that i am updatinf the material master using custom fields.
i have added some custom fields to MARC and these fields required to be updated.
now please come with ur ideas?
do i need to set any flag for views while updating?
thnaks,
anil
‎2007 Feb 13 6:35 AM
Hi LEO,
I don know which view needs to be set to X. Hoe could i set that?
please help me.
thnaks,
anil.
‎2007 Feb 13 6:54 AM
Hi,
Add the EXTENSIONIN and EXTENSIONINX in the tables parameter of the fm.
In the structure field of EXTENSIONIN write ' BAPI_TE_MARC' , VALUEPART1 is the field extended, similarly fill teh EXTENSIONINX also.
Since this is a table, you can add different stcuture like
BAPI_TE_<NAME> (<NAME> = MARA, MARC, MARD, MBEW, MLGN, MLGT, MVKE)
Regards
Subramanian
‎2007 Mar 22 6:14 AM
Hi Anil,
I am facing the same problem of updating Z field in MARA through BAPI BAPI_MATERIAL_SAVEDATA. Kindly help me how to update that because you allready had this issue hope will get some help from you.
Warm Regards
Tanweer Zaki