You have the option of collecting multiple messages for an interface and bundling them into one message, for example, individual purchase order items into one purchase order. To do so, you need to define a receiver step within a loop. A loop can finish in a variety of ways.
The following table shows the various options. You can find the examples in the Enterprise Services Repository under SAP Basis → SAP Basis <release number>, namespace http://sap.com/xi/XI/System/Patterns.
Collect and Bundle | Description | Example |
---|---|---|
Payload-Dependent |
The loop finishes when the number of messages received matches the number specified in the payload of the messages. |
BpmPatternCollectPayload |
Time-Dependent |
The loop finishes at a specified point in time. |
BpmPatternCollectTime |
Message-Dependent |
The loop finishes when a specific message is received. |
BpmPatternCollectMessage |
CorrelationCollectMessageList
CollectMessageListNewMessage
The processes use one of the abstract interfaces as an inbound interface, and one as an outbound interface (see also: Process Signature ).
Payload-Dependent Loop
Each message that is received in the loop contains a number in the payload, which corresponds to the total number of messages to be received. In the loop, a container operation counts the counter Counter for the number of messages received. The loop continues to run while the number of messages received is not equal to the number of messages to be received.
The following graphic illustrates the process definition:
The loop for receiving the messages is defined as an infinite loop. The infinite loop forms a branch within a block. A deadline has been defined for the block. When the deadline is reached, the process is diverted into the designated branch. A control step then triggers an exception in this branch. The relevant exception handler ends the block (normal completion, no error status).
The following graphic illustrates the process definition:
The loop for receiving the messages is defined as an infinite loop. The infinite loop forms a branch within a fork. A receive step is defined in a parallel branch to receive the message that ends the process. The fork is complete when both branches return true. However, since the infinite loop always returns true, the fork is only complete when the message that ends the process is received.
The following graphic illustrates the process definition:
More Information:
Correlation: Defining Assignment of Messages to Process Instances