Time approval has been a hot topic for many of the HR projects. By default, you can use SAP delivered workflow task to send an approval mail to manager’s workplace inbox. With Duet Workflow Template 1.0 released with Duet 1.5 SP1, you can develop a Duet Time Approval scenario to send directly the approval email and task to manager’s Outlook inbox.
Duet Workflow Template 1.0 offers in SAP backend workflow pattern configuration settings and ABAP custom handlers, for Outlook UI a Visual Studio Workflow Template Configuration Tool to define approval objects UI.
In the following blogs, I will demonstrate how to use Duet Workflow Template 1.0 to develop a Duet Time Approval scenario that allows managers to approve or reject employee’s time from their Outlook.
In blog part two, I will show you how to customize the ABAP outbound and inbound custom handlers to control business content sent to Outlook and handle decisions that come back to SAP backend.
In blog part three, I will define the Outlook approval mail and task UI that managers should see in Outlook.
Ok, now let’s start part one.
1. Define Workflow Template for Time Approval
Duet workflow template 1.0 is developed in conjunction with SAP workflow engine. It uses SAP business workflow template but it doesn’t require modification to SAP workflow template. You can use either SAP delivered business workflow templates or custom developed workflow templates.
Duet workflow template 1.0 supports developing Duet approval scenarios based on workflow templates that include user interaction tasks, such as approve and reject. If your workflow template doesn’t have explicit user decision tasks, it will require more custom development work on the inbound process handling.
In this step of the example, I created a workflow template in SAP system for time approval. The transaction I used is SWDD.
The most important step in creating this workflow template is to define a user decision task. The task will send time entries to manager for approval. As you can see from the above picture, that is the workflow task with a question mark.
The user decision task has two decisions – approve or reject. This will match the two buttons (Approve and Reject) in Outlook approval mail/task UI. The Visual Studio Configuration Tool in Duet Workflow Template 1.0 doesn’t allow definition of a third button, such as negotiate button on top of approve and reject buttons. So approver will only have two options for decision. The decision key from Duet approval email/task by default will be 0001 for approve and 0002 for reject. They match the sequence I defined in the workflow template decision options.
Wait a minute; you said employee’s time entries will be sent to manger for approval based on the workflow task you just defined, but how and when the sending is triggered?
Good question. SAP workflow template itself won’t do that job. I used an ABAP report batch job and an ABAP class in the ERP system to finish those tasks. The purpose of the ABAP report is to collect time entries based on employee ID, find responsible managers and send this information to SAP workflow template. The report batch job can be scheduled to run daily, weekly, or monthly, so that manager can receive employee’s time entries in a timely manner based on your business requirement. For the ABAP report, please see sample code as below.
The ABAP class includes event that triggers execution of SAP workflow template. It also contains subsequent methods that will be called when approval decision is passed from Outlook. Once called, the method changes time entries status to 30 for approved and 40 for rejected, respectively.
As you can see, up to here there are no Duet specific settings included in the process of creating time approval workflow template. That is why I said using of Duet workflow template 1.0 doesn’t require Duet specific modification to SAP business workflow.
2. Configure Duet Workflow Pattern in SAP
Now that we have a time approval workflow template, we are ready to configure the SAP system to send employee’s time entries to manager‘s Outlook inbox for approval.
There are two steps.
Step one is to define a task filter in SAP Extended Notification Framework. This will make sure Duet workflow pattern only pick up those workflow items that are created by our time approval workflow template, considering there are many different kinds of workflow items created everyday in our SAP backend. SAP Extended Notification Framework is the base for the backend components of Duet Workflow Template 1.0. You can search and learn more detail about Extended Notification Framework in help.sap.com.
Step two is to define Duet properties for time approval workflow items picked up in step one, and assign corresponding outbond and inbound custom handlers. Custom handlers are nothing but function modules that handle outbound and inbound processings of approval objects. I will talk about that in the second part of the blog. Duet Workflow pattern configuration can be accessed with Duet Implementation Guide (via transaction SIMGH).
2.1 Define Task Filter to Pick Up Workflow Items
Go to +transaction SIMGH. +Select +Workflow Pattern Customization -> Maintain Workflow Filter Settings. +
The filter configuration setting here will allow SAP Extended Notification Framework to pick up workflow items relevant to Duet workflow tasks defined. There are two pre-defined filters, OSP_FULL and OSP_Delta.
OSP_FULL filter will select all work items from all tasks (including those already sent)
OSP_Delta will select only new and changed work items of all tasks
As you recall I defined a user decision task earlier for the time approval workflow template. The workflow task ID is TS000008267. Therefore I inserted that task ID under OSP_FULL filter as the below screenshot. So that the workflow items associated with TS000008267 will be picked up by Duet task filter.
Repeat the same steps and add the same task for filter OSP_Delta.
2.2 Enrich Workflow Items with Duet Properties
The below steps are the main configuration for Duet Workflow Template. It is rather simple once you know how to do it.
Up to this point all the steps are workflow engine and Extended Notification Framework related. Starting from here I will define the Duet properties and custom handlers API for the time approval workflow template. With these settings, the time approval workflow items will become email or task when they reach Manager’s Outlook inbox.
Go to transaction SIMGH. Select Workflow Pattern Customization -> Workflow Pattern Customization. !https://weblogs.sdn.sap.com/weblogs/images/38003/image008Custom.png|height=235|alt=image|width=500|src=https://weblogs.sdn.sap.com/weblogs/images/38003/image008Custom.png|border=0!
2.3 Define Action Entries
The last step in Duet Workflow Template configuration is to copy actions for your Duet workflow application from default workflow management. The action entries will determine what transition will trigger the Create/Delete/Update of Outlook objects in recipients Inbox. For example, the original status of a workflow item in Duet book-keeping table is blank. Once the workflow item is recorded by Duet item selection batch job, the status of the workflow item will be changed to “C”, which means New Workflow Item. In the action transition table a transition from blank to “C” should trigger action “Create”, therefore an Email object will be created and sent to approver’s Outlook inbox. Likewise, you can define condition for sending of an Outlook task object to manager, or condition of sending of notification email to employee once manager approves the time entries.
Ok. That is all for the Duet time approval part one. I will continue with custom handlers in part number two.