Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
3,516
Introduction

In most countries the calculation of tax base and tax amount cannot be achieved via standard configurations of the Withholding Tax Types and Withholding Tax Codes. In this blog I will try to explain how to use the Badi to calculate the Tax base via ABAP.

BADI Name: MRM_WT_SPLIT_UPDATE

The following are the transactions in which this BADI is called:

  1. MIRO

  2. MIR7

  3. MIRA


Pre-Requisites:

  1. Withholding Tax Types and Codes should be configured

  2. Withholding Tax Types and Codes should be assigned in the Business Partner


Limitation to Manual Tax Base and Tax Amount:

Activating this BADI means that you cannot manually enter the withholding tax base and amount.

Parameters which can be used:

  1. I_RBKPV - Invoice Document Header

  2. TI_DRSEG - Invoice Document Item

  3. TE_RBWS - Withholding Tax

  4. TE_RBVS - Supplier Split

  5. E_QSSKZ - Withholding tax code


Sample Code:

As an example, I am providing a sample code for understanding purpose only where I have used the concept of Maximum Base Amount for a particular tax code in a specific company code. However this can be different based on the requirements in your country / company code:
DATA: ZBASE_AMOUNT_DC   TYPE MRM_RBKPV-RMWWR.   "Base Amount in Document Currency
DATA: ZMAX_BASE_AMOUNT TYPE MRM_RBKPV-RMWWR. "Maximum Base Amount in Document Currency

IF I_RBKPV-BUKRS = '3000'.
LOOP AT TE_RBWS INTO DATA(LS_TE_RBWS)
WHERE WITHT = 'Z1' AND
WT_WITHCD = '01'.

ZMAX_BASE_AMOUNT = '2125000'.
ZBASE_AMOUNT_DC = I_RBKPV-RMWWR.

IF ZBASE_AMOUNT_DC GE ZMAX_BASE_AMOUNT.
LS_TE_RBWS_Z101-WT_QSSHB = ZMAX_BASE_AMOUNT.
ELSE.
LS_TE_RBWS_Z101-WT_QSSHB = ZBASE_AMOUNT_DC.
ENDIF.
MODIFY TE_RBWS FROM LS_TE_RBWS.
CLEAR: LS_TE_RBWS.
ENDLOOP.
ENDIF.

Can we use this BADI to calculate the Base Amount for dependent Tax Codes?

Yes one of the core essence of this BADI is that we can use this to calculate Inter-Dependent Tax Bases. For E.g.


In the above example, the second and the third tax bases are dependent upon the balance after the deductions of the previous codes. For understanding purpose, I am sharing another draft sample code:


Conclusion:

Although this BADI can be used for multiple other scenarios but I hope that in this blog I was able to explain on the subject matter. I used this BADI in one of my recent implementation and thought to share this with other colleagues and consultants.

If you find this useful, please do comment and hit likes.

Best Regards,

Anss Shahid
5 Comments
Labels in this area