‎2011 Jan 04 6:55 AM
Hi Experts,
i was tring to create material using bapi ' bapi_material_savedata' but the material is not updating in the table.
please find the code and suggest me if any modification
data: la_headdata type BAPIMATHEAD,
la_clientdata type BAPI_MARA,
la_CLIENTDATAX type BAPI_MARAX,
la_return type BAPIRET2.
data: i_materialdescription type table of BAPI_MAKT,
wa_materialdescription like line of i_materialdescription.
*la_headdata-MATERIAL = int_matnum-MATERIAL.
**----
*LOOP AT int_matnum.
la_headdata-MATERIAL = int_matnum-MATERIAL.
write : int_matnum-material.
*ENDLOOP.
*----
la_headdata-MATERIAL = '100000518'."int_matnum-MATERIAL.
la_headdata-IND_SECTOR = p_indsr.
la_headdata-MATL_TYPE = p_matype.
la_clientdata-BASE_UOM = 'FT3'.
la_clientdata-pur_valkey = ' '.
la_CLIENTDATAX-BASE_UOM = 'X'.
la_clientdata-MATL_GROUP = '01'.
la_CLIENTDATAX-MATL_GROUP = 'X'.
wa_materialdescription = 'TEST'.
append wa_materialdescription to i_materialdescription.
clear: wa_materialdescription.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = la_headdata
CLIENTDATA = la_clientdata
CLIENTDATAX = la_CLIENTDATAX
PLANTDATA =
PLANTDATAX =
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA =
STORAGELOCATIONDATAX =
VALUATIONDATA =
VALUATIONDATAX =
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA =
SALESDATAX =
STORAGETYPEDATA =
STORAGETYPEDATAX =
FLAG_ONLINE = ' '
FLAG_CAD_CALL = ' '
IMPORTING
RETURN = la_return
TABLES
MATERIALDESCRIPTION = i_materialdescription
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
RETURNMESSAGES =
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
.
Please Help me
Regards,
Naresh
‎2011 Jan 04 7:12 AM
Hello Naresh ,
Please check ,
MOVE 'X' TO headdata-basic_view. " ( Updates MARA) * ( in your case only this will do...!)*
MOVE 'X' TO HEADDATA-PURCHASE_VIEW. " Plant data ( Updates MARC )
Hope this help..!
Please post the return message if the problem exists...!
Edited by: Anup D on Jan 4, 2011 8:14 AM
‎2011 Jan 04 7:00 AM
Hello Naresh,
Did you check the RETURN structure? What are the messages logged in it?
Did you use BAPI_TRANSACTION_COMMIT after the call to BAPI_MATERIAL_SAVEDATA?
BR,
Suhas
‎2011 Jan 04 7:06 AM
HI Suhas,
i got this value in the return structure
"Structure: flat & not charlike"
and i have used the Bapi_transaction_commit in sequence.
please help how to chechk the return structure
Thanks
Naresh
‎2011 Jan 04 7:16 AM
In Addition to the changes mentioned by ANUP, Change this
wa_materialdescription = 'TEST'.
append wa_materialdescription to i_materialdescription.To
wa_materialdescription-langu = sy-langu.
wa_materialdescription-matl_desc = 'TEST'.
append wa_materialdescription to i_materialdescription.
‎2011 Jan 04 7:00 AM
‎2011 Jan 04 7:12 AM
Hello Naresh ,
Please check ,
MOVE 'X' TO headdata-basic_view. " ( Updates MARA) * ( in your case only this will do...!)*
MOVE 'X' TO HEADDATA-PURCHASE_VIEW. " Plant data ( Updates MARC )
Hope this help..!
Please post the return message if the problem exists...!
Edited by: Anup D on Jan 4, 2011 8:14 AM
‎2011 Jan 04 7:18 AM
Hi Anup,
I have added this code in the program
la_headdata-BASIC_VIEW = 'X'.
but these is no effect in the table..
‎2011 Jan 04 7:22 AM
Please past...the agruments which you are getting in the return structure...don't just give the msg. Give....alll the fields.
‎2011 Jan 04 7:37 AM
HI Anup,
when i try to print the values in the return structure like type message i got these vals
E ,
The numeric material number 100000518 was transferred without leading zeros
please help
thanks
Naresh
‎2011 Jan 04 7:42 AM
This error message is self-explanatory. You have to use conversion exit before passing the Material Number.
‎2011 Jan 04 7:43 AM
HI vinod ,
can you please explain in more detailed.
thanks
Naresh
‎2011 Jan 04 7:45 AM
Hi,
Use conversion exit for leading zeros for the field matnr. use FM : CONVERSION_EXIT_MATN1_INPUT
Regards,
Srini.
‎2011 Jan 04 7:46 AM
As said please try this conversion exit b4 calling the bapi ....!
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = <pass your matnr>
IMPORTING
output = headdata-material.
Hope it helps,
Thanks and regards
‎2011 Jan 04 9:35 AM
Hi all,
Now it is asking me for the other fields,
"
E ,
The field MARA-XCHPF/BAPI_MARA-BATCH_MGMT is defined as a required field; it does not contain an entry
"
i have passed this val as
la_clientdata-batch_mgmt = 'X'.
even though i am getting the same error.
can you help me to solve the issue.
Tthanks
Naresh
Edited by: naresh.k.dasari on Jan 4, 2011 10:36 AM
‎2011 Jan 04 9:54 AM
Hello,
Did you pass 'X' to BAPI_MARAX structure?
BAPI_MARAX-BATCH_MGMT = 'X'BR,
Suhas