Skip to Content
Technical Articles
Author's profile photo Malte Schluenz

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…

Our Situation

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.

Our Goal

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.

Our Solution

First, you need to take some steps in your SAP backend system:

  1. You need to export the SYSTAT01 (SAPs standard status iDoc) as an XSD schema from your SAP backend system as described in this article.
  2. 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):
  3. 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.

Overall your iFlow is going to look like this:
iFlow%20OverviewThis iFlow is getting triggered by a ProcessDirect from within CPI (from that iFlow where you want to send a specific status back), puts the message content inside the message mapping together and then at the end sends it to the 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:
    Mapping%20OverviewYou 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:

    Element Description
    …/IDOC/@BEGIN Number of the first segment (normally “1”)
    …/IDOC/EDI_DC40/@SEGMENT Segment number (normally “1”)
    …/IDOC/EDI_DC40/TABNAM Constant: “EDI_DC40” for the iDoc Control Record
    …/IDOC/EDI_DC40/MANDT Your SAP Client number
    …/IDOC/EDI_DC40/DOCNUM You don’t need to set this, as it is getting auto-populated within you SAP backend system
    …/IDOC/EDI_DC40/DOCREL iDoc version (in my case “740”)
    …/IDOC/EDI_DC40/DIRECT iDoc direction: “2”
    …/IDOC/EDI_DC40/IDOCTYP Constant: “SYSTAT01”
    …/IDOC/EDI_DC40/MESTYP Constant: “STATUS”
    …/IDOC/EDI_DC40/SNDPOR Sending Port [For this and the following port and partner fields, I recommend you to reuse the fields of the incoming iDoc into CPI and just turn them around)
    …/IDOC/EDI_DC40/SNDPRT Sending Port Type
    …/IDOC/EDI_DC40/SNDPRN Sending Partner
    …/IDOC/EDI_DC40/RCVPOR Receiving Port
    …/IDOC/EDI_DC40/RCVPRT Receiving Port Type
    …/IDOC/EDI_DC40/RCVPRN Receiving Partner
    …/IDOC/E1STATS/@SEGMENT Segment number (can be again “1”; if you send multiple segments that needs to be unique)
    …/IDOC/E1STATS/MANDT Your SAP Client number
    …/IDOC/E1STATS/DOCNUM iDoc document number for which the status should be updated
    …/IDOC/E1STATS/LOGDAT Log date (Format: yyyyMMdd)
    …/IDOC/E1STATS/LOGTIM Log time (Format: HHmmss)
    …/IDOC/E1STATS/STATUS Status Code (List of all standard ones)
    …/IDOC/E1STATS/REPID Reporting System name (e.g. “SAP Cloud Platform Integration”)
    …/IDOC/E1STATS/ROUTID Route ID (E.g. Last processed iFlow name)
    …/IDOC/E1STATS/STACOD Constant: “SAPD0001”
    Status summary and first line of status message
    …/IDOC/E1STATS/STAPA2 Second line of status message (E.g. iFlow name where it was processed last)
    …/IDOC/E1STATS/STAPA3 Third line of status message (I don’t use that so far)
    …/IDOC/E1STATS/STAPA4 Fourth line of status message (I set here the message id to find it also in the status record)
    …/IDOC/E1STATS/ARCKEY Message id of SAP CPI
    …/IDOC/E1STATS/STATYP “S” for successful status
    “E” for error status
  • For the outbound iDoc connection you configure the following parameters:
    iFlow%20iDoc-Adapter%20configurationTo 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

Our Result

When opening a specific message in the ALE Status Monitor (transaction: BD87), you see the following overview:
ALE%20Status%20Monitor%20OverviewIt shows you the received status 12 and the status message which was received.

When you open the Control Record, you can find the message id of SAP CPI in the Details-tab under Identification (it is the content of ARCKEY). Based on this field you can also search now in the ALE Status Monitor.

When you open the Status iDoc itself you find the other details we send from CPI:

iDoc%20Status%20Details%20-%20Technology%20Info iDoc%20Status%20Details%20-%20Status%20Details iDoc%20Status%20Details%20-%20Logging


In case of any questions or remarks, I am happy to discuss these with you in the comments.

Best regards,

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Fatih Pense
      Fatih Pense

      Hello Malte, thanks for sharing this valuable post. It was hard for us to combine scattered small information pieces in different documents to get it working for the first time. I will use this post as a reference 🙂


      Author's profile photo Raffael Herrmann
      Raffael Herrmann

      Hi Malte Schluenz ,

      thanks for bringing up this blog post. It's, as Fatih said, a great reference when setting up ECC to CPI IDOC scenarios. Thanks!

      Author's profile photo Young Soo Kim
      Young Soo Kim

      Hi Malte


      Thanks for your blog.

      How can we update errors or successfully on SYSTAT01 ->STATYP where can i reference it?


      All the best


      Young kim



      Author's profile photo Monika Varshney
      Monika Varshney

      Hi Malte Schluenz ,

      Very Nice and informative  blog.

      I used this to send the IDOC status back to ECC but issues is that after sending the status 26 back , the segment hierarchy of original IDOC is getting removed and all segments are appearing in under one head node in ECC. Any suggestions for this?


      Kind Regards,