Track – SAP CPI generated Idocs in SAP ERP
Hello Everyone !!
Well, it has been a long while I am not blogging in SAP community. So, I hope this blog will help me to fuel myself and gain some momentum to post few blogs in the community
In this blog, I will mainly focus on a new feature – on how to track Asynchronous IDOC’s pushed from SAP CPI to SAP backend ERP over IDOC/SOAP adapters.
Scenario: Source System –> SAP CPI (via IDOC/SOAP Adapter) –> SAP Cloud Connector –> SAP ERP
In our traditional SAP PI/PO middleware case, the SAP PI message Id would be part of SAP Idoc control record EDI archive key i.e., EDI_DC40 – ARCKEY (shown below). So this means that the standard SAP inbound idoc processing Function Module is considering SAP PI message ID header field
urn:sap.com:msgid=<SAP PI Message ID>
However, in case of SAP CPI we have a different message ID header SAP_MessageProcessingLogID and hence the CPI message doesn’t get logged in SAP ERP idoc control record ARCKEY (probably the FM module is not designed for this yet). And tt seems like the SAP inbound idoc processing Function module generates a new 32 bit Hex Id
So, the trick is to set standard SAP header: SapMessageId with a value same as CPI message ID header: SAP_MessageProcessingLogID. This can be done in the mapping step with a groovy script or with help of a content modifier step as shown below
Of course, the same can be achieved by mapping /IDOC/EDI_DC40/ARCKEY field with a value urn:sap.com:msgid=< CPIMessageID > in CPI message mapping . Please note that static string urn:sap.com:msgid= (prefix) is required for ARCKEY, otherwise the idoc adapter will throw an error such as the below
org.apache.cxf.binding.soap.SoapFault: E/EA/728/SOAP_MSGID_PREFIX_INVALID (IDoc SOAP Namespace – Violation (SOAP_MSGID_PREFIX_INVALID))
In CPI Moni,
So, we can search for the corresponding IDOC number in SAP ERP using CPI message Id (Shown below).
Tcode: WE02 (search with *CPIMessageID )
- SAP Cloud Integration IDOC over SOAP: https://blogs.sap.com/2017/09/15/sap-cloud-integration-idoc-over-soap/
That’s all . Hope this helps you !!
Good one. Keep Blogging!!
Hi, Can you please share a blog CPI TO ERP inbound Idoc process with complete end to end configurations? I want to know configurations in CPI, ERP where CPI can generate the idocs and updates the repsective infotypes in SAP on prem.
Informative blog! But this doesn't work in case of EDI file with multiple ST/UNH segments. I suppose as the CPI Message id would be same and there cannot be more than one IDOC with same EDI Archive Key.
I am not sure
But, have you tested - "EDI file with multiple ST/UNH segments" and it's not working/throwing erros in SAP while creating IDOCs?
Yes did test it. It doesn't throw any error. Just that if we have say EDI file with 4 ST segments instead of 4 IDOCs getting created in SAP, only 1 IDOC gets created.