Skip to Content
Author's profile photo Former Member

Automatic VAT Validation For EU

Introduction: VAT registration as SAP defines it is: “As part of the process of establishing the European Single Market, the tax authorities in each EU member state assign VAT registration numbers to companies. All companies that are entitled to deduct input tax can receive a VAT registration number.

A VAT registration number is alphanumeric and consists of up to 15 characters. The first two letters indicate the respective member state, for example DE for Germany or ES for Spain.

The VAT registration number is designed to specify the tax processing involved in certain transactions and to allow the financial authorities to monitor the application of the new regulation.

For this reason, the VAT registration number of the company code and that of the customer must be specified on invoices for tax-exempt deliveries and other goods and services within the European Union. The VAT registration number is thus part of the control procedure that has replaced the former border controls (EC sales list).

You can define VAT registration numbers in the system for every customer, company code, and vendor.”

(Ref: https://help.sap.com/saphelp_erp60_sp/helpdata/en/f6/e8d1538cdf4608e10000000a174cb4/content.htm)

In SAP  for customer ,vendor, company master data VAT registration number plays a very important role. Hence its accuracy matter for a successful business process. Normally business user or master data team physically validate this VAT registration number from  EU’s official VIES  website [http://ec.europa.eu/taxation_customs/vies/vieshome.do]

 

 

This manual VAT registration number validation process can be automated and reduce the physical involvement of business user to verify the VAT registration number from  EU’s official VIES website . Some time its really cumbersome exercise for  them  when they need to validate for high volume of data uploaded from interface.

Technically this validation process can be automated directly with an interface  from SAP to European Commission’s VIES application.

 

In SAP its possible to build an ABAP application consuming the SOAP services offered by European Commission’s VIES  website.

 

Business Benefits:

  • Accurate VAT registration number for customer, vendor
  • Quality master data
  • Error free business transaction
  • No manual effort required for validation
  • No human error

To automate this VAT registration number validation process  we need to develop proxy based interface. This proxy interface will consume the  SOAP services officered by European Commission VIES website.  The required WSDL file to generate the proxy can be obtained form the below URL:

http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl

 

This proxy method can be invoked in several ABAP application like : Customer Exit for individual validation , Report  for mass validation.

STEP-BY-STEP  Process:

How to create ABAP proxy for VAT registration number validation?

Step 1: Go to SE80 provide your package.

Note: For POC purpose we have used local package ($tmp). In project appropriate package to be selected.

Step 2: Select ‘Service Consumer’ and click on Cont.

Step 3: Here we are using a WSDL file available in European Commission website. Select third radio button and click on Cont.

Step 4: Select 1st radio button and click on Cont.

Step 5: Specify the WSDL file created from the URL provided European Commission website.

Step 6: Specify the package and prefix. Prefix is just identifier for the ABAP objects created through wizard. Click on Cont.

 

Step 7: Now we can see proxy class is generated.

 

Step 8: Activate all the generated objects.

Step 9: We can see following two methods ‘checkVat’ and ‘checkVatApprox’ created for the proxy class.

Now we should be able to use these methods in our custom application for validating VAT registration number.

 

How to create logical port for validating VAT registration number?

Step 1: Go to transaction ‘SOAMANAGER’.

Step 2: Select 4th option ‘Web Service Configuration’

Step 3: Enter object name ‘checkVatPortType’. Created at the time of proxy generation.

Step 4: Click on option ‘Create’ and select WSDL Based Configuration

Step 5: Enter logical port name and description.

Step 6: Select 2nd radio button via file. Upload the WSDL file created from the URL provided in European Commission website.

 

 

Step 7: Now binding get created. Click on next.

Step 8:  No user name and password required here. Click on next.

 

Step 9: Following data automatically gets populated from WSDL file. Click on next.

Step 10: Click on next.

Step 11: Click on next.

 

Step 12: Click on next.

 

Step 13: Now you can see the logical port is created.

Step 14: Select ping function and you can see communication is successful and connection established with European Commission website.

 

Demo Application:

 

Below is an example of simple application of custom report which validate customer Vat registration number.

We can provide the list of customer for which vat registration number to be validated.

 

Sample Code:

 

DATA(gv_proxy ) = ‘ZVATVALCHK’. “ Logical port name
TRY.
DATA(lo_vat_chk) =
NEW zvtco_check_vat_port_type( logical_port_name = gv_proxy ).

 

***We can use the proxy method ‘check_vat‘ to validate the VAT number.

 

******* Checks the PROXY output
TRY.
lo_vat_chk->check_vat(
EXPORTING
check_vat_request = VALUE zvtcheck_vat_request(
country_code = <lfs_data>-stceg(2)
vat_number = <lfs_data>-stceg+2
)
IMPORTING
check_vat_response = DATA(ls_response)
).

CATCH cx_ai_system_fault INTO DATA(lo_exc_syst_fault).
” Internal Error
<lfs_data>-statu = text-008.
” VAT not maintained in Customer Master
<lfs_data>-icon = icon_yellow_light.

ENDTRY.
ENDLOOP.

CATCH cx_ai_system_fault.
MESSAGE e000(ckmlwip) INTO DATA(lv_error_msg) ##NEEDED.
” Internal Error. Contact your System administrators!
RAISE EXCEPTION TYPE lcx_exception
EXPORTING
textid = VALUE scx_t100key(
msgid = sy-msgid
msgno = sy-msgno
).
ENDTRY.

 

References:

https://help.sap.com/saphelp_di46c2/helpdata/EN/e5/07800a4acd11d182b90000e829fbfe/content.htm

http://ec.europa.eu/taxation_customs/vies/faq.html#item_16

http://ec.europa.eu/taxation_customs/vies/faq.html

http://ec.europa.eu/taxation_customs/vies/vatRequest.html

Assigned Tags

      13 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Jürgen L
      Jürgen L

      Now you know that the VAT number is a valid one, but do you know that this VAT number is with the correct business partner? Any validation of the name and address?

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Yes, this application provide the registered company name and address against VAT number. But for extensive check and quality there are some third party tool available like Trillium which can also be integrated with SAP.

      Author's profile photo Roland Grossrieder
      Roland Grossrieder

      Hi,

      Thank you for this great post. I have tried to follow your instructions but when I try to import the wdsl file I'm getting an error

       

      Thank you for any help.

      Best regards,

      Roland

      Author's profile photo Vincenzo Sacco
      Vincenzo Sacco

      Hello Roland,
      download the file WSDL from link, delete all rows of tag <xsd:documentation> and create the service using this file.

      Best Regards

      Vincenzo

      Author's profile photo sunil das
      sunil das

      Hi,

      Thanks for the nice blog.

      But while ping the web service, I am getting errors. Please let me know how to solve this.

      "SRT Framework exception: Service Ping ERROR: Error when calling SOAP Runtime functions: SRT: Processing error in Internet Communication Framework: ("Direct connect to ec.europa.eu:80 failed: NIEHOST_UNKNOWN(-2)")"

       

      Author's profile photo Huub Hellings
      Huub Hellings

      Make sure that the host (ec.europa.eu) is known by your SAP ‘machine’ via DNS or local /etc/hosts file  check for instance with: telnet ec.europa.eu 80

      Author's profile photo Former Member
      Former Member

      Hi Huub,

       

      Is it possible to create entry in SM59 to recognize external domain in SAP instead of updating this local file?

       

      Thanks,

      Chetan

      Author's profile photo Meriadec MICHEL
      Meriadec MICHEL

      You can also follow the following note:

      https://launchpad.support.sap.com/#/notes/2855240

      It's not yet available but should be very soon.

      Author's profile photo Banalata Pattanayak
      Banalata Pattanayak

      Nice blog.

      Author's profile photo Andrea Borgia
      Andrea Borgia

      In case anyone is interested, I have extended the demo code to include all test codes and use both the test and the real service.

      Misc info included in the comments, which also link back to this blog post for reference.

      Author's profile photo Eric Dupuis
      Eric Dupuis

      Hello,

       

      When activating your code I get the error "Type ZVIESCHECK_VAT_REQUEST is unknown.

      Can you provide the type description?

       

      Thank you

      Eric

       

      Author's profile photo Andrea Borgia
      Andrea Borgia

      It is autogenerated from the WSDL, as described in the blog above.

      Author's profile photo Roland von Allmen
      Roland von Allmen

      Hey guys

      iam followed this great instruction and greated the webservice.

      The connection is working fine but i have a problem with the receiving date format.

      I received the following error in soamanager.

      Webservice%20Error

      You have this problem not when you follow the step by step instruction?

      How can i solve this problem? I worked with the orginal WSDL file from VIES site,

      They send me the date format: 2021-12-02_+01:00 but in SAP we need yyyy-mm-dd

       

      Thanks for help.

      Roland