DRC NFS-e Outbound Using Partner Enablement

DRC NFS-e Outbound Using Partner Enablement in SAP Public Cloud

Introduction DRC NFS-e Outbound

In one of our projects, we recently faced an intriguing challenge: establishing communication with the Federal District City Hall, to deliver the client’s NFS-e (Electronic Service Invoices) Outbound. The focus of this article is precisely this process, explaining how to deliver the NFS-e to Brazilian city halls through DRC (SAP Document and Reporting Compliance) using Partner Enablement.

Initially, it is worth highlighting that, currently, the DRC is able to communicate in a standard way with the city halls of São Paulo and Rio de Janeiro. Therefore, the objective of this article is to address the process for other city halls in Brazil using Partner Enablement.

Prerequisite Outbound

We assume that you have already created the DRC instance in your BTP and performed the necessary configurations in SAP S/4HANA Public Cloud. Soon, we will have another article covering these settings in more detail.

Architecture

Currently, there are two ways to establish communication with Brazilian city halls in the outbound billing process: through direct application or using the Integration Suite. In this article, we will explore the approach using the Integration Suite.

It is crucial to understand the macro flow presented below, as it represents our architecture.

Project Architecture

Flow Explanation:

1st – Within SAP Public Cloud, when outgoing billing for Brazil is generated, the ERP sees that it is a city hall NFS-e, based on the settings made by the employee. The Public Cloud sends the JSON as shown in the image above to the DRC.

2nd – At this stage, we chose to create a subaccount in BTP exclusively for the DRC, you can instantiate and organize the DRC/Subaccount in the way you see fit.

Within the DRC Subaccount, destinations were created pointing to the CPI iFlows Endpoints, that is, in the TAG name of the JSON the name of the Destination that was created within the DRC subaccount is being sent, so the DRC sends the JSON of the NFs-e for CPI iFlows (SAP Cloud Integration).

3 – CPI iFlow (SAP Cloud Integration) performs the necessary processing and delivers the message to the Partner’s system.

4 – The Partner’s system processes all the information and returns the response to the CPI.

Let’s now detail each step of this process.

1 – We said that SAP Public Cloud is called DRC; This configuration was carried out in the “Communication Arrangements” application. Although it was mentioned as a prerequisite at the beginning of the article, it is important to highlight that Scenario SAP_COM_0261 must have been configured.

DRC NFS-e Outbound Scenario

Scenario

This Scenario is where the DRC endpoint is configured. Make sure the endpoint below is active. Outbound.

EnPoint Enablement

DRC EnPoint for Partner Enablement At this point where the JSON is delivered:


  "environmentType": "1",
  "documentModel": "00",
  "state": "RS",
  "cityCode": "4318705",
  "action": "AUTHORIZE",
  "name": "DESTINATION_RS_SL_AUTH",
  "changedByUser": "ADMIN"

For this point to work, the functional configuration must have been made within the CBC. I’m going to make a very brief approach, so you can validate that all the configuration has been carried out. The employee must have made the settings according to the document below, within the CBC:

Documento

The images below show the path inside the CBC, to check if the configuration was carried out. Outbound.

Caminho
Caminho

Navigate to Define Business Places for Brazil.

Define
DRC NFS-e Outbound

1. Select the Company code you want to view > 2. Double click on the Electronic Fiscal Document Configuration.

DRC NFS-e Outbound Using Partner Enablement in SAP Public Cloud

If you already have something configured, you will see some values ​​like the one in the image below:

SAP Public Cloud

The NFs-e configuration will be something close to the image below, remembering that you must check the XML and Contigency version of your client/City Hall.

DRC NFS-e Outbound Using Partner Enablement in SAP Public Cloud

If you checked, and the functional configuration was carried out, similar to the example above, we can deduce that SAP Public Cloud is almost ready to call DRC, we still have one more configuration to do.

Let’s now go to the explanation of item 2 of our Flow.

2nd – The flow design shows the DRC being called by SAP Public Cloud. And we can also see three destinations created within the DRC subaccount, which points to the CPI (SAP Cloud Integration) iflows, let’s understand this now.

It is important to mention that the iFlows from the SAP Note were imported as they are in SAP Help:

Nota%20SAP%20dos%20iFlows

Note: Keep in mind that these iFlows are not completely ready yet; they only perform a HardCode simulation, resembling a call to the partner’s system. This means you will still need to implement them. After you import the iFlow package into your SAP Cloud Integration – CPI, you will have the iflow endpoints.

Outbound Using Partner Enablement

Now you will go to the subaccount where the DRC – Document complice is instantiated. And we will create the Destination for each CPI iFlows point.

1st Within Subaacount > 2nd Connectivity > 3rd Destinations After you import the iFlow package into your SAP Cloud Integration – CPI, you will have the iflow endpoints.

SAP BTP Cockpit

You must configure the destinations for the 3 iflows in the package.

Below is an example of a configured destination.

DRC NFS-e Outbound Using Partner Enablement in SAP Public Cloud

If you test the connection and get a 401 error, ignore it, as there is a note from Sap saying to ignore this, Note

3083848 – Connection to “Destination x” established. Response returned: “401: Unauthorized”.

After creating the Destination. Let’s go to SAP Public Cloud and look for the APP Manage Destination – Brazil.

manage Destination

Below are the destinations created for Brasilia city hall.

Destinations

Below is an example of how to configure Destination:

Configurando Destination

1st – First you choose the Type Enverioment, in our case here Homologation. (Remember, not all city halls have a testing environment, check with the city hall/partner)

2nd – Document Model is left blank.

3rd – Select the desired city hall.

4th – Destination Action: (Authorize, Cancel, Check Status)

5th – Destination Name – Here is the name exactly the same as it was created within the DRC subaccount, as this is how it will know which endpoint should send the NFs-e JSON.

Point 3 in the flow design are the iflows that have already been added, but you will have to implement the entire flow to deliver to your partner.

And point 4 is the side that your partner will develop and tell you which endPoint you should call in the CPI for each case.

Your configuration is ready to be tested.

You may be interested in:

How is SAP helping organizations with their digital transformation?

Machine Learning versus Artificial Intelligence

SAP EWM the Future for SAP

SAP Cloud Integration (CPI)