Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Hello Friends,

In this post, we will go through a step-by-step example of using Fork to implement Parallel Processing in a Workflow.

In our example we will have 2 parallel processes where user can finish a task just by displaying a Material.

Out of these 2 parallel processes if any single process is finished the Workflow is completed.

Steps for designing your Workflow:


    1. Go to the Transaction SWDD – Workflow Builder. You will be presented with a screen as shown in Figure 1 below else you may create a new Workflow using Menu Bar → Workflow → New (Ctrl + Shift + F5).


Figure 1: Creating a new Workflow


    2. Double-click on Undefined Step. You will be presented with a pop-up window for Step Selection. Select Fork and click Continue (Enter) as shown in the Figure 2.


Figure 2: Selecting Fork Step Type


    3. You will get a screen to enter details for the Fork Step you have just selected as shown in the Figure 3. Enter the following values:

Step Name                       Fork Step - Display Material in Parallel

Parallel Branches            2

Necessary Branches        1

Figure 3: Values entered in Control Tab for Fork Step


Click on Transfer and to graphic Button.


    4. Now in the overview screen of the Workflow you can see the 2 parallel branches each with having an undefined step. Now double-click on the Undefined Step in left branch (you can choose right branch also) as shown in Figure 4.


Figure 4: Parallel Branches in Fork with Undefined Step


    5. You will be presented with a pop-up window for Step Selection. Select Activity and click Enter as shown in the Figure 5.


Figure 5: Selecting Activity Step Type in Left Branch


    6. You will get a screen to enter details for the Activity Step you have just selected as shown in the Figure 6. In this example we will create a new Task by clicking on drop-down Button (on the left of the Task input text field) and choosing Create Task.


Figure 6: Creating a New Task for Activity Step


    7. In the next screen shown in Figure 7 enter the following values in the Basic Data Tab -

                  Abbr.                      DemoForkTask

Name                     Display the Material

Work item text       Hello, %UNAME%, Click me to display the Material

Object Category     BO

Object Type           BUS1001

Method                  DISPLAY

Click on Enter. In the Transfer missing elements from the object method? pop-up window click on Yes Button. Press Save Button (Ctrl + S). Select a Local Object in the Create Object Directory Entry pop-up.


Figure 7: Values entered in Basic data Tab for creating Task


    8. In the Description Tab, Select Text Type as Completion Text and click on Change Text Button. Enter the text as ‘The Material Task has been completed’ (without quotes) and click on Back Button (F3). Press Save Button (Ctrl + S) as shown in Figure 8.


Figure 8: Completion text for the Task


Use Menu Bar → Additional Data → Agent Assignment →Maintain to Maintain Agent Assignment

In the screen for Maintain Agent Assignment go to Menu Bar → Edit →Attributes (F8). A pop-up windows will appear. Select General Task Radio Button and click on Transfer (Enter) Button. Click Back Button (F3). Press Save Button (Ctrl + S). Again click Back Button (F3). In the pop-up window suggesting Container Elements and Binding click on Continue (Enter) Button.


    9. In the Control Tab for Agent choose the Expression: Workflow Initiator. In the Details Tab uncheck Advance with Dialog check-box. In the Notification Tab choose the Expression: Workflow Initiator.


    10. In the Control Tab note the Task Number Click on Transfer and to graphic Button as shown in Figure 9.


Figure 9: Task Definition completed for Displaying Material


    11. In the overview screen of the Workflow, double-click on the Undefined Step and repeat Step 5. In the screen to enter details for the Activity Step you have just selected enter the Task you have just noted in Step 10. Press Enter and in the pop-up window suggesting Container Elements and Binding click on Continue (Enter) Button. Repeat Step 9 and click on Transfer and to graphic Button. Click on Continue (Enter) Button.


    12. On the Left of the Screen, Click on drop-down Step Types That Can Be Inserted and choose Workflow Container. Navigate and double-click on Element BUS1001. In the windows in the Properties Tab, check on the Import check-box and press Confirm (Enter).


    13. Press Save Button (Ctrl + S). In the pop-up for naming of new Workflow Template enter the following values :

                   Abbr.                     ZDemoForkWF

Name                     Demo Fork Workflow

    14. Now your Workflow will look like something similar to Figure 10 and is ready for Testing.  Use Menu Bar → Workflow → Test (F8).

Do not worry! The Workflow will be automatically activated. :cool:


Figure 10: Look and Feel of Your Workflow Ready for Testing


Testing your Workflow

    1. Provide an input value for a Valid Material as shown in Figure 11. Click on Continue (Enter)


Figure 11: Input Value as Valid Material for Testing Workflow


    2. Use Menu Bar → Workflow → Test (F8). You will get a Success Message in the Message Area of your Screen with text similar to Task started under work item ID <xxxx> (current status: In Process)

    3. Use Menu Bar →Environment → Business Workplace (Shift + F6). Check the Workflow Folder in the Inbox Folder. You can see two new items in your Workflow Folder as shown in Figure 12. Clicking on any item will process one parallel branch of the Workflow.


Figure 12: Click on any item to display the Material


    4. After you have displayed the material you can see only row item is remaining. But if you click this remaining item, it will also be deleted and you will get the message as shown in Figure 13.


Figure 13: Message displaying that the Work item is deleted or ended


Instead of this step, if you would have refreshed your Workflow folder, the remaining item will be not visible anymore.

The second item is automatically ended because while designing your Workflow in Fork Step, we have mentioned as only 1 Necessary Branch for End Condition (see Step 3).

You can also see your Inbox for notification. Note there is only a single notification.


Now you can press the Back (F3) Button to go to the Test Screen of your Workflow.


    5. Go to Menu Bar → Goto → Workflow Log (F5). As shown in Figure 14, you can see that the Status of a Workflow Item is Logically Deleted. :grin:

Figure 14: Workflow Log


If you like this Post; please do share it and let us know your comments :smile:

2 Comments