Application Development 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: 

Recording using tr MM02

Former Member
0 Kudos

Hi Friends,

I want to change material master record using tr MM02, but i am not able to understand that views then how to record that views can any one help me.

its urgent.

with regards,

kulkarni.

3 REPLIES 3

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Yes, do not use BDC over MM02, instead use the BAPI_MATERIAL_SAVEDATA. It will work better. HEre is a sample.


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.

In this example, we are simply changing the old material number fields on Basic Data 1 view.

Regards

Rich Heilman

0 Kudos

Hi Rich,

my requirement is to record tr MM02 using bdc my main question how to record that views .

regards,

kulkarni

Former Member
0 Kudos

Are you asking how to use transaction SHDB to do the recording? If so, press the help button on the first screen. This will take you to the documentation.

Or are you asking about screen flow for MM02? In that case, you should sit down with your functional person or person who gave you the requirements and have him/her walk through the process.

Rob