Technical Articles
Side-by-Side Tax Engine architecture for the SMB
Authors: Gianluigi BAGNOLI and Thiago Mendes
We have never heard so much about side-by-side extensions as we are hearing recently at SAP. All the executive levels are talking on the high-level approaches to reduce modifications in the core ERP, to scale and leverage the innovation through a loosely-coupled architecture and the Intelligent Enterprise. This is specially important now, as SAP recently declared it is targeting a huge expansion on the cloud computing division.
Our CTO Juergen MUELLER have even announced an extension to 12 months of the SAP Cloud trial accounts to enable the path for our partners to embrace the SAP Cloud Platform technologies:
We're happy to share that we extended our @sapscp trial to 12 months as a first step on our journey to a free tier. Stay tuned for more updates! @SAPMentors @SAPdevs @SAPCommunity pic.twitter.com/R9X7iKnflO
— Juergen Mueller (@JuerMueller) November 5, 2020
The SME organisation has been pushing this approach to the partners for quite some time already, kicking off several initiatives with SAP Business One’s channel ecosystem and rolling them out for SAP Business ByDesign’s.
Keep the core clean
In this blog post we will discuss what components you need to build a side-by-side tax engine architecture for SAP Business ByDesign. The goal is to allow you to process tax calculations in your own application based on input data from the core ERP documents, and further influence the document’s tax data, such as tax percentage, according to your own rules running as a cloud service.
The straight forward and most clean way would be, for instance, to take your own tax engine application deployed in the SAP Cloud Platform, and trigger it based on an event-driven call from the core ERP, so you could act on that input data, calculating the tax and writing it back to the ERP system through an OData or SOAP service:
However, if you take a look at the PSM documentation for the tax fields in ByD, you will notice they are exposed in a read-only access mode only, meaning you cannot change document’s tax data in a straight forward manner:
Hybrid approach
Luckily enough, we do have some internal SAP Cloud Applications Studio components that allow you to do so for some of the tax data, through your own code in the Studio. They are called BADI – Business Add-in. You will find them under the “Enhancement Options” tab of the “Repository Explorer” view:
If we choose, for instance, the “CalculationProcedureForTaxes” BADI, we can see the fields we can change through the ABSL code:
In that sense, we can use the BADI component to build the bridge to our external application. They will be useful as the entry point for a side-by-side external application to calculate and write tax data into ByD documents, such as customer invoice. We could then come up with the architecture diagram bellow:
The Enhancement Option is comprised by:
- an ABSL component so you can write your logic; and
- a filter so you can define the conditions to trigger your logic.
In the ABSL code of the BADI, you will call your loosely-coupled tax engine application by consuming the SAP reuse library Web Service Utilities:
var ws_result = WebServiceUtilities.ExecuteRESTService( ScenarioName,
ServiceName,
HttpMethod,
HttpResource,
URLParameter,
HeaderParameter,
ContentType,
Body);
Notice: this is a synchronous call, therefore be aware of the performance issues you might be causing if you are not handling it properly in the external application.
Please, follow this guide very carefully in order to properly set-up the Business Configuration Sets and BADI required for the tax calculation procedure.
Stay tuned!
Hi Thiago,
very nice starting point for partners for the topic of "Side-by-Side Tax Engine architecture for the SMB ( especially for SAP Business ByDesign) "
thanks a lot for the wonderful blog
regards
murthy