Skip to Content

A common BPM usage is to collect IDocs received from an SAP until it stops receiving more messages. It may sound easy to create such a process, but if you want to be sure you get all the messages you have to thing about your design.

One way to do this is to use a deadline branch within a loop. This could look like the following:

!https://weblogs.sdn.sap.com/weblogs/images/251687272/NewPicture.png|height=250|alt=image|width=577|src=https://weblogs.sdn.sap.com/weblogs/images/251687272/NewPicture.png|border=0!

Messages are collected the following way. The first message triggers the process. The message is then collected to the multi-line element in the container. Since the loop condition is always true (1=1), the process continues back to the receive step and waits for the next message. When it receives it, the message is appended and the process is repeated.

If the receive step is not performed within one minute in the collect block, the deadline branch fires the exception “END”. This exception is caught in the append_invoices process, which is an empty branch, leading the application to the mapping and send steps.

There can be a weakness with this type of process. A message arrives after 59.7 seconds in the collect block, it is received and we are at point A, when the deadline branch is triggered. The END exception is then thrown before the message has been collected in the container element. The result is therefore that the message has been received but is not used in the mapping. It can be quite difficult to find this missing message; you need to have other ways of detecting the problem.

The main problem is to figure out whether the last message has been added to the list. My solution is to use a multi mapping to test if the message is in the list already. Since all IDocs have a unique number, it’s possible to check if the message is in the list.

I created a multi mapping containing the single element and the multi-line IDoc. I mapped this to a message with only a single field called status:

image

image

The switch statement has the following properties:

image

In this branch is then a container element, which adds the last message to the multi line element.

Because of the long time it might take to perform the mapping, I created a block around my loop with the following parameters. The correlation should therefore not be active after the END exception has been thrown:

image

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Emil Jessen
    Hi Daniel,
    Im giving your solution a try. But I’ve lost the overview. Can you put in a screenprint of the entire final solution? Or perhaps mail it to me? I’m not quite sure where in the process, you put the block and switch with the new multi mapping check.

    A minor correction request: in your function code a small ‘
    ‘ has sneaked in. This causes the function to fail if you want/need to copy the code,.. like I do.

    Otherwise, it seems to be a good solution to a serious and hard-to-monitor problem.  

    Best regards,
    Emil

    (0) 
  2. ramana peddu
    Hi ,
    I am trying a simple File to File interface from 2 different folders. If I have to set a delay of 1 min on the receiver side , how do I do it . I just tried a simple wait insert in the Integration process. It picks all the messages at a time and delays them for 1 min and posts them at the same time .I know , I am supposed to do something like you have mentioned . But the steps you mentioned are not too specific.Can you please send me the steps using BPM ?

    Thanks in advance

    (0) 

Leave a Reply