Skip to Content

This blog post, as part of this blog series, refers to the recently introduced Conditional Start feature in SAP NetWeaver BPM available with SAP NetWeaver 7.3 EHP 1 SP 06 and higher.

It describes the advanced usage scenarios of Conditional Start, which are enabled by modifying the correlation criteria for the start event. For a basic example of Conditional Start usage, please, take a look at part 1. For general information, you can refer to Conditional Start documentation on the SAP help portal.

Example Process

The scenarios are based on a simple conditional start process for gathering a given number of pencils of the same color and packaging them, once the number of expected pencils is reached. The process consists of the following modeling elements:

  • Data object PencilColor – initialized during process instance start and used in the correlation condition of the intermediate message event
  • Data object NumberOfPencils – initialized during process start and value decreased each time a pencil is processed
  • Start event – triggered by process start and initializes the PencilColor and NumberOfPencils data objects
  • Mapping activity Decrease NumberOfPencils – used to decrease the number of expected pencils by one
  • Exclusive choice gateway – based on the current value of NumberOfPencils decides if there are more pencils to gather, or the process may proceed to the packaging activity
  • Intermediate message event (IME) – triggered by incoming message, which correlates with the already expected color (e.g., PencilProcessedOperation/color = PencilColor)
  • Automated activity Package the gathered pencils – sending a message once the expected number of pencils is reached
  • End event – triggered when the process is about to complete

Scenario 1 – Having Unrestricted Correlation Condition in the Start Event

For this scenario, the correlation condition of the start event is set to true. This means, if there is no running Conditional Start process instance, which is able to consume the incoming message, a new process will be started. The table below illustrates the exemplary execution of the process.

ConditionalStart_scenario1.jpg

Sending message #1:

Message Payload
Running Process Instances Handled by Process Instance Number of Remaining Pencils
<message_payload>
  <pencilColor>BLUE</pencilColor
  <numberOfPencils>3</numberOfPencils>
</message_payload>
2
Description of Behavior
  • The message is received
  • There is no running process instance, which can consume the message
  • New Conditional Start process instance is started
  • NumberOfPencils is set to 3
  • PencilColor is set to BLUE
  • The activity Decrease NumberOfPencils decreases the value of NumberOfPencils by 1
  • The value of NumberOfPencils is 2, so the process does not yet continue to the packaging activity, but is waiting on the IME

Sending message #2:

Message Payload
Running Process Instances Handled by Process Instance Number of Remaining Pencils
<message_payload>
  <pencilColor>BLUE</pencilColor>
  <numberOfPencils>3</numberOfPencils>
</message_payload> 
BLUE pencils process instance BLUE pencils process instance 1
Description of Behavior
  • The message is received
  • The message correlates with the condition of BLUE pencils process instance IME and is consumed by the process
  • The activity Decrease NumberOfPencils decreases the value of NumberOfPencils by 1
  • The value of NumberOfPencils is 1, so the process does not yet continue to the packaging activity, but is waiting on the IME

Sending message #3:

Message Payload Running Process Instances Handled by Process Instance Number of Remaining Pencils
<message_payload>
  <pencilColor>RED</pencilColor>
  <numberOfPencils>3</numberOfPencils>
</message_payload> 
BLUE pencils process instance 2
Description of Behavior
  • The message is received
  • There is no running process instance, which can consume the message
  • New Conditional Start process instance is started
  • NumberOfPencils is set to 3
  • PencilColor is set to RED
  • The activity Decrease NumberOfPencils decreases the value of NumberOfPencils by 1
  • The value of NumberOfPencils is 2, so the process does not yet continue to the packaging activity, but is waiting on the IME

Sending message #4:

Message Payload Running Process Instances Handled by Process Instance Number of Remaining Pencils
<message_payload>
  <pencilColor>GREEN</pencilColor>
  <numberOfPencils>3</numberOfPencils>
<message_payload>

BLUE pencils process instance

RED pencils process instance

2
Description of Behavior
  • The message is received
  • There is no running process instance, which can consume the message
  • New Conditional Start process instance is started
  • NumberOfPencils is set to 3
  • PencilColor is set to GREEN
  • The activity Decrease NumberOfPencils decreases the value of NumberOfPencils by 1
  • The value of NumberOfPencils is 2, so the process does not yet continue to the packaging activity, but is waiting on the IME

Sending message #5:

Message Payload Running Process Instances Handled by Process Instance Number of Remaining Pencils
<message_payload> 
  <pencilColor>BLUE</pencilColor> 
  <numberOfPencils>3</numberOfPencils> 
</message_payload> 

BLUE pencils process instance

RED pencils process instance

GREEN pencils process instance

BLUE pencils process instance 0
Description of Behavior
  • The message is received
  • The message correlates with the condition of BLUE pencils process instance IME and is consumed by the process
  • The activity Decrease NumberOfPencils decreases the value of NumberOfPencils by 1
  • The value of NumberOfPencils is 0, so the process proceeds to the packaging activity and afterwards completes

Sending message #6:

Message Payload Running Process Instances Handled by Process Instance Number of Remaining Pencils
<message_payload>
  <pencilColor>BLUE</pencilColor> 
  <numberOfPencils>3</numberOfPencils> 
