Working with Multiple Condition

1. Create a workflow from SWDD T.code.




2. Create a loop( until ) step.


3. Set a counter element LV_COUNTER inside the Loop( Until ) Step. 




For a Detailed Explanation on how to create a: 

4. We have to select the ‘Multiple Condition’ to create multiple branches for execution on different conditions.

step_select_multiple condition.PNG


5. Multiple condition step.

  • First we have to enter ‘step name’.
  • Select type as ‘Switch’.
  • And create conditions as shown below.

  1. Here we are creating three conditions.

  •  First reminder(a branch created in workflow layout with the same description) is sent if the value of the counter (lv_counter) is 3.
  • Second reminder(a branch created in workflow layout with the same description) is sent if the value of the counter (lv_counter) is 2.
  • Third reminder(a branch created in workflow layout with the same description) is sent if the value of the counter (lv_counter) is 1.

multiple condition first screen.PNG

  • To fill the condition section follow the steps as shown below.
Condtion_in multiple condition.PNG

    • First, enter the outcome name.
    • Then click on the condition to provide the condition necessary to execute this branch.
    • Conditions provided to each outcome will be shown in the condition preview column.

  •  Also provide other value outcome names.
    • Here we can handle condition which does not match any of the conditions defined in the Comparison table.
    • It just acts like when others in ‘case statement used in an ABAP code’.

other values in multple conditions.PNG

  • Save this step and go back to the workflow layout screen.

Multiple condition in layout.PNG


6. Now next process will be creating ‘send mail steps’ for all three reminders.

  • Select the ‘Send Mail’ step.
    • In the mail step, there is a tab named ‘Mail’.
    • Here we have the Recipients section:

      • Recipient types: The recipient type will allow us to choose recipients depending on  Organization Unit, job, position, work center or user.
      • We can also choose the recipient as ‘WF initiator’ (Workflow initiator- the user who starts the workflow).
      • Expression: Here we can browse the workflow container element which will hold the email addresses of the valid recipients during runtime.

  • Now Create the ‘the Send Mail’ step in the First Reminder branch as shown below.

send_mail.PNG

  • Now create the ‘Send Mail’ steps for Reminder 2 and Remainder 3.

7. Now the workflow layout looks as shown below.

loop_with miltiple condition.PNG


8. Our final step will be to create the ‘Container Operation step’ to decrement the counter ‘LV_COUNTER’.
  • Click on create the ‘Container Operation step’.
  • The First view of the ‘Container operation’ step looks as follows.
    • In this step, we have to fill in step name, outcome name, etc.
    • There is a check box to include or exclude this step in the workflow log(After execution).

Container_operation_first_screen.PNG

  • Now we have to fill the decrement expression in the ‘Operation’ section as shown below.
    • Here we are decrementing the value count of the variable ‘LV_COUNTER’ (Initial value is ‘3’).
      • Result Element: The Result Element is the variable or Parameter in which the result is stored after calculation.
      • Assignment: This section provides  ‘=’ and ‘<-‘ symbols to assign to the result.
      • Expression Section: Here we can provide a ‘Workflow Container’ element or we can directly assign numeric values.
      • Operator Section: This section consists of ‘Arithmetic Operators’ which we can assign to the expression.
        • Examples: +,-,/,*.    

Container_operation_expression.PNG

  • Save it and go back to the workflow layout.

whole workflow.PNG

     

9. As our initial value of the counter is ‘LV_COUNTER = 3’, this loop will execute three times and all three reminders will be sent to WF_INITIATOR’s Inbox( T code: SBWP).


10. Check, Save and Activate.

check.PNG

activate.PNG


11. Now the workflow is ready to execute.

  • Execute the workflow.
  • After execution we will find 3 remainder mails in SBWP ( SAP business workplace ).

Comments

Popular posts from this blog

Working with Container Operation and Loop (Until) Steps - PART1

Working with Fork

Working with Container Operation and Loop (Until) Steps - PART2