Introduction
As of applying electronic invoice is being applied in Egypt, many companies that have a SAP ECC or S4hana try to adopt it.
SAP recommended solution for this is to use SAP Document Compliance add-on.
However many companies use instead a middle ware server to make this process especially to handle digital signature process.
In this blog we will highlight the steps to integrate SAP with Egyptian tax authority (eta) without using cloud add-on or a separate middle ware server.
we will include steps for
1- Read specific invoice from eta portal
2- Submit an invoice without digital signature
3- Submit an invoice with digital signature
Steps to integrate SAP to Egypt e-invoice system ( eta )
Get Invoice phase
1- Create a connection to eta using rest webservice and oauth authorization.
To make it refer to sap blog :
https://blogs.sap.com/2020/12/18/configuring-oauth-2.0-and-creating-an-abap-program-that-uses-oauth-...
Make your settings to connect to preprod eta server ( a test server )
2- Make a structure using se11 that represent eta response structure.
Make sure that elements are named as eta documentation, for example ( DocumentType should be
named in SEll as Document_type ).
Please refer to eta documentation:
https://sdk.preprod.invoicing.eta.gov.eg/api/
3- Make a program and get your invoice from as described in step 1.
4- Convert a response json data to your corresponding structure.
To make it refer to sap wiki:
https://wiki.scn.sap.com/wiki/display/Snippets/One+more+ABAP+to+JSON+Serializer+and+Deserializer
Steps to integrate SAP to Egypt e-invoice system ( eta )
Submit Invoice phase - without digital signature
1- Create a connection to eta using rest webservice and oauth authorization.
To make it refer to sap blog :
https://blogs.sap.com/2020/12/18/configuring-oauth-2.0-and-creating-an-abap-program-that-uses-oauth-...
Make your settings to connect to preprod eta server ( a test server )
2- Make a structure using se11 that represent eta invoice structure.
Make sure that elements are named as eta documentation, for example ( DocumentType should be
named in SEll as Document_type ).
Please refer to eta documentation:
https://sdk.preprod.invoicing.eta.gov.eg/api/
3- Make a program and fill your structure with your data.
For test use doc_type_version = 0.9 to send invoice with out signature.
4- Convert your data in your structure to json format.
To make it refer to sap wiki:
https://wiki.scn.sap.com/wiki/display/Snippets/One+more+ABAP+to+JSON+Serializer+and+Deserializer
5- Post your json data as a payload to eta.
To do it refer to step no.1
6- Check response from request and be sure that your invoice is in accepted state.
Steps to integrate SAP to Egypt e-invoice system ( eta )
Submit Invoice phase - with digital signature
Please note here that we outsource digital signature process to a desktop application on windows
and we use files to transmit data from SAP and this app.
On github there are several samples for doing digital signature with different language, pick any one of them and try it, and adopt it to your specifications.
1- Create a connection to eta using rest webservice and oauth authorization.
To make it refer to sap blog :
https://blogs.sap.com/2020/12/18/configuring-oauth-2.0-and-creating-an-abap-program-that-uses-oauth-...
Make your settings to connect to preprod eta server ( a test server )
2- Make a structure using se11 that represent eta invoice structure.
Make sure that elements are named as eta documentation, for example ( DocumentType should be
named in SEll as Document_type ).
Please refer to eta documentation:
https://sdk.preprod.invoicing.eta.gov.eg/api/
3- Make a program and fill your structure with your data.
For test use doc_type_version = 1.0 to send invoice with signature.
4- Convert your data in your structure to json format.
To make it refer to sap wiki:
https://wiki.scn.sap.com/wiki/display/Snippets/One+more+ABAP+to+JSON+Serializer+and+Deserializer
5- Download json data to a file in your local system then run throw SAP your external app to generate a signature file
then upload this file to your ABAP program and add this signature to your json
6- Post your json data as a payload to eta.
To do it refer to step no.1
7- Check response from request and be sure that your invoice is in accepted state.
Conclusion:
Integrating SAP with ETA can be done using regular ABAP without need to an additional add-on or middle ware server.
The main advantage for this solution is obvious, however the main drawback of this solution is the limitation of IO processes. Signing an invoice and send it take about 2 seconds so it's suitable for companies that have a small amount of invoices to be signed.
---
Do you have a better solution for this ? if yes please put it in comments