In one of my projects, I had a requirement in which IDOCs are to be sent to external 3rd party application, via SAP PI. This external 3rd party application is a cloud system in which these IDOCs are received through a web service. Two IDOCs are to be sent at the same time, but we want the second IDOC to arrive 30seconds after the first one. The option is for PI to delay the second message for 30seconds before proecessing it. Before this time, the wait step in ccBPM would have been an option.
However, as part of the architectural landscape that accommodates java only scenarios, the use of ccBPM is being phased out in integration scenarios, since ccBPM is not available in Java Only installations. Finding alternatives on how to delay message processing in SAP PI is the focus of this write-up. This piece explains how to delay a message in PI during the implementation of graphical message mapping. The steps required are described below;
1) Create a UDF: The UDF to be created has a single input with a java method show in the screen below; the time delay as shown below is 30,000 (30,000milliseconds=30seconds) and the java method to catch any exception. You can set your own time delay duration for the message in your UDF.
2) Use the UDF in the mapping: To use the UDF in the mapping, it should be mapped to the top most element in the root node of the target message in the message mapping. This is shown below;
With the mapping and the use of the UDF in the screenshot above, the message will be delayed for 30seconds before it is mapped and passed to the target node, while the first message would have been delivered and processed in the target system before the arrival of the second message.