Spend Management Blogs by Members
Check out community member blog posts about spend management and SAP Ariba, SAP Fieldglass, and SAP Concur solutions. Post or comment about your experiences.
Showing results for 
Search instead for 
Did you mean: 

Integration of Item Level Withholding Taxes of Ariba Invoice with SAP S4 HANA

When working on integration of Ariba B&I with SAP S4 HANA, in many of the cases customer and consultants face challenges when integrating withholding taxes with SAP. Ariba supports withholding taxes at header as well as at item level in Invoices, whereas SAP ERP design is such that it supports withholding taxes at Invoice Header only.

It is interesting to check why customers insists on having withholding taxes at item level in Ariba, there are many reasons to it, but main reason according to me is, if WHT is at line level, customers can leverage upon TaxCodeLookup.csv to automatically determine the applicable withholding taxes. Also, another reason is, it enables adding the withholding tax only to the specific goods or services that are subjected to withholding taxes there by avoiding any need to calculate base and tax amount manually unlike header level.

CIG supports integration of withholding taxes out of the box if added at header level. Withholding taxes added at line-item level requires custom mapping in CIG and enhancement in SAP ERP to accommodate the additional WHT data sent by CIG. In this blog we'll discuss the custom approach of integrating line level withholding taxes from Ariba to header level at SAP.

Overview of the solution:

Solution involves custom mapping in CIG to transform item level withholding tax information received from Ariba to header level withholding tax information to be sent to SAP ERP.

First and foremost, step in performing any custom mapping is to understand and analyze, pre-processing and processed payloads of different use cases. Once payloads are analyzed identify source and target conditions to ensure the mapping works for all the possible or required scenarios. After finalizing the design perform the custom mapping in CIG and test the mapping, after successful testing deploy it for all the required system IDs, this completes the mapping part from CIG.

Next step is to Implement an enhancement in SAP ERP to update Invoice Amount, WHT Data in case of repeating combinations and to delete blank lines.

With these steps we can achieve seamless integration of systems with transformation of line level withholding taxes from source structure to header level in target structure.


Detailed Solution:

Step 1: Creating Mapping in CIG.

Withholding Tax Data will be available in path mentioned below (Source Structure)

PaymentExportRequest -> Payment_PaymentTaxExport_Item -> item -> InvoiceReconciliation -> TaxDistributionVector -> item

Withholding Tax Data must be mapped to the path mentioned below (Target Structure)


Before mapping any fields, create a duplicate node for item available in WITHTAXDATA.

Creating Duplicate Node for ItemCreating Duplicate Node for Item



Once created it should be visible as shown below. Perform all the mapping in item #2.

Duplicate Item Node in structureDuplicate Item Node in structure

 First map the withholding tax type.

TaxType is available in PaymentExportRequest -> Payment_PaymentTaxExport_Item -> item -> InvoiceReconciliation -> TaxDistributionVector -> item -> TaxType -> UniqueName field. Draw a line connecting UniqueName with WI_TAX_TYPE as shown below.

Tax Type MappingTax Type Mapping

Now add a position variable on repeating nodes and define source conditions to ensure the mapping works only if data is relevant for WHT. I have used debit credit indicator and negative tax amount as source conditions. Incase if additional taxes with negative tax amount other than WHT exists, source condition needs to be updated accordingly.

Conditions on Tax Type MappingConditions on Tax Type Mapping

 Similarly perform mapping for Tax Code, Base Amount and Tax Amount.

Mapping Tax Code, Base Amount and Tax AmountMapping Tax Code, Base Amount and Tax Amount

Make sure to add format number function to restrict the length of decimal places to 4 when mapping taxable amount and tax amount, reason being, Ariba supports up to 5 decimal places in these fields, whereas SAP ERP supports only 4. Hence format number function is required in mapping to avoid serialization error in SAP.

Ariba Field SpecificationAriba Field Specification

SAP Fields SpecificationSAP Fields Specification

Add a constant to SPLIT_KEY  = “000001”. Specifying the source condition same as other mappings to ensure, constant value is passed only if applicable.

For repeating node, “For Each” functionality can be used.

Save the mapping and test it.

Test Result Screen for MappingTest Result Screen for Mapping

 This completes the mapping from CIG Side.


Step 2: Implementing an enhancement in SAP.

It is important to know why an enhancement is required in SAP!

Whenever withholding taxes are added in Ariba, Ariba subtracts withholding tax amount from gross amount of the invoice, whereas in SAP Total invoice amount should consider withholding tax amount as well, which will later be posted to separate GL mapped to WHT. When withholding taxes are added at header level in Ariba, standard mapping adds Invoice Amount and WHT Amount and passes the gross amount to SAP.

Standard Mapping Details for Gross AmountStandard Mapping Details for Gross Amount

In case, where WHT are added at line level, IsHeaderLevelLine won’t be equal to “TRUE” hence WHT is not added to Gross Amount. This requires XSLT mapping, to avoid XSLT mapping, alternative option is to perform enhancement in SAP.

Also, the blank lines are created in structure WITHTAX data where our preconditions are not met for mapping, hence enhancement is required to delete the lines from “BAPIWITHTAXDATA where WI_TAX_CODE is initial”.

It is possible that Invoice with multiple lines may have same tax type and code on more than one line, so enhancement is required to sum up Taxable Amount and Tax Amount to keep only 1 line for each tax code and tax type, deleting duplicate lines from invoice to any avoid error related to duplicate entries for same tax type.

The enhancement can be added in BAdI “ARBCIG_INVCREATE” in method “IF_ARBCIG_EX_INVOICE_CREATE~INVOICE_CREATE”, for PO Based Invoices. For FI Invoices, enhancement can be added in BAdI “BADI MRM_WT_SPLIT_UPDATE” or in include “ZXACCU15” as applicable.

This completes the enhancement in SAP side which will allow us to post PO and Non-PO Invoices in SAP with Integration of Withholding Taxes from Item Level (Ariba) to Header Level (SAP).


Ariba Invoice Non-PO Invoice

Snapshot of Ariba Invoice with WHT at line levelSnapshot of Ariba Invoice with WHT at line level

 Non-PO Invoice posted in SAP through CIG.

Snapshot from SAP showing Accounting Entries generatedSnapshot from SAP showing Accounting Entries generated


Based on the discussion from the previous sections of the blog, we can conclude below points,

  1. SAP Ariba supports Withholding Taxes at Header Level as well as at Item Level.
  2. CIG Supports Integration of Header Level Withholding Taxes out of the box, where as Item Level Withholding Taxes through Custom Mapping.
  3. Custom Mapping can be added as per the requirement, specifying vide range of source and target conditions as required/ applicable.
  4. Enhancement in SAP is must to update the data to make it free from errors, and to ensure successful posting of Invoice in SAP.
Product and Topic Expert
Product and Topic Expert
0 Kudos

Another gem from KPMG Team! Thank you @Shreyas_RM 

Product and Topic Expert
Product and Topic Expert

Thanks @Shreyas_RM. Have added reference of your Blog Post to this one. Hope it helps more people.
Invoicing in SAP Ariba

Product and Topic Expert
Product and Topic Expert

Really awesome stuff here!