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 - Tax Classifications Details

pintoo_d
Participant
0 Likes
6,176

Hi Experts,

When we create material using "MM01", say we are choosing Basic Data 1 and Sales : Sales Org Data 1 Views. After entering details like Plant, sales organization and Dist channel and enter to create material details.

When u go to Sales : Sales Org 1 section, down under u can see Tax Data.

Here most of details are populated like Country, Key, Tax category, tax info. Only taxkm needs to be selected. Which is either 1 or 0.

Now same case, i am doing using BAPI_MATERIAL_SAVEDATA.

I need to create materials and also tax class.

I am passing taxkm = 1. However when i execute that BAPI, it says Tax category is missing.

If u see using MM01, Those details are populated automatically.

So i am unable to draw any links between this. Checked if Those details are populated automatically from MARC or MARD or MARA or MVKE tables, but no links.

Can anyone suggest me on that please as how can i use BAPI_MATERIAL_SAVEDATA to update Tax classification with TAXKM value 1 for all materials created.

Thank You,

6 REPLIES 6
Read only

pintoo_d
Participant
0 Likes
3,282

Adding to my above Question. can anyone say where are the details like country, tax, tax category populating in MM01 when creating materials ?? so that i can myself check and pass values in BAPI.

This is what i got sume link on this ... country tax category may b based on Countries assigned via plants to controlling area of sales orgnization. and tax category assigned to that country.

But still looks like incomplete information to me. Anyone please help me @ earliest.

Thanks again

Edited by: Pintoo D on Jan 13, 2009 7:58 AM

Read only

pintoo_d
Participant
0 Likes
3,282

found resolution myself.

1. Fetch country key using Plant

2. Same country key pass to TSTL table and fetch Tax Type.

3. pass Country key and Tax Type to Tax Classification table along with Tax value.

It will Fix issue.

Read only

Former Member
0 Likes
3,282

Can you provide sample code?

Read only

dave_price
Participant
3,282

The FM STEUERTAB IDENTIFY will return the country and category for the required tax classifications. I used it in my BAPI_MATERIAL_SAVEDATA calling program.

CALL FUNCTION 'STEUERTAB_IDENTIFY'
     EXPORTING
*     KZRFB                       = ' '
       VKORG                       = im_material_create-SALES_ORG
       BUKRS_VKORG                 = im_material_create-SALES_ORG
       VTWEG                       = im_material_create-DISTR_CHAN
     TABLES
       STEUERTAB                   = lt_STEUERTAB
*   EXCEPTIONS
*     WRONG_CALL                  = 1
*     VKORG_BUKRS_NOT_FOUND       = 2
*     STEUERTAB_EMPTY             = 3
*     OTHERS                      = 4
             .
   IF SY-SUBRC <> 0.
* Implement suitable error handling here
   ENDIF.

LOOP AT lt_STEUERTAB into ls_STEUERTAB.
   move ls_STEUERTAB-ALAND to ls_TAXCLASSIFICATIONS-DEPCOUNTRY.
   move ls_STEUERTAB-TATYP to ls_TAXCLASSIFICATIONS-TAX_TYPE_1.
   move '1' to ls_TAXCLASSIFICATIONS-TAXCLASS_1.
   append ls_TAXCLASSIFICATIONS to lt_TAXCLASSIFICATIONS.
ENDLOOP.

Read only

0 Likes
3,282

Hi Pintoo D,

Which parameter in "BAPI_MATERIAL_SAVEDATA" , I have to pass the tax details ?

I am unable to find the parameter, Where I need to pass the Country, Tax Catagory and Value combination ?

Please help !!

Read only

3,282

You use the below code

**data declaration

LS_STEUERTAB TYPE MG03STEUER, ", "
LT_STEUERTAB TYPE STANDARD TABLE OF MG03STEUER, ",STEU_UEB, "STEUMM, "STEU_TMP,"

LT_TAXCLASSIFICATIONS TYPE STANDARD TABLE OF BAPI_MLAN, "STEU_UEB," BAPI_MLAN,
LS_TAXCLASSIFICATIONS TYPE BAPI_MLAN. "STEU_UEB, "BAPI_MLAN,

**code

CALL FUNCTION 'STEUERTAB_IDENTIFY'
EXPORTING
KZRFB = 'X'
VKORG = LS_FINAL-VKORG
BUKRS_VKORG = '2000' "lS_FINAL-bukrs "BUKRS_VKORG
VTWEG = LS_FINAL-VTWEG
TABLES
STEUERTAB = LT_STEUERTAB.

LOOP AT LT_STEUERTAB INTO LS_STEUERTAB." WHERE MATNR = LV_NEW_MAT.
MOVE LS_STEUERTAB-ALAND TO LS_TAXCLASSIFICATIONS-DEPCOUNTRY.
MOVE LS_STEUERTAB-TATYP TO LS_TAXCLASSIFICATIONS-TAX_TYPE_1.
MOVE '0' TO LS_TAXCLASSIFICATIONS-TAXCLASS_1.
APPEND LS_TAXCLASSIFICATIONS TO LT_TAXCLASSIFICATIONS.
ENDLOOP.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
HEADDATA = LS_HEADDATA
CLIENTDATA = LS_CLIENTDATA
CLIENTDATAX = LS_CLIENTDATAX
PLANTDATA = LS_PLANTDATA
PLANTDATAX = LS_PLANTDATAX

STORAGELOCATIONDATA = LS_STORAGELOCATIONDATA

STORAGELOCATIONDATAX = LS_STORAGELOCATIONDATAX
SALESDATA = LS_SALESDATA
SALESDATAX = LS_SALESDATAX

TABLES
MATERIALDESCRIPTION = LT_MATERIALDESCRIPTION

TAXCLASSIFICATIONS = LT_TAXCLASSIFICATIONS
RETURNMESSAGES = LT_RETURNMESSAGES

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
IMPORTING
RETURN = RET.

** Surely it will work .. I tried and working fine