HOW TO DELAY (USE WAIT STEP) MESSAGE IN SAP PI WITHOUT ccBPM
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.
Interesting one.!, Keep updating.
Regards,
Sunil
Thanks Sunil
Can you please let me know what are the inputs to the UDF, As I am facing the same scenario I am not able to get the delayed message.
Hi Sarada,
As you can see, the UDF has just only one input, that will be the topmost element of the rootnode from the source message. You can define a dummy input for this, just as what you could see in the blog (string a).
Regards,
Abidemi
Hi Abidemi,
My requirement is to post two idocs to ECC with the delay time of 60 Sec in between them, but with this logic applied too, both the idocs are posting in ECC at same time.
Thanks
Sarada
Hi
Nice idea.
I was considering to do something like the same. A issue you could end up with it that all your mapping treads will be used. So you would have a few mappings that are in waiting mode for 30 seconds.
Daniel
Hi Abidemi
As the delay is at the mapping level, the delay happens for every request.Please let me know how you managed to post the second Idoc after 30sec of time of first Idoc. Even I had the same challenge and looking for the solution.
Thanks in Advance
Madhurima
Hi Abidemi,
like this only i'm also facing one problem..it is,
i'm getting one binari file and one IDOC file,first i need to process binary and have to wait for 2 or 3 seconds and thenhave to process IDOC, and finally i need to get one file only in the target system.
can u suggest the best way?
This doen't wokr sometimes.I have tried it real business cases.
In quality it worked fine. But when I transport it to Production, All the messages are created at the same time. Kindl
y help.
Hi All,
We have got this to work in our test area by following the instructions in the blog.
When trying it out with one or two messages, we can see the messages appearing in the Scheduled column of Message Monitor whilst the time delay is happening.
However, my concern with this is if we have many messages coming through at the same time (maybe 50+ at the same time), then won't there be an issue with the maximum number of mapping (?) threads that can be used at any one time? And, if so, wouldn't this impact the performance of SAP PI overall and could, therefore, impact other interface messages that may be processing at the same time?
So maybe there is a better way to delay the IDoc transfer where ccBPM isn't an option? I have heard we can use BPM but would that be over-complicating the process?
Many Thanks,
Gareth