
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.
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.
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)
ARBCIG_BAPI_INVOICE_CREATE -> WITHTAXDATA -> item.
Before mapping any fields, create a duplicate node for item available in WITHTAXDATA.
Creating Duplicate Node for Item
Once created it should be visible as shown below. Perform all the mapping in item #2.
Duplicate 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 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 Mapping
Similarly perform mapping for Tax Code, Base Amount and Tax Amount.
Mapping 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 Specification
SAP 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 Mapping
This completes the mapping from CIG Side.
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 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”, only if PO Based Invoices are to be considered. For FI Invoices, implicit enhancement can be added in FM "ARBCIG_BAPI_INVOICE_CREATE". which will work for PO and Non-PO Invoices both
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 Non-PO Invoice
Snapshot of Ariba Invoice with WHT at line level
Non-PO Invoice posted in SAP through CIG.
Snapshot from SAP showing Accounting Entries generated
Based on the discussion from the previous sections of the blog, we can conclude below points,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.