Author : Biswanath Guha
Company : TATA Consultancy Services
Introduction: In a workflow instance, sometimes it requires to create a user decision work item with different text, to handle different conditions . Basically, this texts are displayed if some condition are satisfied or if some flag are set/reset . Based on those text the approver/user will take the necessary action to resolve that issue. But generally it is not require to create different user decision work item to send individual message to the approver. This texts are viewed by the Approver in their SAP Business workplace.
In workflow, suppose, as a outcome of any activity in any step some flag has been set/reset. Based on those flag we will restrict the text display in user decision work item. For that, we need to write some logic in the text editor for displaying those text .
Step-by-step procedure how to handle work item text dynamically in SAP workflow.
Step 1 : Goto SWDD t-code. Create a new workflow.
Step 2. Insert User Decision Step . Enter a title and decision options (e.g. Accept/Reject) in the Decision tab. Click the green tick button.
Step 3. Create two element named Flag1 and Flag2 of single Character data type in the workflow container. Double Clicking in the workflow container. Then enter the name and its data type.
Step 4. Enter a initial value ‘X’ of Flag1. Also we can set the Flag2 value as ‘Y’ through set container operation.
Step 5. Double click on the user decision step ‘Approve my application’.
Step 6. Click on the task ‘Generic decision task’ .
Step 7. Go to ‘Container’ tab of the task and create two elements – flag1 and flag2. Set the property of both the element as Import and save it. As both the element will receive the values from the workflow.
Step 8. Now go to ‘Description’ tab and edit it.
Step 9. Now to insert the logic we need to change the editor . So go to menu and select view , then select the change editor.
Here , we can insert our logic . Before writing the logic we should ensure that we have selected command line /: for commands. We can pass any element using &var1&. It is like SAP Script commands.
As per above example , inserted a small logic :
/: IF &flag1& = ‘X’.
As the flag1 set to ‘X’.
/: IF &flag2& = ‘Y’.
As the flag2 set to ‘Y’.
Step 10. Save it and go back to user decision screen. It will be visible in Task Description.
Step 11. Bind Flag1 and Flag2 with the task.
Step 12. Execute it . We can also see the path of workflow through the log .
We can also check log by clicking ‘Workflow Log’.
Step 13. In Business workplace , a work item will be created with exact text which has been satisfied in that logic of the text editor.
Step 14. We can check this work item directly through SBWP t-code.