eInvoice with SAP DRC Electronic document processing using extensibility features
The end-to-end solution described below fits any new development for Electronic document processing.
Why use SAP DRC for eInvoice?
The eInvoicing processing is very sensible and demands a high level of monitoring and error handling and SAP DRC with its eDocument framework and SAP Application Framework Interface (AIF) can together deliver a great solution to handle this challenge.
Application Interface Framework – Implement and Monitor interfaces. Field Mappings. Value Mappings. Error handling.
Web Service Runtime – Allow to consume API Web Service (Soamanager)
SAP Cloud Connect – Handle authentication and message sending to Tax authority.
This figure gives an example of an architectural overview:
The following figure depicts an example of electronic document processing.
- You create the source document (for example, an invoice) using an SAP application. Once you post the source document, the system creates an instance of the electronic document (eDocument) in the database.
- You submit the eDocument by running the eInvoice process in the eDocument Cockpit ( EDOC_COCKPIT transaction).
For more information, see the application help documentation directly in the report.
The system retrieves the eDocument from the database and calls the interface connector to deploy the eDocument Interface connector (EDOC_INTERFACE_CONNECTOR) Business Add-In (BAdI).
Note: This BAdI calls the interface type that enables the system to connect to the Application Interface Framework.
- The Application Interface Framework triggers the mapping of transactional data into the required XML format and saves the XML files.
The system calls the integration service via an ABAP Proxy and establishes communication with the tax authorities or business partners’ systems.
If the call is successful, the XML is saved. After successfully receiving the response, the response XML is saved.
- The integration service processes the XML to comply with the official communication requirements and triggers the corresponding Web Services for sending the XML file over to the external system.
- The integration service receives information regarding the status of the request back from the external systems, transforms it into a consumable format (by decoding and mapping the result), and forwards it to the Application Framework Interface and this to the system.
- The system updates the eDocument in the database with information from external systems.
Developing the Process
Important: This guide assumes that you are familiar with ABAP development, SAP Application Interface Framework, and integration flows from SAP Cloud Integration.
Creating an eDocument Process
- Create class ZCL_EDOCUMENT_MY as a subclass of CL_EDOCUMENT
- Create a new record on view EDOCOUNTRYTCH for Country “MY”, Class “ZCL_EDOCUMENT_MY”, and Proc.Mgr active
- Create a database table to store eDocument instance information, using EDOC_GUID as a key field.
- Create a new eDocument type at view EDOTYPEV and specify the table name created before.
- Create a DB handler interface. Should have a method for each of the possible operations such as INSERT, DELETE, MODIFY, SELECT, etc.
- Create a DB handler class as a subclass of CL_DOCUMENT_DB and implement the interface created before.
- Implement the class as a subclass of ZCL_EDOCUMENT_MY. Create an attribute for DB connection using the ABAP interface you defined before. Define the methods to handle the actions that were defined during the process definition. Ex: Create, Send, Validate, and so on.
- Create the SAP Application Interface Framework interface mapping structures. You can directly reuse or create a copy of existing structures.
- Implement a class as a sub-class CL_EDO_MAPI_AIF.
- Implement Process Manager using view cluster EDOC_PROCMGR.
- Configure eDocument Interfaces using views EDOINTERFACEV, EDOINTVERSIONV, EDOPROCSPINTDETV, EDOPROCSTEPDETV and EDOINTTYPEV
- Configure the eDocument cockpit using views EDOMETASTATDETV, EDOMAPCLASSDETV, EDOMETASTATUSV, EDOPROCFUNCASGV, EDOPROCFUNCARCV,
Creating a Web Service Proxy
- Create an Integration Flow in SAP Cloud Integration using WSDL provided by tax authority.
- Create the Consumer Proxy
- Configure the Consumer Proxy logical port using SOAMANAGER
Creating an SAP Application Interface Framework (AIF) Interface
- At this moment, the Consumer Proxy class created before is used.
Please refer AIF documentation to create the interface
Linking the components
- Link the eDocument Process to SAP Application Interface Framework in the view EDOINTAIFV
- Link the eDocument Interface to the Web Service Proxy using views EDOSOASERV and EDOINTV
- Link the Business Process to Document Compliance by transaction FIBF
- Link the Back-End Process
- Activate FI_INVOICE in view EDOCOMPANYACTIV
- Assign eDocument Type to Accounting Document Type (T003EDOC)
- In the Develop the Interface Connector ABAP Class Business Add-In, copy from the sample implementation of the interface connector class.
- create a new implementation for BADI EDOC_INTERFACE_CONNECTOR
- Specify the implementation and create the BAdI implementation ABAP class using the one copied above.
- Create the runtime filter value for the BAdI
- In eDocument: Source Type (EDOSRCTYPEV), make sure the structure and ABAP class used to relate the source information with the Document Compliance Framework are in place