‎2006 Mar 16 4:16 PM
Hi guys
I want to describe my situation. I want to create a material master data with the bapi "bapi_master_savedata". I have found out that this is the right one. Now I went to Tcode "se37" and saw too many input possibilities. I inserted some values but an error says the value "matnr" is blank or something like that. I just want to insert some mandatory values, create a material and get back the response.
Import parameters
Headdata/MATERIAL=new_material
Headdata/IND_SECTOR=c
Headdata/MATL_TYPE=voll
Clientdata/MATL_GROUP=01
Clientdata/BASE_OUM=GAI
Tables
Materialdescription/MATL_DESC=neues_material_desc
My question to you is, which input values are mandatory and have to be given input at least??
Thanks for your help.
Go:khan
‎2006 Mar 16 4:20 PM
Actually....All parameters are optional except for <b>HEADDATA</b> which is mandatory...You must fill the whole structure. It's based on table <b>BAPIMATHEAD</b>.
Greetings,
Blag.
‎2006 Mar 16 4:20 PM
Actually....All parameters are optional except for <b>HEADDATA</b> which is mandatory...You must fill the whole structure. It's based on table <b>BAPIMATHEAD</b>.
Greetings,
Blag.
‎2006 Mar 16 4:29 PM
Hi Alvaro
Thanks for the quick reply. Ok this information is a first big hint for me.
I have inserted some values in the headdata fiels and executed it. It says: "170 The parameter KZ_PFR does not contain a valid value".
I can't find this parameter in the headdata?
Where can I find it quickly amid that amount of parameters??
‎2006 Mar 16 4:52 PM
Hi
I have successfully created a material master data, horray. Thanks you all.
I have one final question. Is there any response value that is thrown back ???
‎2006 Mar 16 4:54 PM
Well, its an external Number range assigned, then you get the material number back.
Regards,
Ravi
Note : Please reward the posts that helped you.
‎2006 Mar 16 4:57 PM
‎2006 Mar 16 5:05 PM
Hi Rich
There is a return of type BAPIRET2
and a returnmessages of type BAPI_MATRETURN2 (that you mentioned)
Ok I will check at least the fields in "returnmessages".
Where can I check the values from the response??
Maybe right away in tcode se37??
‎2006 Mar 16 5:07 PM
Gokhan,
If you executing the function in a stand alone mode, you will get it in SE37. If you are calling from a program, then the return values will come into the variable which is recieving the the values.
Regards,
Ravi
‎2006 Mar 16 4:24 PM
Hi Gokhan,
You can take a look at import, export and tables parameters of the function module/BAPI. If the optional checkbox is not checked then it means mandatory field otherwise an option for you to populate or not.
Hope this will help.
Regards,
Ferry Lianto
‎2006 Mar 16 4:28 PM
It really depends on what fields you have marked as required in configuration. Here is a sample program that creates a FERT material with the bare minimum fields.
report zrich_0003 .
data: headdata type bapimathead.
data: clientdata type bapi_mara.
data: clientdatax type bapi_marax.
data: descdata type table of BAPI_MAKT with header line.
data: return type bapiret2 .
data: returnm type table of bapi_matreturn2 with header line.
data: xmara type mara.
parameters: p_matnr type mara-matnr.
headdata-material = p_matnr.
headdata-ind_sector = 'M'.
headdata-matl_type = 'FERT'.
headdata-basic_view = 'X'.
clientdata-BASE_UOM = 'EA'.
clientdatax-BASE_UOM = 'X'.
clientdata-old_mat_no = 'Old Material'.
clientdatax-old_mat_no = 'X'.
clientdata-division = '00'.
clientdatax-division = 'X'.
descdata-LANGU = sy-langu.
descdata-MATL_DESC = 'This is the description'.
append descdata.
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
headdata = headdata
clientdata = clientdata
clientdatax = clientdatax
* PLANTDATA =
* PLANTDATAX =
* FORECASTPARAMETERS =
* FORECASTPARAMETERSX =
* PLANNINGDATA =
* PLANNINGDATAX =
* STORAGELOCATIONDATA =
* STORAGELOCATIONDATAX =
* VALUATIONDATA =
* VALUATIONDATAX =
* WAREHOUSENUMBERDATA =
* WAREHOUSENUMBERDATAX =
* SALESDATA =
* SALESDATAX =
* STORAGETYPEDATA =
* STORAGETYPEDATAX =
importing
return = return
tables
MATERIALDESCRIPTION = descdata
* UNITSOFMEASURE =
* UNITSOFMEASUREX =
* INTERNATIONALARTNOS =
* MATERIALLONGTEXT =
* TAXCLASSIFICATIONS =
returnmessages = returnm
* PRTDATA =
* PRTDATAX =
* EXTENSIONIN =
* EXTENSIONINX =
.
check sy-subrc = 0.
Regards,
Rich Heilman
‎2006 Nov 13 5:43 AM
Hi. I am having a problem with bapi_material_savedata. I am creating new material and we are using external numbering. I used bapi_material_getintnumber to get the next material number then use it when calling bapi bapi_material_savedata. However, after executing the savedata bapi an error occurs saying that the material number is not existing. my question is how will i'm going to use the number I got from bapimaterial_getintnumber.
Please help