FI/MM: Customized Withholding Tax Base
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:
- Withholding Tax Types and Codes should be configured
- 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:
- I_RBKPV – Invoice Document Header
- TI_DRSEG – Invoice Document Item
- TE_RBWS – Withholding Tax
- TE_RBVS – Supplier Split
- E_QSSKZ – Withholding tax 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:
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.
Very useful information, thanks dear Anss for sharing sample code and step by step guide.
By reading this I get basic Idea about ABAP, thanks for your time& effort.
Excellent Document... Nicely explained... Great Work.
Can you please explain the steps what you are trying to do in MIRO transaction to trigger the BADI?
We have some requirement similar to what you posted that we are providing the PO number and when we are clicking on the withholding tax tab the BADI MRM_WT_SPLIT_UPDATE is getting triggered and the standard implementation is triggered and we are trying to change the values in debugging mode for Te_rbws-qsshb but the same tax amount is not getting reflected in the withholding tax amount.
Can you please share your experience with this BADI implementation. Did you do implicit enhancement inside the standard badi implementation or you deactivated the standard implementation and created custom implementation for this requirement?
You will have to create a new implementation: