How configure and use external Tax Engine calculation in S/4HANA Cloud
The Tax Engine concept
For many years, most of SAP clients have implemented J1BTAX solution to support the Tax calculation in Brasil in the SAP ECC or S/4HANA On premise world. This solution is used for tax calculation for sales process or in the procurement (supplier invoices) process.
This is not so easy to maintain the J1BTAX functionality, for each possible tax scenario available in Brasil that could vary depending of service or material, delivered location, tax benefits for some region or kind of industry, use of goods (production or consume) and etc.
This kind of process require a consultant with a good knowledge about Tax scenarios and how configure it in the J1BTAX for Sales or Procurement. Many companies with very complex tax scenarios, needs to contract consultants or maintain internal IT resources to support tax legislation changes or give conditions to the business prospect new markets, products or services.
This scenario cause a high TCO or slow response time to market, impacting the business area to accomplish their targets, many times losing business opportunities.
In the S/4HANA Cloud Public Edition, SAP decided to let these tax calculation with third parties companies, specialized in the tax scenario, with Brasil tax knowledge and Tax solution to attend the diverse scenarios with flexibility and quickly. Beside Brasil, some countries like US, also use this Tax Engine process instead of tax code configuration for each scenarios.
To call these Tax Calculation Engine Partners, in the pricing procedure, a specific price condition called “TXSC” is configured. This condition indicate to the System that the Tax calculation will be executed externally. Beside this pricing condition, S/4HANA Cloud needed to be integrated with third Tax Engine providers through Integration Suite in the BTP (Business Technology Platform). More information, also you could see in this blog, wrote by Lizandro Martins or in this another blog wrote by Lucas Baldo.
In the Central Business Configuration (CBC) or “Manage Your Solution”, in the SSCUI 105368, you need to activate Business feature for External Tax Calculation :
Also, in the SSCUI 104807, you need to inform which Pricing Procedure will be used to the External Tax Calculation :
The Scope Item 43D and the BTP components needed:
First of all, the Scope Item 43D need to be included in Digital Discovery Assessment (DDA) tool, during the Discovery phase in the Activate methodology. This information will be used by SAP Sales and Presales team, to qualify the Client opportunity and necessary solution involved in the S/4HANA Cloud offer to the Client.
In terms of the technical configuration, an Integration Suite should be licensed to call the Tax Engine third party. The version of Integration Suite will depend of quantities of documents that will be handled and the functionalities used by the Tax Engine providers in the Integration Flow. Mainly for error handling (example : use of JMS adapter to handle error handling could imply in Integration Suite Standard version). Consult the Third Party Tax Engine provider.
In the S/4HANA Cloud tenant, an communication arrangement SAP_COM_0249 should be configured to use the Tax Engine. We will explain it in this Blog.
The Integration Suite setup in the BTP:
The first Step, you need to include the Integration Suite service available in your BTP tenant. To do that, go to your BTP Cockpit, create or use a Sub account that already exist and include the Integration Suite service.
In your Subaccount, go to the Entitlements, configure Entitlements and Add Service Plan:
In the Service Plan, you need to add two components : Integration Suite and Process Integration Runtime.
If these components is not in the list of the Service Plan available, certified if Integration suite was contracted and if the region used to create this subaccount support this component.
Next step is create an Instance of the Services in your BTP Cockpit. To do that go to the Service Marketplace, choose the both services, Integration Suite and Process Integration, and click in the Create option on each Service:
When you do that, you will have the instances created. Notice that for the Process integration, we have created two instances : the Process Integration Runtime for the integration-flow and the Process Integration Runtime for the API. The first one is used to consume the i-Flow that you will use to call the Tax Engine Third Party from S/4HANA Cloud. The second one, you can use if you want to test or call the i-Flow using some tools such as Postman.
Note that the Integration Suite that we are using in the above example is Basic Edition. To see which version you need to use, contact your Tax Engine provider.
After the Service creation, we need to create a service key for the Process Integration Runtime Integration flow. This Service Key will be used in the Communication Arrangement 0249 in the S/4HANA Cloud. The authentication method that you will use in this Communication Arrangement will be Oauth 2.0 and this service key will be used as credentials.
Note that is necessary to create a Space for the Process Integration Runtime.
Once time this step is done, you can proceed with the Integration suite configuration.
The Integration Suite and iFlow configuration
For the next Step, you need to open the Integration Suite application doing a double-click on the Application name or click in the arrow icon on the right. A new browser screen will be opened:
As the first step in the Integration Suite, you need to add Integration Capabilities using the function “Manage Capabilities”. In the next screen, click in “Add Capabilities” and activate it:
When this process is finished, you will have the Integration Suite provisioned and ready to use.
Next Step is to discover integration flow for the External Tax Engine. Go to the Discover Integrations in the left menu:
Search for “External Tax “. As the result of this search, you will get the Integration Package called “SAP S/4HANA Integration with External Tax Calculation Engine”:
This is a Standard SAP Package for External Tax Engine calculation. Some Tax Engine Partners has their own Integration Package that could be loaded in the Integration suite using the “Import” tool in the Design Menu option.
For this Standard SAP Integration Package, create a copy of it :
Go to Design menu option on the left Menu and edit the Integration Packaged copied from the Standard:
Next, go to the Artifacts, Action and Configure it :
In the next screen, you will have the Sender and Receiver. The Sender, is not necessary to change anything.
In the Receiver, you need to inform in the Address, the URL for the API supplied by the Tax Engine provider. Talk with your Tax Engine provider to get this information.
After that, you need to “Deploy” this integration :
Once this Integration Flow is deployed, go to the Monitor Artifacts on the left Menu and click on the Integration Content to see status :
As soon as the status of this Integration flow is configured as “Started” , if check the “Endpoints” you will see the URL that you need to inform in the S/4HANA Cloud in the Communication Arrangements. Copy this URL to use it in the S/4HANA Cloud communication configuration:
To allow S/4HANA Cloud connect to the Integration Suite in BTP, the certificate of the BTP need to be registered in S/4HANA Cloud Trusted Certificates. Otherwise, the S/4HAHA Cloud will refused any communication from BTP.
Go to the main screen in the BTP Cockpit, and in the web browser, go to the Connection secure, Security and doucle-click in the Certificate to view the Certificate. Export it to register it in the S/4HANA Cloud :
In the S/4HANA Cloud, open the Fiori APP “Maintain Certificate Trust List” and “add” the BTP Cockpit certificate :
Don’t forget to export and import all the certificate tree from BTP in the Trusted Certificates in the S/4HANA Cloud.
Setup the Communication Scenario 0249 in the S/4HANA Cloud
Now, we need to setup the communication between S/4HANA Cloud and the Integration Suite in the BTP.
The first thing you need to do is create a communication system :
Note that the Host Name is the same url built in the Integration Suite when the integration flow was delivered (the Endpoint):
Also, in the Communication System, you need to inform the OAuth 2.0 as Authentication method and inform the credentials (Client ID anda Client Secret) :
This information you can get in the Service Key of the Instance of the Service Process Integration Flow:
The last step is create the Communication Arrangement :
In this communication arrangement, you will specify the Communication System created in the previous step, including the Oauth 2.0 Credentials. Also, you need to specify the Service URL of the Endpoint of the Integration flow (see the step above) and the Path. The Path, you have configured it when you specify it in the “Sender” tab of Artifact configuration in the Integration Suite (see field Address):
Finally, with necessary requirements installed and configured, you can create a Sales Order or Supplier Invoice in the System.
In the example bellow, we are creating a Sales Order for a Service call SM0001. For Brasil localization, we are not using SD tax code. Instead of it, we are using a new development done by SAP Localization team, a feature called Additional Fiscal Data (AFD). This is a functionality, allow us to inform to the Tax Engine Calculation partner, more conditions and information to them allowing they to derivate some specific fiscal scenarios. We will abord this functionality in the future in another Blog.
When we confirm this Additional Fiscal Data, the Third Party Tax Calculation Engine is called, returning some information such as CFOP (Brazilian code for the operation) and the tax rate and tax amount.
It is important to align with your Third Party Tax Engine Provider, which information will be sent to them, for example some business object data (Sales order info or Procurement info) or Additional Fiscal Data fields.
To summarize, these features : “External Tax Calculation” with advent of “Additional Fiscal Data”, they will increase the flexibility to support diverse tax scenarios in Brasil, also they will reduce the time and effort of the companies to attend the tax scenario modifications and allow them to enter in new markets and create new products faster than before.
I hope that this Blog could give you a vision of the External Tax Engine calculation for Brasil.
I would like to special thanks to my colleagues Ivan Mirisola, Felipe Gutieri and the all Brasil Localization team, that help me about the concepts and configuration scenarios.
Thank you and Grow with SAP.
Hi William Terceiro,
Very through information.
Hi William Terceiro, ,
Thanks for sharing the detailed step-by-step guide on external tax engine. i will sure include this blog to our partner who consider the external tax.
Thanks a lot for this really well written blog William Terceiro,
I would like to emphasize one thing about the AFD which many companies implementing S/4HANA Cloud Public misunderstand: the test scripts for BR localization mention the AFD data that needs to be used for every scenario however this is only for informative purposes (only samples!).
In reality, companies needs to map every fiscal scenario they have in Brazil (categorizing them by CFOP, origin, destination, etc.) and check which AFD data needs to be created in S4HC Public. This AFD data needs to be aligned with the tax calculation partner so they can understand each business scenario your company has and send back the correct taxes, etc. This is an additional layer that needs to be considered during the planning & configuration phase of the implementation project.
Para garantir que eu entendi corretamente, então toda essa parte de cálculo de impostos será feita fora do SAP, se comunicando com um terceiro. No entanto, em relação à parte da fatura eletrônica em si, que atualmente no México é chamada de "timbrado" da fatura, como vocês vão lidar com isso? Entendo que mencionas do Brasil e EUA, porem minha dúvida é principalmente em relação ao México. A SAP tambem ira recomendar terceiros para fornecer esse serviço ou cada empresa tem que desenvolver dentro do SAP BTP por sua propria conta?
Talvez possa esta saindo um pouco do contexto principal mas se poderia ajudar com essa pergunta seria de grande valor.