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 - TAXCLASSIFICATION

Former Member
0 Likes
7,785

Hello,

I am trying to update the field BAPI_MLAN of the view Purchase with the bapi BAPI_MATERIAL_SAVEDATA but i doesn't update.

      bapi_mlan-tax_ind = 1.

   *--- BAPI para crear material
    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
      EXPORTING
        headdata             = bapi_head
        clientdata           = bapi_mara1
        clientdatax          = bapi_marax
        plantdata            = bapi_marc1
        plantdatax           = bapi_marcx
        StorageLocationData  = bapi_mard
        StorageLocationDatax = bapi_mardx
        valuationdata        = bapi_mbew1
        valuationdatax      = bapi_mbewx
      IMPORTING
        return              = bapi_return
      TABLES
        returnmessages = returnmessages
        materialdescription = it_makt
        TaxClassifications  = bapi_mlan
        extensionin  = rex
        extensioninx = rexx.

    IF bapi_return-type = 'E'.
      WRITE:/ 'Error:' ,bapi_return-message ,'for material:' ,bapi_head-material.
    ELSEIF bapi_return-type = 'S'.
       CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
               EXPORTING
                    WAIT = 'X'.

1 ACCEPTED SOLUTION
Read only

Abhijit74
Active Contributor
0 Likes
5,400

Hello,

Have you checked taxclass_1 and taxclass_9 correctly? Because these are the fields depending upon your tax category.

Check whether you have populated these data correctly or not?

Thanks & Regards,

Abhijit

10 REPLIES 10
Read only

Abhijit74
Active Contributor
0 Likes
5,401

Hello,

Have you checked taxclass_1 and taxclass_9 correctly? Because these are the fields depending upon your tax category.

Check whether you have populated these data correctly or not?

Thanks & Regards,

Abhijit

Read only

Former Member
0 Likes
5,400

Hi,

Thanks so much, do you know which tables these values are saved, I don't know which values do I have to put in those fields, so I my plan is to find how other materials were saved

Thanks

Read only

Former Member
0 Likes
5,400

Hi,

Check with TSKM Table .

DATA T_MLAN      TYPE STANDARD TABLE OF  BAPI_MLAN   WITH HEADER LINE INITIAL SIZE 0. 

  T_MLAN-DEPCOUNTRY =  'DE'.

  T_MLAN-TAX_TYPE_1   =  'MWST'.      "  Tax category

  T_MLAN-TAXCLASS_1   =  '0' .             "Tax classification material

  

APPEND T_MLAN.

  CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

      EXPORTING

        headdata             = bapi_head

        clientdata           = bapi_mara1

        clientdatax          = bapi_marax

        plantdata            = bapi_marc1

        plantdatax           = bapi_marcx

        StorageLocationData  = bapi_mard

        StorageLocationDatax = bapi_mardx

        valuationdata        = bapi_mbew1

        valuationdatax      = bapi_mbewx

      IMPORTING

        return              = bapi_return

   TABLES

        returnmessages = returnmessages

        materialdescription = it_makt

        TaxClassifications  =   T_MLAN             " bapi_mlan

        extensionin            = rex

        extensioninx           = rexx.

Regard's

Smruti

Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
5,400

Hi Enrique

What error message does it return when you are updating?

Nabheet

Read only

0 Likes
5,400

hello,

I dont have any error, but when I go to mm03 to consult the material, I dont see any value in the field taxim

Read only

Former Member
0 Likes
5,400

are you also supplying the plant? I am pretty sure that fields is at plant level - so if you set the indicator and not the plant it applies to then it will not show up in material master

Read only

0 Likes
5,400

this is my code, i doesnt give any error but I dont see the value 1 in purchase view for the material.

   * Compra
    bapi_marc1-plant = it_data-werks.
    bapi_marc1-pur_group = it_data-ekgrp.
    bapi_marcx-plant = it_data-werks.
    bapi_marcx-pur_group = 'X'.

this is the value of the table tskm

   *Impuesto
    "bapi_mlan-tax_ind = it_data-taxim.
    bapi_mlan-depcountry = 'PE'.
    bapi_mlan-tax_type_1 = 'MWST'.
    bapi_mlan-taxclass_1 = it_data-taxim. "this is value 1
    bapi_mlan-tax_ind = it_data-taxim. "this is value 1

   *--- BAPI para crear material
    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
      EXPORTING
        headdata             = bapi_head
        clientdata           = bapi_mara1
        clientdatax          = bapi_marax
        plantdata            = bapi_marc1
        plantdatax           = bapi_marcx
        StorageLocationData  = bapi_mard
        StorageLocationDatax = bapi_mardx
        valuationdata        = bapi_mbew1
        valuationdatax      = bapi_mbewx
      IMPORTING
        return              = bapi_return
      TABLES
        returnmessages = returnmessages
        materialdescription = it_makt
        TaxClassifications  = bapi_mlan
        materiallongtext = bapi_mltx
        extensionin  = rex
        extensioninx = rexx.

    IF bapi_return-type = 'E'.
      WRITE:/ 'Error:' ,bapi_return-message ,'for material:' ,bapi_head-material.
    ELSEIF bapi_return-type = 'S'.
       CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
               EXPORTING
                    WAIT = 'X'.

Read only

0 Likes
5,400

IT'S SOLVED

I ommit  the append  bapi_mlan, I think I am tired

Read only

mert_akiner
Discoverer
0 Likes
5,400

It is possible to update with the values from the inner join of the T001W and TKMK1 tables.

If the values you entered in the DEPCOUNTRY eq (T001W-LAND1) and TAX_IND fields are not in the TKMK1 table, it may not be updating.

Read only

0 Likes
3,597

Hi together,

the LAND1 must not be taken from T001W, but via TVKO-VKORG => BUKRS => T001-LAND1.

Regards!