This blog will show one of the benefits of using the IDOC over SOAP protocol in SAP Cloud Platform Integration (SAP CPI) and is related to an IDOC receiver scenario. There are blogs which describe the usage of the IDOC number as Application Message ID in SAP CPI when working with IDOC Sender scenario's. In our case, we needed to have the IDOC number as Application Message ID whithin an IDOC receiver scenario. First I will explain more about the background.
The IT department wanted to be able to do an audit trail in relationship to IDOCs which are created by SAP CPI in the SAP ECC backend system. Based on the IDOC number they wanted to find the related message in SAP CPI. In order to achieve that the IDOC number needs to be set as Application Message ID in SAP CPI. . Based on the Application Message ID it’s possible to search the corresponding message in the message monitoring within SAP HCI. Please see below screenshot of the end result:
The above screenshot shows the IDOC number as Application Message ID. The IDOC was received by SAP ECC backend and due to the fact it was received as "IDOC over SOAP" a response message was send back towards SAP CPI. This response message was captured by the Integration flow and used to set the Application Message ID. I will explain how I got to above solution.
While testing the scenario I saw in the logs that the IDOC number was present. Please see below picture:
Based on the logs we can see that SAP ECC is sending back the newly created IDOC number. The only challenge left, was to capture that response and set the Application Message ID with the IDOC number.
Although request-reply objects are used in synchronous scenario’s, I decided to add the request-reply object for testing purposes based on above information. The integration flow was changed and 2 objects were added, a request-reply object and a logging script to capture the IDOC response. The simplification of the new integration flow looks like the following:
When I executed the scenario, I saw the following:
The response message was captured and looked like:
Now the last part is easy and changed the Integration Flow and added a content modifier in order to set the Message Application ID via a content modifier with the following configuration:
I got the inspiration based on a SAP PI blog which was written once:
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/2055a6b4-2fb0-2c10-86a8-f1f92eabf728