Need help with filtering tax codes during invoice processing
I’m working on a requirement where we need to control which withholding tax codes appear during MIRO
processing. Currently when we process invoices for suppliers, all configured withholding tax codes from the vendor master are showing up.
Current situation:
- Vendor has multiple
EH
tax codes configured: 02, 05, 08, 09
- All codes appear in MIRO withholding tax tab
- Business wants to show only specific codes based on PO category
- For certain PO categories, only codes 02 and 05 should be visible
What I tried:
I attempted to use BAdIs MRM_WT_SPLIT_UPDATE
and MRM_HEADER_CHECK
but they don’t seem to affect the tax code display.
METHOD if_ex_mrm_wt_split_update~change_wt_split.
DATA: lv_bsart TYPE ebeln.
" Get PO type from header
SELECT SINGLE bsart FROM ekko
INTO lv_bsart
WHERE ebeln = iv_purchase_order.
" Filter tax codes based on PO type
IF lv_bsart = 'ZSER'.
DELETE ct_wt_data WHERE witht NOT IN ('02', '05').
ENDIF.
ENDMETHOD.
Question:
Is there a way to restrict the withholding tax codes that appear in MIRO based on the purchase order type? We’re running on S/4HANA system.
Any guidance would be appreciated!
Those BAdIs won’t work - they fire too late in the process. You need to catch the tax code population before it hits the screen. I’ve hit this exact issue before and got it working with enhancement spot MRM_UI_CUST
. You can use the BAdI MRM_UI_GENERAL
in there to control UI elements during invoice processing. The CHANGE_FIELD_PROPERTIES
method lets you dynamically change field visibility and available values. Another option is using substitution through OBBH. Create a substitution rule that checks the PO category and filters tax codes based on that. This runs during document creation so you get the filtering you need. Both ways require knowing the table structures - EKKO for PO data and T059Z for withholding tax configs. I’d probably go with substitution since it’s cleaner and doesn’t need custom ABAP.
I ran into the same issue a few months back. That BAdI you’re looking at isn’t great for this - MRM_WT_SPLIT_UPDATE
runs after the tax codes already show up on screen. Here’s what actually worked for me: I mixed config changes with some enhancement work. Start by checking if you can use the tax determination setup in SPRO (Financial Accounting > Tax on Sales/Purchases > Withholding Tax). You might be able to set up different tax procedures or tweak existing ones based on account assignment categories. If config doesn’t cut it, try BAdI MRM_PAYMENT_TERMS
or do a screen enhancement through SE80. I went with modifying the screen logic to hide specific tax code fields based on the PO category from EKKO table. Way better control over what users see during invoice entry instead of trying to filter stuff after it’s already there. The trick is catching the display logic before the screen loads, not messing with data afterward.