Skip to Content
0
Former Member
Apr 19, 2007 at 10:46 AM

BAPI_MATERIAL_SAVEDATA-Tax fields not getting updated.

511 Views

Hi Everyone,

I'm trying to create material through this BAPI -"BAPI_MATERIAL_SAVEDATA"

I'm also passing the tax information related to it in the TAXCLASSIFICATIONS table.I'm populating the fields in the format as I have shown below in the code.Everything is working fine ,material is getting created except the tax information in the material not being affected against what I'm passing.I'm not sure though what does the tax_ind field does in the TAXCLASSIFICATIONS table.

Specifically,The country CA has different type codes mentioned as CATX1,CATX2,CATX3.But the values are getting updated only for the CATX1 category code.So after the creation, All the countries have their taxes classified except and CATX2 and CATX3 remain blank-no entry at all.

Kindly let me know if you have a clue regarding this.

FUNCTION Z_CREATE_MATERIAL.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(MATERIAL) TYPE  MARA-MATNR OPTIONAL
*"     VALUE(MATDESC) TYPE  MAKT-MAKTX OPTIONAL
*"     VALUE(KBETR) TYPE  BDCDATA-FVAL OPTIONAL
*"     VALUE(MATCOST) TYPE  STPRS_BAPI OPTIONAL
*"  EXPORTING
*"     VALUE(MESSAGE) TYPE  STRING
*"----------------------------------------------------------------------

  DATA: BAPI_HEAD   LIKE BAPIMATHEAD,
        BAPI_MAKT   LIKE BAPI_MAKT,    "Material Description
        BAPI_MARA1  LIKE BAPI_MARA,    "Client Data
        BAPI_MARAX  LIKE BAPI_MARAX,
        BAPI_MARC1  LIKE BAPI_MARC,    "Plant View
        BAPI_MARCX  LIKE BAPI_MARCX,
        BAPI_MBEW1  LIKE BAPI_MBEW,    "Accounting View
        BAPI_MBEWX  LIKE BAPI_MBEWX,
        BAPI_RETURN LIKE BAPIRET2,
        bapi_sales like BAPI_MVKE,
        bapi_salesx like BAPI_MVKEX,
        bapi_mard like BAPI_mard,
        bapi_mardx like BAPI_mardx.

  DATA: BEGIN OF INT_MAKT OCCURS 100.
          INCLUDE STRUCTURE BAPI_MAKT.
  DATA: END OF INT_MAKT.


  DATA: BEGIN OF L_T_MARM OCCURS 100.
          INCLUDE STRUCTURE   BAPI_MARM.
  DATA: END OF L_T_MARM.

  DATA: BEGIN OF L_T_MARMx OCCURS 100.
          INCLUDE STRUCTURE   BAPI_MARMx.
  DATA: END OF L_T_MARMx.

  DATA: BEGIN OF L_T_tax OCCURS 100.
          INCLUDE STRUCTURE   BAPI_MLAN.
  DATA: END OF L_T_tax.

*for plant 3800
* Header
  BAPI_HEAD-MATERIAL        = MATERIAL.
  BAPI_HEAD-IND_SECTOR      = '1'.
  BAPI_HEAD-MATL_TYPE       = 'HAWA'.
  BAPI_HEAD-BASIC_VIEW      = 'X'.
  bapi_head-SALES_VIEW = 'X'.
  bapi_head-PURCHASE_VIEW = 'X'.
  BAPI_HEAD-ACCOUNT_VIEW    = 'X'.
  bapi_head-cost_view = 'X'.
  bapi_head-mrp_view = 'X'.

* Client Data - Basic
***********
  BAPI_MARA1-BASE_UOM       = 'EA'.
  BAPI_MARA1-UNIT_OF_WT     = 'LB'.
  BAPI_MARA1-ALLWD_VOL = '10'.
  BAPI_MARA1-PACK_VO_UN = 'CCM'.
  bapi_marax-ALLWD_VOL = 'X'.
  bapi_marax-PACK_VO_UN = 'X'.

**********
  BAPI_MARA1-DIVISION       = '00'.
  BAPI_MARA1-NET_WEIGHT     = '1'.
  BAPI_MARA1-MATL_GROUP = '002'.
  BAPI_MARa1-TRANS_GRP = '0001'.
  bapi_mara1-prod_hier = '001700010000000110'.
  BAPI_MARAX-trans_grp    = 'X'.
  bapi_marax-prod_hier = 'X'.
  BAPI_MARAX-BASE_UOM   = 'X'.
  BAPI_MARAX-UNIT_OF_WT   = 'X'.
  BAPI_MARAX-DIVISION    = 'X'.
  BAPI_MARAX-MATL_GROUP    = 'X'.
  BAPI_MARAX-NET_WEIGHT    = 'X'.
  bapi_mara1-ITEM_CAT = 'NORM'.
  BAPI_MARAX-item_cat    = 'X'.

*Units of measure - Gross weight populate
  L_T_MARM-ALT_UNIT = 'EA'.
  L_T_MARM-ALT_UNIT_ISO = 'EA'.
  L_T_MARM-GROSS_WT = '1'.
  L_T_MARM-UNIT_OF_WT = 'LB'.
******************
  L_T_MARM-VOLUME = '100'.
  L_T_MARM-VOLUMEUNIT = 'CCM'.
  L_T_MARMX-VOLUME = 'X'.
  L_T_MARMX-VOLUMEUNIT = 'X'.


  APPEND L_T_MARM.

  L_T_MARMX-UNIT_OF_WT = 'X'.
  L_T_MARMX-GROSS_WT = 'X'.
  L_T_MARMX-ALT_UNIT = 'EA'.
  L_T_MARMX-ALT_UNIT_ISO = 'EA'.



  APPEND L_T_MARMX.

*Tax Classification
  L_T_tax-DEPCOUNTRY = 'US'.
  L_T_tax-DEPCOUNTRY_ISO = 'US'.
  L_T_tax-TAX_TYPE_1 = 'UTXJ'.
  L_T_tax-TAXCLASS_1 = '1'.

   append l_t_tax.

  L_T_tax-DEPCOUNTRY = 'DE'.
  L_T_tax-DEPCOUNTRY_ISO = 'DE'.
  L_T_tax-TAX_TYPE_1 = 'MWST'.
  L_T_tax-TAXCLASS_1 = '1'.
  append l_t_tax.


  L_T_tax-DEPCOUNTRY = 'CA'.
  L_T_tax-DEPCOUNTRY_ISO = 'CA'.
  L_T_tax-TAX_TYPE_1 = 'CTX1'.
  L_T_tax-TAXCLASS_1 = '0'.

  append l_t_tax.


  L_T_tax-DEPCOUNTRY = 'CA'.
  L_T_tax-DEPCOUNTRY_ISO = 'CA'.
  L_T_tax-TAX_TYPE_1 = 'CTX2'.
  L_T_tax-TAXCLASS_1 = '0'.

   append l_t_tax.


  L_T_tax-DEPCOUNTRY = 'CA'.
  L_T_tax-DEPCOUNTRY_ISO = 'CA'.
  L_T_tax-TAX_TYPE_1 = 'CTX3'.
  L_T_tax-TAXCLASS_1 = '0'.

    append l_t_tax.


  L_T_tax-DEPCOUNTRY = 'AU'.
  L_T_tax-DEPCOUNTRY_ISO = 'AU'.
  L_T_tax-TAX_TYPE_1 = 'ATX1'.
  L_T_tax-TAXCLASS_1 = '0'.

   append l_t_tax.

  L_T_tax-DEPCOUNTRY = 'NZ'.
  L_T_tax-DEPCOUNTRY_ISO = 'NZ'.
  L_T_tax-TAX_TYPE_1 = 'NZTX'.
  L_T_tax-TAXCLASS_1 = '0'.

   append l_t_tax.

* Material Description
  REFRESH INT_MAKT.
  INT_MAKT-LANGU           = 'EN'.
  INT_MAKT-MATL_DESC       = MATDESC.
  APPEND INT_MAKT.

