Problem solve Get help with specific problems with your technologies, process and projects.

Advanced Workflow features -- SWITCH

In this SAP best practices tip, learn about a new SAP Workflow feature called SWITCH in the step Multiple Condition. This new feature carries a condition definition that is not available in the Workflow CASE step.

SAP has introduced new features in Business Workflow with releases 6.20, NW04 and NW04s.

This article will provide an introduction to a new feature called SWITCH, which is provided in the "Multiple Condition" step of SAP Workflow. It is assumed that the reader of this article has some knowledge of Business Workflow and has worked with the "Multiple Condition" step.

The SWITCH feature in the step "Multiple Condition" is available as of the release NW04. Before NW04, the only feature available with this step was "CASE". In the situation of "CASE", the Workflow system checks the value of the basis of comparison against the defined comparison values (as shown below).

In SWITCH, each branch carries a condition definition. We can visualize "Multiple Condition" with SWITCH as a group of "Condition" steps.

A small scenario using "Multiple Condition" with SWITCH is shown below:

1. Create a new workflow definition with a container element "CARRID".
(A well known example for training purposes)

Set the "Properties" as import.

2. Double-click on the undefined step to create a step "Multiple Condition". The following screen appears:

3. Select the "Switch" option in the Type field.

4. Different types of conditions can be defined for each "Outcome". Please note that:

  • The conditions are defined in the given order
  • The first branch whose condition is evaluated TRUE is considered
  • If none of the conditions is TRUE, a default branch is taken ("Other values" in the definition)

Following are the conditions used in our example:

5. The workflow definition would appear as follows:

6. Insert an email step for each branch and check the output for various "Carrid" values.

Dig Deeper on SAP development and programming languages