You are on page 1of 9

Information Leads to Target

Thursday, April 2, 2009

SAP Workflow-Adding /manipulating outcome in a standard task


Author Information:
Name: Arnab Banerjee
Location: Kolkata
Technical Details:
Outcomes: Outcomes are defined as No of Paths which comes out of a
Workflow step. As for example if condition of Workflow has 2 outcomes
either YES or NO. Depending on the no of outcomes Workflow step can
be classified into
Activity :- Usually Single outcome
Condition :2 outcomes
Multiple Condition :- 2 or more than 2 outcomes
Condition:-

In an Activity step the Outcomes can be added using three techniques as follows:
Underlying Task level :Adding Terminating Events to the Tasks attached to the step
Underlying Business Object Level: Setting the System Container Result to the
underlying Business Objects methods attached to the tasks which in turn attached to the
steps from which outcomes come out.
Modeled Deadline: The Number of Outcome is added to the step in accordance with
the Deadline Modeled. As for example if 2 deadlines is modeled then 2 outcomes will
added to the step.
In this ICM we will discuss about first 2 Technique.
Underlying Task level: Adding Terminating Events to the Tasks attached to the step
1. Two Events Term_Event1 and Term_Event2 are created in Business Object
ZARN1_LR with an Existing Event Request Created.

2. A task with name zarn_task1 is created

Basic data are populated as follows:

Three Terminating Events which are created in Business Object ZARN1_LR


are added to the task

The task is inserted in the Workflow


template which is just created and is saved

Now if we view the Workflow template, we can see that 3 Outcomes with the
names Test Event 1, Test Event 2 and Leave Request Created appeared
as follows:

Business Object level


1. Business Object coding and Modification:

A Method is created with name GETSTATUS which is used to retrieve the


status of the Leave. Example of Leave Status including
A Leave Applied
B Pending Approval
C Leave rejected
D Leave Approved
E Leave Held
F User Cancelled
G Leave Changed
A container element Result is populated based on the values of table field
LEAVESTATUS.
A local variable L_RESULT is declared and is holding the Leave Status.
This variable holds the type of leave status
A System Container Result is set using the variable L_RESULT.
The process of Business Object coding /Changing is explained with the
screen shot below :
1. The Synchronous and Result Parameter need to be checked. Synchronous
method signifies that the Workflow will hold its execution until and unless
the method will completely executed. In other word the execution will be
serial. Result Parameter checkbox signifies that this method returns its
(main) result in a result parameter.

2. The Result parameter must have a result type. So result Type need to be
declared

<!--[if !supportLists]-->

3.<!--[endif]-->A System Container element result needs to be set. Screen


shot referring the entire Code for Method GETSTATUS is as follows :

2. Task Design:
1. Transaction Code PFTC is given Standard task is selected and let the
value entered is ZARN_OC followed by Create Button.

2. The task is created with the


following values and the method GETSTATUS of Business object zarn1_lr.

3.<!--[endif]-->We checked the task


and just save the task. The System automatically assign the Task Number as
99900525

3. Workflow Design:
We need to start the Workflow Design .This is just an one step Workflow to
demonstrate the Outcome manipulation (No of Outcome comes out of a
Step).
The process is as follows:
1. Transaction Code PFTC is used, Workflow Template is selected and we
provide the Workflow Abbreviation as ZOUTCOME and F5 Pressed

2. Basic data is filled and Workflow Builder Button is clicked .The Workflow
Builder Window appears as shown below

3. The task created earlier need to be added to the Workflow template.


Activity step type from the above shown step type window is selected and
the task ZARN_OC is placed in the Task text box.

4. The Workflow template is saved and we got the required Outcome as


shown below. Looking at the outcomes from the step it is obvious that the
outcomes are
Leave Applied
Pending Approval
Leave rejected
Leave Approved

Leave Held
User Cancelled
Leave Changed
These outcomes are same as the data type of the variable L_STATUS
(Domain ZEAVESTATUS) which is written in the GETSTATUS Method of
Business Object ZARN_LR

Below is the screen shot for value range of Domain ZLEAVESTATUS

A system defined outcome Processing obsolete automatically comes with


the step and is deactivated by default. This outcome can be activated.
Deactivated Status:

After Activating:

In Workflow template another outcomes is added:

You might also like