‎2011 Jan 05 9:28 AM
HI Experts,
how to update Marc table using the bapi_material_savedata.
i have passed these values.
la_plantdata-PLANT = '1001'.
la_Plantdata-PUR_STATUS = '01'.
la_plantdatax-PLANT = '1001'.
la_plantdatax-PUR_STATUS = 'X'.
but these is no change in MARC table
please help.
thanks
Naresh
‎2011 Jan 05 9:35 AM
Hi try this way...
select single * from mara into w_mara where matnr = material.
next move corresponding-fields ot w_mara to xbapimathead.
Select * from marc into table t_marc where matnr = matnr.
Loop at t_marc.
next move corresponding-fields ot t_marc to la_plantdata.
and update the below fields finally
la_plantdata-PLANT = '1001'.
la_Plantdata-PUR_STATUS = '01'.
la_plantdatax-PLANT = '1001'.
la_plantdatax-PUR_STATUS = 'X'.
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
headdata = xbapimathead
plantdata = la_plantdata
plantdatax = la_plantdatax
importing
return = xbapiret2.
endloop.
Prabhudas
‎2011 Jan 05 9:46 AM
Hi Prabhu,
Actually i am creating a material with the bapi and the materal need to be stored in Marc table too.
but the record is not getting updated in marc table and the record is getting created in mara .
it is giving me the following message
144The field MARA-EKWSL/BAPI_MARA-PUR_VALKEY is defined as a required field; it does not contain an entry
please help.
Thanks
Naresh
Edited by: naresh.k.dasari on Jan 5, 2011 10:51 AM
‎2011 Jan 05 10:00 AM
Hello
Try to add this into header structure:
HEADDATA-MATERIAL = P_MATNR. " <- set material number here
HEADDATA-MRP_VIEW = 'X'.
HEADDATA-INP_FLD_CHECK = 'W'.
P.s.: if this will not help, than change HEADDATA-MRP_VIEW to HEADDATA-PURCHASE_VIEW.
‎2011 Jan 05 10:08 AM
As the error message explains, fill this value (check table is T405, ask your functionnal for a rule to fill the field or a default value to use)
As MARA record has been inserted, first check via MM03 if the missing field has been actually filled with a default value, you may try to add the material to a plant via MM01 and look for any error message.
In your program, you could use BAPI_MATERIAL_GET_DETAIL after the commit of the first BAPI call (MARA insertion) and use the value actually inserted in MARA for the missing field (may comes from a default value associated to material type or other customizing point) in the second BAPI call (MARC insertion)
Regards,
Raymond
‎2011 Jan 05 10:36 AM
HI Raymond,
i have checked the table t405 the value are there in the table.
and i hav e checked in mm03 as well but these is only 2 views are there.
PLase help me.
Thanks
Naresh
‎2011 Jan 05 10:57 AM
"Purchasing value key" is (should be) on "Purchasing" tab, even if the field is on MARA tab, the field is not checked before you affect the material to a plant. (so you were able to create the material basic data)
You can only seen the 2 basic data tabs, no ?
Check via SE16n on MARA, is the field EKWSL initial ?
Now call MM01, fill material field, press enter, other fields should be populated now (ignore popup) and press "organizational levels" and select "Purchasing". The screen which will appear will have the"Purchasing value key" input-enabled (and can be initial for first plant) and you MUST fill this field.
Your BAPI must proceed the same way, so fill the field BAPI_MARA-PUR_VALKEY when creating MARC.
If you really don't want to (or cannot) fill the "purchasing" tab, try to remove the purchase view of the call (field BAPIMATHEAD-PURCHASE_VIEW in HEADDATA) -> Ask your functionnal
Regards,
Raymond
‎2011 Jan 05 12:11 PM
Naresh,
what all the fields you are passing to that BAPI to create the material.
Kruthik.
‎2011 Jan 06 5:35 AM
HI Raymond,
can you please guide me to update marc using the bapi_material_savedata.
for me it is only updating the mara table.
please help.
thanks
naresh
‎2011 Jan 06 8:23 AM