SAP S4H (IDOC) to SAP CPI - Inbound IDoc Interface
Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Below blog explains the steps required to establish the communication between SAP CPI and on-prem S4Hana. This is for inbound IDoc interface and for demo purpose I am using mail as receiver.
Topics will be covered -->
System Connection between S4H and CPI
Background Configurations required
Configure Idoc Sender Adapter
Search messages in message monitoring based on Idoc Number
To be able to send messages from SAP S4Hana to SAP CPI import CPI certificates in S4Hana STRUST. You can download CPI certificates either from keystore or from any browser.
Login to S4hana system --> Tcode STRUST (Import all 3 CPI certificates) --> Add to Certificate List
Create Logical System for S4H and CPI system in Tcode BD54
Create RFC Destination of Type G -->Host = CPI Tenant, Port = 443, Path Prefix = from Sender Adapter (CPI - IFlow); Logon & Security
RFC Connection test returns HTTP 500 response
Create Port WE21 --> Port Type --> XML HTTP
Partner Profile WE20 -->
Import Outbound Message type with port created in earlier step
In the Custom IFlow, give the same path prefix as given in RFC Destination IDoc Adapter Configuration -->
In-order to be able to search my Iflow in monitoring based on Idoc number, I have configure Content Modifier with Header Values I am using Headers --> SapIDocDbId, SapIDocTransferId, SapIDocType in my mail body and created SAP_ApplicationID to pass Idoc Number from payload which will help me to monitor messaged based on Idoc Number. Value for SAP_ApplicationID is Xpath of my Idoc DOCNUM
This however means, for each IDOC type thats flows from S4H to CPI, a separate Type G connection will have to be created [/cxf/matmas or /cxf/debmas....] in SM59. Thats a lot of SM59 connections.
One could possibly mitigate this by having a generic routing iFlow [/cxf/idoc and thereby having only 1 SM59 connection for IDOCs to this CPI iFlow] and then making process direct calls to individual iFlows processing different IDOC types, depending on field values in the control segment.
It would be ideal though, if SAP could build something on S4H, which would allow specifying a generic path prefix [/cxf/idoc/<idoctype>] in SM59 connection [so that there is one connection, like in tRFC port for IDOCs between ECC and PO ] and dynamically route the calls [?] to the iFlow endpoints [ /matmas or /debmas... maintained in Connection of respective iFlows] from S4H.
Do share your thoughts on this or if there is an alternative way already.
Yes your understanding is correct. However, you can make a generic RFC destination capture idocs in CPI and then using process direct can push to the next steps.
In case anyone faces an error of 'Server certificate does not match supplied TargetHostname', 'SSSLERR_SERVER_CERT_MISMATCH' while following this blog, please follow the steps in below blog to fix it.
Apart form from the content modifier in Iflow, I have followed your steps mentioned above and configured the scenario but getting error as staus 02 in we02.
Going forward for Cloud Foundry, we should use Certificate based authentication only.Client ID and Client Secret based authentication is not recommended (Except for testing from Postman purposes ).
Unfortunately, Rashmi has not provided what certificates does CPI need to have. I will be writing a more detailed blog if people require.
I want to thank you all in advance for helping me in my journey.
I'm getting stuck at step number 6 of this blog. When I try to add message type in the partner profile, the receiver port is not showing the CPI port. See screenshot attached. I have created port similar to how you have shown in step 5 of this blog. I'm assuming the port created in step 5 is what should be displayed in the receiver port in WE20, correct?
I am following this blog to practice and learn how to establish connection between S4 to CPI and send any idoc from S4 to CPI