Integrating VIES VAT Validation with SAP S4 HANA

In this article, we will look into VAT registration numbers for business entities in the European single market. Then we will learn about the APIs provided by the EU commission (VIES services) to facilitate VAT number validation of business partners, and how businesses can use this service when creating vendors, customers, and other business partners in SAP S4 HANA.

Next, we will compare the different ways of automating the VIES VAT validation when business partners are created in SAP S4 HANA. Finally, we will dive deep into the technical details of Cloud Platform Integration (CPI) and S4 HANA when it comes to automating the VIES service.

European Single Market

European Single Market is a trade agreement between 27 EU member countries, Iceland, Liechtenstein, Norway, and Switzerland to make the movement of people, services, and goods between these countries as free as possible. The usual tariffs levied when goods are moved between countries are not applied. Also, border control is eased for the free movement of people.

“Border controls have been replaced by more extensive reporting for deliveries made to companies in other countries of the EU. Vendors have to report these deliveries/goods movements to their own tax authorities in an EC sales list. The delivery itself is tax-exempt with tax being levied in the country of destination. Import tax has been replaced by acquisition tax” – SAP Single Market

VAT Registration Number

“To enable the authorities to check that the single market law is applied correctly, every company that has to pay tax on acquisition within the Union is assigned a VAT registration number (VAT This number must be specified on invoices, and vendors must enter both their own VAT registration number and their customers’ registration number in the sales lists for the tax authorities.” – SAP Single Market

Every company that is entitled to deduct input tax should be registered under tax authorities with a unique VAT registration number.

The VAT registration number is a 15 character long alphanumeric number. The first two characters of the VAT registration number denote the country of the member state. For example, IT for Italy and ES for Spain.

In SAP, you can define VAT numbers for vendors, customers, and company codes.

VIES Validation Services

When creating business entities such as vendors or customers, businesses should validate the VAT numbers with the EU’s official VIES service website.

Business users can access the VAT number validation service using the URL,

You can fill out the form with the business partner’s country and VAT registration number to find out if the VAT number is valid or not.

VIES VAT number validation portal home page with input parameters
VIES VAT Number validation portal
VIES VAT number results page with positive result, "Yes, valid VAT number" and the detail of the business party
VAT Number validation results page

Automating VIES VAT Number Validation in SAP S4 HANA

Manually validating the VAT number of each and every entity created in SAP is a cumbersome process. Therefore, we will look at what kind of tools SAP has provided to automate the VAT validation process and how to implement VAT validation for Business Partners in SAP.

There are two ways to automate VAT validation in SAP for Business Partners,

  1. Custom ABAP program with Proxy call to VIES API
  2. Enable CPI archive for VIES VAT validation

Method 1 – Custom ABAP Program with Proxy Call

This method is suitable if your organization does not have the license to use the SAP Cloud Integration Platform (CPI). The idea is to create a proxy class that can invoke the VAT validation VIES service and displays the results back to the user. The proxy method can be reused in either a user-exist, BADI, or a custom program based on your business process. For example, you invoke the proxy class via a user-exit or BADI at the point of Business Partner creation, then display a message with the result of the check.

Create a Proxy class/method in SAP by importing the WSDL of VIES VAT validation service. You can download the WSDL on EU VIES technical info page and use transaction se80 to import the WSDL as a proxy.

Technical information page of the VIES VAT validation portal. WSDL
Technical info page of VIES

Now reuse the proxy class/method created in an enhancement point or a custom application. You can read more about how to implement custom ABAP code here.

If you’d like to learn more about how to implement proxy interfaces, check out the following guides,

Method 2 – VIES VAT Validation via Cloud Platform Integration (CPI)

If your organization has a CPI license, this is the best option for automating the VAT validation for business partners.

With CPI, SAP has provided a prepackaged integration solution to integrate VIES service with SAP S4 HANA. These pre-built integration solutions are called out-of-the-box integration scenarios in the Integration Suite. To look for pre-built integrations scenarios, go to SAP API Business Hub and use the search option. To look for VAT validation integration scenario, search for “VIES” and you will find the complete iFlow.

SAP integration suite and API business hub home page.
SAP API Business Hub home page
out of the box integration flow provided by SAP for VIES VAT number validation through CPI is displayed in the results.
Pre-built VIES VAT Number Validation iFlow
Complete iFlow of the out of the box integration flow to automate VIES VAT validation via CPI
VIES VAT Number Validation Service Integration Flow

You can reuse this integration flow in your tenant and configure the endpoints of sender and receiver to build the end-to-end integration flow.

To connect the SAP S4 HANA system, you will need to create an RFC destination and configure the endpoint of the sender in the iFlow. The name of this RFC destination should be maintained in a VIES customization view (configuration) on the SAP S4 side. We will look into the SAP ERP configuration needed in the following chapter.

Overview of VAT Number Validation Functionality in SAP S4 HANA

Now let us look at how the VAT number validation functionality works in SAP back end.

VAT Number validation is available in the following spots in SAP S4 HANA,

  • Business partner transaction BP
  • Multiple partner validation report – OVF_MASS_CHECK
  • Sales and billing document processing

You can also use the report OVF_HISTORY to check the history of online checks. Here you will find a list of online calls made to the VIES service for various partners at different times.

Once the VAT validation is automated, OVF_MASS_CHECK report showing the results of the check for multiple business partners.
Results of online calls in report OVF_HISTORY

By clicking on the “Display” option, you can find the result of the validation and the response from VIES service.

The XML results of the VIES VAT check. The results with country code, vat number, weather the VAT number is valid or not shown here.
Result of the validation

In transaction BP, the result of the validation whether the VAT number is valid or not will be displayed as information or an error message. If the VAT number is invalid, an error message will be shown and users need to correct the VAT number before they can create the business partner.

VIES VAT Validation Customizing in SAP

To enable the automated validation, activate the service using transaction V_OVF_VALIDITY. Here you not only enable the automatic validation at the company code level, but also define how long validated entries should remain in the buffer.

A data buffer is defined to optimize the performance. When an online call is being made to the VIES service, data is buffered in SAP back-end system and CPI for later use. The expiration date of the buffer is defined in column “validity of check results” in transaction V_OVF_VALIDITY. In this example, the validity period is 7 days.

Customization in SAP S4 HANA for VIES VAT automation. View V_OVF_VALIDITY. Activate validation at company code level
V_OVF_VALIDITY customization

During the buffered period, the VAT check results are fetched directly from SAP or CPIs data buffer without calling the VIES web service.

To activate the check for transaction BP, go to the transaction BUS3 and enable the validation for BUP520 (Identification Numbers).

Activate for VAT validation for BP
BUS3 customization

Other customization views:

View nameDescriptionPurpose
V_OVF_CHECKACTIVActivate ChecksDefine the RFC destination
V_OVF_CHECKIDDefine Check IDsDefine the check ID “VIES”
V_OVF_CHKRSLTDefine Check Results for Check IDDefine the results set
VIES VAT validation customization in SAP S4 HANA

However, with the new upgrade and OSS notes, SAP has consolidated the customizations into one portal. The transaction to the new VIES customization dashboard is OVF_CHECKS. Within this transaction, you can maintain all relevant customizing data and access all different customization views under one location.

For further information on the customization refer to SAP note 2866929.

To summarize, we discussed the concept of the European single market and why every business entity requires a VAT number. Then we looked at the VAT number validation service VIES provided by the EU commission and how businesses can use this service when creating new business partners in SAP. Next, we deep-dived into how to automate the VAT number validation in SAP S4 HANA: via a custom proxy and via CPI. We learned about the out-of-the-box integration scenarios provided by SAP with CPI for VAT validation. Finally, we went into more detail about the customization on the SAP side to enable the automation.

If you have any questions about VIES VAT number check automation, please leave a comment below.

Leave a Reply

Your email address will not be published. Required fields are marked *