This post explains how to connect from an SAP ABAP System (e.g. ECC, S/4HANA) via IDoc to SAP Cloud Integration in an efficient and standardized way.
You create a generic iFlow for each SAP IDoc Sender System that accepts all IDoc calls from the SAP backend systems and distributes them dynamically via ProcessDirect adapter. The url between the sending and receiving iFlow is dynamically populated based on sender and receiver partner as well as the interface name (Message Type, IDoc Type, Extension).
You can achieve this via DataStore or JMS as a buffer, the solution below works on both Neo and Cloud Foundry (without JMS):
- Create an IDoc Sender with a sender-specific address (e.g. /sap/idoc/ALMCLNT001)
- Store some headers from the IDoc into the message header (not all of them are set by the IDoc adapter)
3. Write the IDoc into the Data Store (as the visibility is for this iFlow only, you can also name it just “IDOC”)
4. Pick up the message from the DataStore, set the ApplicationID (again) and put the ProcessDirect Address dynamically:
5. If all was OK during the execution of your Consumer iFlow, you can send back a positive Acknowledgement: If you encountered an error, you should raise an exception during execution and not catch the errors in a subprocess.
6. If an error occured, you catch the exception, send a negative Acknowledgement and raise an exception (to put the IDoc back into the DataStore for reprocessing):
On the SAP Backend side, you just have to create a generic RFC destination and maintain the partner profiles. Add message type STATUS as an incoming message for each partner in WE20.
We will now execute an example, where we are sending currency rates to Workday:
B1: At the beginning, there is no consumer iFlow, so we get back a negative acknowledgement:
B2: The message is failing by calling the consumer iFlow
…and remains in the DataStore:
B3: After deployment of the consumer iFlow, the next Retry is successful:
…and sends back a positive Acknowledgement:
B4: The status of the IDoc changes to 41
Here you see that 2 negative and finally one positive acknowledgement has been sent.
The message monitoring in SAP Cloud Integration looks like this:
- all messages are found through the Application ID (IDoc Number)
- all messages share the same Correlation ID (by default)
- You see the SAP_IDoc_Dispather iFlow twice (incoming and outgoing message: from/to DataStore)