Blogs

Dynamic user decisions in SAP Business Workflow
R. J. van Looy 
Business Card
Company: Avelon BV
Posted on Jan. 29, 2012 03:54 AM in SAP Business Workflow

Subscribe.Subscribe
Print. Print
Permalink Permalink
Share

Recently after a campaign from the workflow user groups of ASUG and VNSG SAP has released new enhancements for SAP Business Workflow. The most prominent enhancement is that SAP has finally enabled the current version of the ABAP editor when editing a BOR object in SWO1 (see note 1639167 for details). There are however a number of other improvements that can also be useful to a workflow developer and to promote these I have decided to showcase one: dynamic decision options in user decisions (see note 1648822 ).

Setup

To showcase this functionality I have created a simple workflow model with a single user decision step.

image

 

At design time the user decision has 3 decision options: Approve, Reject and Terminate process.

image

Enhancement

Without the enhancement this step would always show these options and to hide one of the options we would need to model a condition in the workflow and add a second branch with a second user decision. With the enhancement howver we can implement a workflow exit based on interface IF_SWF_IFS_DECISION_EXIT that allows us to change the decision options at runtime, which is then included on the program exits tab of the step definition in the workflow model.

 

image

 

My example implementation of the exit does two things.

  • Based on the container element AMOUNT in the workflow container the description of the approve option is changed to reflect who the next approver will be. For the showcase this is hard coded, but in a real life situation you can obviously add your own code to determine the approver based on the workflow context.
  • The option to terminate the process is removed based on the current user. Since the work item exit is called when the end user opens the work item, we know who the current user is and can for instance look at the authorization of the user. For the showcase the username of the current user is compared to a hard coded value (=my userid). 

The ABAP code of the method is shown below.

Result

The result of this is that if I execute the user decision workflow task and the container element AMOUNT has been set to 600, I will see the following screen.

 

image

 

Note that the option to terminate the process is not present and the description of the approve option has been changed to include the next approver.

Conclusion

Changing the decision options at runtime can be a very useful. It removes the need for modeling additional branches in the workflow when you want to hide decision options based on some business logic. By changing the decision texts on a case by case basis the decision making process can be more streamlined for the end user by including more specific information about the consequence of the option.

R. J. van Looy   is a SAP Workflow consultant at Avelon B.V. in the Netherlands


Comment on this articleAre you as excited as I am that SAP is investing in SAP Business Workflow again and would like like to see more of recent enhancements SAP has delivered for SAP Workflow? Leave a comment below.
Comment on this weblog
Showing messages 1 through 5 of 5.

Titles Only Main Topics Oldest First

  • Thank you
    2012-01-30 08:14:38 Sampath Adavelly Business Card [Reply]

    Hi, Nice to know that SAP has released the new Editor functionality for BOR objects. Very well explained blog.


    The note number is 1639167. The link takes you to right number but number shows 1639197.

  • Fantastic!
    2012-01-29 05:30:56 Susan Keohan Business Card [Reply]

    Hi R.J,
    Thanks so much for bringing this new functionality to light! I am sure many SAP WF developers will be grateful to see your implementation.
    Yes, of course I am excited that SAP is showing SAP WF some love!
    Keep up the good work,
    Sue

Showing messages 1 through 5 of 5.