</message_payload>

RED pencils process instance

GREEN pencils process instance

2
Description of Behavior
  • The message is received
  • There is no running process instance, which can consume the message
  • New Conditional Start process instance is started
  • NumberOfPencils is set to 3
  • PencilColor is set to BLUE
  • The activity Decrease NumberOfPencils decreases the value of NumberOfPencils by 1
  • The value of NumberOfPencils is 2, so the process does not yet continue to the packaging activity, but is waiting on the IME

Scenario 2 – Having Strict Correlation Condition in the Start Event

For this scenario the correlation condition of the start event is set to PencilProcessOperation/color != “red”. In this case, if there is no running Conditional Start process instance, which is able to consume the incoming message, a new process will be started only if the condition correlates, e.g,. if the pencil color is not red. The table below illustrates the exemplary execution of the process. 

ConditionalStart_scenario2.jpg

Sending message #1:

Message Payload
Running Process Instances Handled by Process Instance Number of Remaining Pencils
<message_payload>
   <pencilColor>BLUE</pencilColor>
   <numberOfPencils>3</numberOfPencils>
</message_payload>
2
Description of Behavior
  • The message is received
  • There is no running process instance, which can consume the message
  • New Conditional Start process instance is started
  • NumberOfPencils is set to 3
  • PencilColor is set to BLUE
  • The activity Decrease NumberOfPencils decreases the value of NumberOfPencils by 1
  • The value of NumberOfPencils is 2, so the process does not yet continue to the packaging activity, but is waiting on the IME

Sending message #2:

Message Payload
Running Process Instances Handled by Process Instance Number of Remaining Pencils
<message_payload>
  <pencilColor>RED</pencilColor> 
  <numberOfPencils>3</numberOfPencils> 
</message_payload>
BLUE pencils process instance
Description of Behavior
  • The message is received
  • There is no running process instance, which can consume the message
  • The message does not correlate with the Start Event condition and is discarded (deleted without further notice to the sender)

Sending message #3:

Message Payload
Running Process Instances Handled by Process Instance Number of Remaining Pencils
<message_payload>
  <pencilColor>BLUE</pencilColor>
  <numberOfPencils>3</numberOfPencils>
</message_payload> 
BLUE pencils process instance BLUE pencils process instance 1
Description of Behavior
  • The message is received
  • The message correlates with the condition of BLUE pencils process instance IME and is consumed by the process
  • The activity Decrease NumberOfPencils decreases the value of NumberOfPencils by 1
  • The value of NumberOfPencils is 1, so the process does not yet continue to the packaging activity, but is waiting on the IME

Scenario 3 – Best Practices

This scenario is almost the same as the first one, with one significant difference – there is an extra human activity step at the end.

ConditionalStart_scenario3.jpg

This activity, as well as any other source of delay, could have a significant impact on the process execution. Have a look at the following scenario:

  • 3 messages about BLUE pencils are received
  • New Conditional Start process instance is started and consumes the messages
  • All required messages are received and consumed, so at the gateway we proceed to the Package the gathered pencils activity
  • Once it completes, we proceed to the Check package human activity

At this point, the process basically waits for a human interaction and all further incoming messages about BLUE pencils will be gathered by the IME, but not consumed by the currently started process instance.

Once the human activity completes, the gathered messages will be further processed and consumed by the newly started process instance. However, this can lead to delays and it is considered as a best practice to use the correlation condition in order to directly start a new process instance, once the currently active process instance gathers all required messages.

There are different ways to do this, one is to use a custom flag in the correlation condition of the IME:

(PencilProcessedOperation/color = PencilColor) AND stillGatheringMessages

The flag stillGatheringMessages can be set to true in the start event and once all required messages are received can be set to false in the Decrease number of pencils mapping activity. In this way, all further messages about BLUE pencils will no longer correlate with the IME correlation condition and a new process instance will be started, which will then in parallel gather and consume the incoming messages.

Conclusion

Conditional Start is a very powerful feature in SAP NetWeaver BPM. Choosing the correlation condition is an important part of the Conditional Start fine tuning. Changing the correlation condition cannot only affect the number of started processes, but also lead to discarded messages.

To report this post you need to login first.

8 Comments

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

      1. Praveen Gujjeti

        In fact, I arrived this blog (3/7) from Boost your Correlation Scenarios with Conditional Start

        Still going through the other blog series/patterns. Many thanks for the entire team efforts

        BTW, I have one question does all the 65 EAI common patterns (Ref’s: SAP Process Orchestration Integration Patterns  & Get your free #BPM Enterprise Pattern models for #SAPNetWeaver Process Orchestration here ) can be implemented now in SAP NW BPM?

        Best Regards,

        Praveen Gujjeti

        (0) 
        1. Abdul-Gafoor Mohamed

          Hi Praveen,

          Most of the 65 Enterprise Integration patterns can be implemented in the Process Orchestration solution. Please note that the messaging patterns deal with an ESB, i.e., PI in this case.  There may be certain limitations with a few pattern implementations in the solution.  If you have specific questions about one or more patterns, please let us know so that they may be addressed accordingly.

          Thanks!

          (0) 

Leave a Reply