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

Material Code Extension By Using Module Pool

Former Member
0 Likes
501

Dear All,

I have created a module pool to extend material code. For this I am using BAPI_MATERIAL_SAVEDATA. In it I have passed below code and then used CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

  HEADDATA-MATERIAL = T_MAT.
  HEADDATA-PURCHASE_VIEW = 'X'.
  HEADDATA-COST_VIEW = 'X'.

  APPEND HEADDATA.

  PLANTDATA-PLANT = T_WERKS.
  PLANTDATA-PUR_GROUP = MARC-EKGRP.
  PLANTDATA-PROFIT_CTR = MARC-PRCTR.

  APPEND PLANTDATA.

  PLANTDATAX-PLANT = T_WERKS.
  PLANTDATAX-PUR_GROUP = 'X'.
  PLANTDATAX-PROFIT_CTR = 'X'.

  APPEND PLANTDATAX.

  VALUATIONDATA-VAL_AREA = T_WERKS.
*  VALUATIONDATA-VAL_TYPE = MBEW-BWTAR.
  VALUATIONDATA-VAL_CLASS = MBEW-BKLAS.
*  VALUATIONDATA-VAL_CAT = 'P'.

  APPEND VALUATIONDATA.

  VALUATIONDATAX-VAL_AREA = T_WERKS.
*  VALUATIONDATAX-VAL_TYPE = 'X'.
  VALUATIONDATAX-VAL_CLASS = 'X'.
*  VALUATIONDATAX-VAL_CAT = 'X'.

  APPEND VALUATIONDATAX.

  CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
    EXPORTING
      HEADDATA                   = HEADDATA
*     CLIENTDATA                 =
*     CLIENTDATAX                =
     PLANTDATA                  = PLANTDATA
     PLANTDATAX                 = PLANTDATAX
*     FORECASTPARAMETERS         =
*     FORECASTPARAMETERSX        =
*     PLANNINGDATA               =
*     PLANNINGDATAX              =
*     STORAGELOCATIONDATA        =
*     STORAGELOCATIONDATAX       =
     VALUATIONDATA              = VALUATIONDATA
     VALUATIONDATAX             = VALUATIONDATAX
*     WAREHOUSENUMBERDATA        =
*     WAREHOUSENUMBERDATAX       =
*     SALESDATA                  =
*     SALESDATAX                 =
*     STORAGETYPEDATA            =
*     STORAGETYPEDATAX           =
*     FLAG_ONLINE                = ' '
*     FLAG_CAD_CALL              = ' '
*     NO_DEQUEUE                 = ' '
*     NO_ROLLBACK_WORK           = ' '
   IMPORTING
     RETURN                     = RETURN
   TABLES
     MATERIALDESCRIPTION        = MATERIALDESCRIPTION
*     UNITSOFMEASURE             =
*     UNITSOFMEASUREX            =
*     INTERNATIONALARTNOS        =
*     MATERIALLONGTEXT           =
*     TAXCLASSIFICATIONS         =
     RETURNMESSAGES             = RETURNMESSAGES
*     PRTDATA                    =
*     PRTDATAX                   =
*     EXTENSIONIN                =
*     EXTENSIONINX               =
            .

   CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

I have to extend in both cases when the material has split valuation and when it has not. After it when I see in MM60 then materail is not extended. But when I see in mm03 then I can see but the Accounting 1 Tab does not exist. How to use this BAPI to extend material from 1 Plant to another with & without split valuation.

Please guide me.

Thanks & Regards,

Bharti Jain

2 REPLIES 2
Read only

Former Member
0 Likes
451

Dear All,

Kindly guide me in this matter.

Regards,

Bharti Jain

Read only

Former Member
0 Likes
451

Solved by myself