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_MATERIAL_SAVEDATA

Former Member
0 Likes
892

HI ,

Where can i get this bapi. Can any one provide me path.

Thanx

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
855

goto SE37. enter the BAPI name. For its application, u can see the Function Module Documentation at the top reight end.

Hope this is what u wanted to know.

Regards,

Bikash

7 REPLIES 7
Read only

Former Member
0 Likes
856

goto SE37. enter the BAPI name. For its application, u can see the Function Module Documentation at the top reight end.

Hope this is what u wanted to know.

Regards,

Bikash

Read only

0 Likes
855

Here is a sample program which uses the BAPI.




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.

Regards,

Rich Heilman

Read only

0 Likes
855

Hi Rich Heilman ,

can you give me some explanation regarding this example.Thanx

Read only

0 Likes
855

Sure......

This program accepts a material number from the user, and updates the "Old Material Number" field in basis data 1 view of the material master.

Here we are getting the material number from the user and hitting MARA to pick up data which will be needed in the next step.



parameters: p_matnr type mara-matnr.

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

Here will are filling the Header structure. The BAPI needs this in order to access the material. Notice that we have mark the headdata-basic_view field. This means that we want to update something on the basic_view.

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

This next part is where we are actually updating the field on the view. Notice here that we give the value to the "clientdata" structure, we must also mark that field in the "clientddatax" structure with an "X". This tells the BAPI to update that field.

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

Now just call the BAPI.

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               =
          .

Regards,

Rich Heilman

Read only

0 Likes
855

Hi Rich Heilman ,

Thank you very much.

Read only

0 Likes
855

No problem.

Regards,

Rich Heilman

Read only

ferry_lianto
Active Contributor
0 Likes
855

Hi Priya,

Go to SE37 and enter the name or

Go to BAPI (TCODE) and browse by hierarchical or alphabetical order.

Regards,

Ferry Lianto