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

BAPI to create materials MM01

Former Member
0 Likes
5,356

hi,

I am having problems to create materials in the transaction MM01 and i want to create a bapi, but i don't know which i can use.

Somebody could you tell me which BAPI Can I use to do it? and please provide me an example

urgent!!

Thanks.

MArisol.

regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,395

Did you look at BAPI_MATERIAL_SAVEDATA?

hi,

I am having problems to create materials in the transaction MM01 and i want to create a bapi, but i don't know which i can use.

Somebody could you tell me which BAPI Can I use to do it? and please provide me an example

urgent!!

Thanks.

MArisol.

regards

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
3,395

Yes, you can use BAPI_MATERIAL_SAVEDATA

Regards,

RIch Heilman

Read only

0 Likes
3,395

Here is a sample program where is uses the BAPI to update the "Old Material Number" field in Basic Data 1 view.




report zrich_0003 .

data: headdata type bapimathead.
data: clientdata type bapi_mara.
data: clientdatax type bapi_marax.
data: return type  bapiret2 .
data: returnm type table of bapi_matreturn2 with header line.
data: xmara type mara.

parameters: p_matnr type mara-matnr.

select single * from mara into xmara
          where matnr = p_matnr.

headdata-material        = xmara-matnr.
headdata-ind_sector      = xmara-mbrsh.
headdata-matl_type       = xmara-mtart.
headdata-basic_view = 'X'.

clientdata-old_mat_no = 'THE TEXT'.
clientdatax-old_mat_no = 'X'.


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        =
*   UNITSOFMEASURE             =
*   UNITSOFMEASUREX            =
*   INTERNATIONALARTNOS        =
*   MATERIALLONGTEXT           =
*   TAXCLASSIFICATIONS         =
    returnmessages             = returnm
*   PRTDATA                    =
*   PRTDATAX                   =
*   EXTENSIONIN                =
*   EXTENSIONINX               =
          .

check sy-subrc  = 0.

Regarsds,

Rich Heilman

Read only

0 Likes
3,395
Read only

Former Member
0 Likes
3,396

Did you look at BAPI_MATERIAL_SAVEDATA?