Uses of SWITCH in Multiple Condition


 

 Post Summary: The basic difference between Multiple Condition: CASE & SWITCH is like in CASE we can compare with a single value like CASE .. ENDCASE in ABAP but SWITCH in multiple condition allows to comparision with complex logical expressions like AND/OR.

The below post is a use case on how to use SWITCH in MULTIPLE CONDITION.

 

Step1. Create a class in SE24 and implement the interface IF_WORKFLOW so that this class can participate in workflow.

 

 

  Create an event and maintain the exporting parameter.
 
 

 

Implement the methods with below code.

 

Put the below code in the constructor method.

 

 

 

Put the below code which triggers the work flow and passes the sales doc type to the work flow.

 

Step2. Create a work flow in SWDD transaction.

 

Create two container elements as follows.

 

 

 

 

Go to the header of the work flow. Maintain the start event and finish the Binding. Activate and save. Go back.

 

 

 

 

As a step then create a multiple condition.

Provide the type as – SWITCH and for each outcome provide the comparision value.

The comaprision value can be a complex logical expression which is not possible in multiple condition type CASE.

 

Put a send mail step.

 

 

Activate the workflow.

 

 
 

Step3. Here id the Tx- SBWP 

 

 

Here is the small test program. Execute.

  

Step : provide the sales doc number and run.

Work flow started.

 

So here we have a mail in Tx- SBWP.

 

Go to Tx- SWI1 and check the log. Execute this.

 

Select and click on the icon.

Click on the graph icon.

 

So its a sales doc type is OR.

 

Run the program again with a different sales doc number.

 

 

here we have another mail.

 

Go to Tx- SWI1 and check the log of the work flow.

 

Select the icon.

 

And here is the work flow path in the multiple condition.

 


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s