Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

update MARC using bapi_material_savedata

Former Member
0 Likes
6,920

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

9 REPLIES 9
Read only

Former Member
0 Likes
4,564

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

Read only

0 Likes
4,564

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

Read only

0 Likes
4,564

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.

Read only

0 Likes
4,564

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

Read only

0 Likes
4,564

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

Read only

0 Likes
4,564

"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

Read only

former_member1125862
Participant
0 Likes
4,564

Naresh,

what all the fields you are passing to that BAPI to create the material.

Kruthik.

Read only

0 Likes
4,564

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

Read only

0 Likes
4,564

Read this thread , there is a small sample. Then analyze the error messages in RETURN parameter and adjust your call or ask your functionnals for missing required information.

Regards,

Raymond