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

create material using bapi ' bapi_material_savedata'

Former Member
0 Likes
2,579

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

1 ACCEPTED SOLUTION
Read only

anup_deshmukh4
Active Contributor
0 Likes
1,862

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

14 REPLIES 14
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,862

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

Read only

Former Member
0 Likes
1,862

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

Read only

Former Member
0 Likes
1,862

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.

Read only

Former Member
0 Likes
1,862

Did you use BAPI_TRANSACTION_COMMIT after BAPI call.

Read only

anup_deshmukh4
Active Contributor
0 Likes
1,863

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

Read only

0 Likes
1,862

Hi Anup,

I have added this code in the program

la_headdata-BASIC_VIEW = 'X'.

but these is no effect in the table..

Read only

0 Likes
1,862

Please past...the agruments which you are getting in the return structure...don't just give the msg. Give....alll the fields.

Read only

0 Likes
1,862

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

Read only

0 Likes
1,862

This error message is self-explanatory. You have to use conversion exit before passing the Material Number.

Read only

0 Likes
1,862

HI vinod ,

can you please explain in more detailed.

thanks

Naresh

Read only

0 Likes
1,862

Hi,

Use conversion exit for leading zeros for the field matnr. use FM : CONVERSION_EXIT_MATN1_INPUT

Regards,

Srini.

Read only

0 Likes
1,862

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

Read only

0 Likes
1,862

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

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,862

Hello,

Did you pass 'X' to BAPI_MARAX structure?

BAPI_MARAX-BATCH_MGMT = 'X'

BR,

Suhas