SAP Virtual/Onsite Trainings

Document Categories:

What's New?

Contribute?

Sample Specs

What's Hot?

Web Dynpro for ABAP Tutorials 


Join the Mailing List
Enter name and email address below:
Name:
Email:
Subscribe  Unsubscribe 

Process a User Decision Programmatically at Background

By Anirban Bhattacharjee, KPIT Cummins and Infosystems

Purpose: This document will show how to process a branch in a User Decision step in workflow via an ABAP Program running at the background. The desired branch can be executed programmatically without the approver having to process the work item from the SAP Inbox (SBWP or UWL).

Business Scenario: There are some business requirements where a user decision step needs to be processed at the background. For example, if we need to process auto rejection when a user decision is not executed within a stipulated time, we can employ this technique. We can also create an ABAP Program by which an approver can also process mass approval / rejection of all user decision work items. So this technique can come pretty handy on different business requirements.

Process: The process to set this up is pretty simple.

We simply need to call a function module and pass the work item ID of the User Decision along with the decision branch.

We will discuss in details on how to achieve this functionality.

For our demo, I will consider two user decision work items that are sitting in a user’s business workplace.

We will process APPROVE for one and REJECT branch for the other without executing them from business workplace (SBWP) or UWL in portal.

The two work items in the business work place of the user are shown below

We now look each the user decision step in workflow

Thus the APPROVE will correspond to branch 0001 and REJECT will correspond to 0002. If the step had other decision options, they would get numbered as 0003, 0004 and so on.

Now to process the user decision via an ABAP program without executing the work item from SBWP or Portal UWL we need to run the following function module

SAP_WAPI_DECISION_COMPLETE

Let us see what importing data this function module needs

Here in the parameter WORKITEM_ID we will pass the work item ID of the User Decision Step.

For USER, the default is SY-UNAME. Hence if this function module is called in an ABAP Program and that program is executed at the background, it will pass the background system user ID.

The parameter DECISION_KEY decides which branch has to be processed in the User Decision Step. As explained before, we will pass 0001 for APPROVE and 0002 for REJECT.

This will differ from case-to-case and scenario-to-scenario.

Now fetching the work item IDs of the above two user decision work items from their workflow logs

Work Item ID is 2733503 (We will process APPROVE for this)

 

Work Item ID is 2733501 (We will process REJECT for this)

Running the function module with work item ID 2733503 (Process Decision Key 0001 for APPROVE)

Click here to continue..

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image