Tax Service – Extend the Integration of SAP S/4HANA (on premise) with Tax Service
The tax service integration uses standard data to calculate taxes in a business transaction. However, there are cases when you need more specific information to calculate your taxes. To enable the system to identify this data, you can extend the tax service integration by executing the following steps:
Finding the Extendable Interfaces
Find the interfaces where you can extend the tax service integration.
These interfaces implement the IF_TXS_CLASS_ENHANCEMENT interface. To see all the Comprehensive Interfaces available for enhancement, follow the steps below:
- Access transaction SE80
- Select Repository Browser.
- Select Class/Interface in the object category field.
- Enter IF_TXS_CLASS_ENHANCEMENT in the Object Name field.
- Expand the Comprehensive Interface interfaces.
- Read the interface documentation and determine the interface in which you need to extend the tax service integration.
Aligning with your SAP Partner for Tax Calculation
Align with your SAP Partner for tax service about this new information since it affects the tax calculation.
Note: When you create a new key/value pair, use a namespace where the key name starts with “cust_”. For example, cust_ownProduction.
Creating Your New Class
Create a new class and inherit the methods from the standard class you previously determined.
To execute this step, follow the instructions below:
- Access transaction SE24.
- Enter the name of your new class.
- Choose Create and Save.
- Go to the Properties tab.
- Choose the Superclass pushbutton.
- Enter the localization class that implements your determined interface.
- Choose Save.
- Implement a business logic according to your needs.
- Choose Activate.
Setting Your Class
- Go to Customizing for Integration with Other SAP Components, choose SAP Localization Hub, tax service Enhance Localization Interfaces for Tax Service.
- Set your own class to be executed in place of the tax service standard localization classes for a determined interface.
See an example of how to extend the integration of SAP S/4HANA with tax service:
Assume that John is the tax specialist of the company and needs the system to calculate taxes for the company’s purchases.
The company has some suppliers that resell or produce the goods interchangeably and this fact impacts the tax calculation for this purchase operation.
The tax service integration does not identify if the supplier produces these goods or resells them. To enable the system to identify this data, John asks the IT specialist, Donna, to take action.
Donna and John decide that they need to add a new field to the payload that identifies if the supplier resells or produces the goods. Based on this decision, Donna determines that she needs to extend the integration in the IF_TXS_ADDITIONAL_ITEM_INFO interface.
Donna contacts the company’s SAP Partner for tax service and aligns with them about this new information in the payload. Donna then creates the ZCL_TXS_ADDITIONAL_ITEM_INFO new class, inherits methods from the standard class CL_TXS_ADDITIONAL_ITEM_INFO, and reimplements the APPEND_ADDITIONAL_ITEM_INFO method.
In this method, Donna first calls the super method to keep SAP standard additional item information and then, implements her own logic by adding a key/value pair with information required for tax calculation.
Important: In every key/value pair that you add under your own logic, the key name must start with the cust_ string, for example, cust_ownProduction.
She names the key cust_OwnProduction to represent the information that they need to correctly calculate taxes.
The logic for the value information depends on the business of the company and must be extracted according to its data model.
Donna creates the ZCL_TXS_ADDITIONAL_ITEM_INFO class and it is now available in the Enhance Localization Interfaces for Tax Service customizing activity. She adds this class in the Class field and the IF_TXS_ADDITIONAL_ITEM_INFO in the Interface field. since this logic is valid for Brazil, Donna adds BR in the Country field.
With this implementation complete, John can calculate taxes considering if the supplier resells or produces the goods involved in this business transaction.