Update the delivery status of iDocs sent from SAP CPI-PI in SAP backend systems (SAP ERP)
When Raffael Herrmann posted his question, if an iDoc via XML/HTTP adapter can reach status 12, I was remembered on some investigations and developments I have done together with our team and Mirko Goepfrich in February and March of this year. As I anyhow wanted to write a blog article on that to share our results with you, I prioritized it now and here it goes…
As we currently replace SAP Business Connector (yes, we have one still running 😉 ) the question was raised, why an iDoc sent to Business Connector switches to status 11 (error) or 12 (success) and an iDoc sent to SAP CPI only to status 02 (error) and 03 (success). After a lot of research and testing, we found out that the cause of this is different standard iDoc handling based on the used technology.
For the exchange with the business connector (and SAP PO) we use the RFC protocol. In this communication flows the business connector automatically writes back the status of the execution after it has been completed.
On the other hand for communication with SAP CPI everybody needs to use the XML/HTTP adapter. This behaves differently: It decides whether it was successfully submitted or not to SAP CPI. However, it does not receive after overall execution a status update as SAP BC and PO do.
As dependent on the iDoc status different reprocessing and analysis options exist, we wanted to reproduce the status behavior of SAP BC and PO also to our integration with SAP CPI.
Furthermore, we saw that within the status update more information like message id and messages are sent back and stored within SAP ERP. This we also wanted to utilize.
First, you need to take some steps in your SAP backend system:
- You need to export the SYSTAT01 (SAPs standard status iDoc) as an XSD schema from your SAP backend system as described in this article.
- I assume that you already have configured a partner profile (in WE20) for SAP CPI, like this one:
As you can see you need to configure an inbound partner for the STATUS iDoc. This needs to be configured as follows (in the other tabs nothing needs to be configured):
- Last step in your SAP backend system: You need to ensure that you have activated inbound XML/HTTP processing as mentioned in this SAP Help document.
From now onwards you are going to develop the iFlow in SAP CPI which prepares the status iDoc and sends it to your SAP backend system.
Below I summarized some useful information for your development:
- For the ProcessDirect-Adapter, you configure any address that you want.
- The mapping is not so complicated, as you don’t need to do really do a mapping. 😉
You upload on the source and target side of the mapping the downloaded XSD-file from your SAP backend system. Than you add only constants to your target mapping, so that your mapping looks like this:
You don’t need to configure something on the source side.
On the target side, you need to set constants for the higher structural components except for E1IDOCENHANCEMENT, just so that they get generated in the resulting XML. The following individual elements need to be filled:
- For the outbound iDoc connection you configure the following parameters:
To call the endpoint on your SAP backend system which is hosted on-premise you first need to ensure that the corresponding host and endpoint is configured in the SAP Cloud Connector which is connected to your SAP CPI tenant and that you activated the inbound XML/HTTP iDoc processing as explained earlier (SAP Help document).
- In case the iDoc could not be sent successfully to your SAP backend system from SAP CPI, the message fails in CPI, so you could think about putting a JMS queue for automated retry operations in between
In case of any questions or remarks, I am happy to discuss these with you in the comments.