* Plant - Purchasing
  BAPI_MARC1-PLANT      = '3800'.
  BAPI_MARC1-PUR_GROUP  = '100'.
  BAPI_MARCX-PLANT      = '3800'.
  BAPI_MARC1-ISS_ST_LOC = '0001'.
  BAPI_MARC1-SLOC_EXPRC = '0001'.
  BAPI_MARCx-PUR_GROUP      = 'X'.
  BAPI_MARCX-ISS_ST_LOC = 'X'.
  BAPI_MARCX-SLOC_EXPRC = 'X'.

  BAPI_MARC1-LOADINGGRP = '0002'.
  BAPI_MARCx-LOADINGGRP = 'X'.

  BAPI_MARC1-PLND_DELRY = '1'.
  BAPI_MARC1-MRP_TYPE = 'PD'.
  BAPI_MARC1-MRP_CTRLER = '001'.
  BAPI_MARC1-SM_KEY = '001'.
  BAPI_MARC1-LOTSIZEKEY = 'TB'.
  BAPI_MARC1-PROC_TYPE = 'F'.

  BAPI_MARCx-PLND_DELRY      = 'X'.
  BAPI_MARCx-MRP_TYPE      = 'X'.
  BAPI_MARCx-MRP_CTRLER      = 'X'.
  BAPI_MARCx-SM_KEY      = 'X'.
  BAPI_MARCx-LOTSIZEKEY      = 'X'.
  BAPI_MARCx-proc_type = 'X'.

***************
  BAPI_MARC1-MRP_GROUP = '0030'.
  BAPI_MARCx-MRP_GROUP = 'X'.



*Sales View
  bapi_sales-SALES_ORG = '3020'.
  bapi_sales-DISTR_CHAN = '14'.
  bapi_sales-DELYG_PLNT =  '3800'.
  BAPI_SALES-ITEM_CAT = 'NORM'.
  bapi_salesx-ITEM_CAT = 'X'.
  bapi_salesx-Delyg_plnt = 'X'.
  bapi_salesx-sales_org = '3020'.
  bapi_salesx-DISTR_CHAN = '14'.
******************
  bapi_sales-MATL_STATS = '1'.
bapi_salesx-MATL_STATS = 'X'.






* Accounting
  BAPI_MBEW1-VAL_AREA   = '3800'.
  BAPI_MBEW1-VAL_CLASS   = '3100'.
  BAPI_MBEW1-STD_PRICE  = matcost.
  BAPI_MBEW1-PRICE_CTRL = 'V'.
  bapi_mbew1-PRICE_UNIT = '1'.


  BAPI_MBEWX-VAL_AREA   = '3800'.
  BAPI_MBEWX-PRICE_CTRL = 'X'.
  BAPI_MBEWx-STD_PRICE  = 'X'.
  BAPI_MBEWX-VAL_CLASS   = 'X'.
  bapi_mbewx-price_unit = 'X'.

  bapi_mard-plant = '3800'.
  bapi_mard-stge_loc = '0001'.

  bapi_mardx-plant = '3800'.
  bapi_mardx-stge_loc = '0001'.


  CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
    EXPORTING
      HEADDATA                   = BAPI_HEAD
     CLIENTDATA                 = BAPI_MARA1
     CLIENTDATAX                = BAPI_MARAX
     PLANTDATA                  = BAPI_MARC1
     PLANTDATAX                 = BAPI_MARCX
*   FORECASTPARAMETERS         =
*   FORECASTPARAMETERSX        =
*   PLANNINGDATA               =
*   PLANNINGDATAX              =
   STORAGELOCATIONDATA        = bapi_mard
   STORAGELOCATIONDATAX       = bapi_mardx
     VALUATIONDATA              = BAPI_MBEW1
     VALUATIONDATAX             = BAPI_MBEWX
*   WAREHOUSENUMBERDATA        =
*   WAREHOUSENUMBERDATAX       =
     SALESDATA                  = bapi_sales
     SALESDATAX                 = bapi_salesx
*   STORAGETYPEDATA            =
*   STORAGETYPEDATAX           =
*   FLAG_ONLINE                = ' '
*   FLAG_CAD_CALL              = ' '
*   NO_DEQUEUE                 = ' '
*   NO_ROLLBACK_WORK           = ' '
   IMPORTING
     RETURN                     = BAPI_RETURN
   TABLES
     MATERIALDESCRIPTION        = INT_MAKT
   UNITSOFMEASURE             = L_T_MARM
   UNITSOFMEASUREX            = L_T_MARMX
*   INTERNATIONALARTNOS        =
*   MATERIALLONGTEXT           =
   TAXCLASSIFICATIONS         = l_t_tax
*   RETURNMESSAGES             =
*   PRTDATA                    =
*   PRTDATAX                   =
*   EXTENSIONIN                =
*   EXTENSIONINX               =
            .
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

Any suggestions on this one would really mean a lott of help to me.

Thanks a lot,

Archies!!