You are on page 1of 13

Table of Contents

1. Workflow Introduction .................................................................................................................................................................................................................... 2


2. Basics ................................................................................................................................................................................................................................................ 3
3. Type of Workflow steps ................................................................................................................................................................................................................... 4
4. Business Objects .............................................................................................................................................................................................................................. 8
5. Events ............................................................................................................................................................................................................................................... 9
6. Workflow -> Task -> BO, Binding ................................................................................................................................................................................................... 10
7. Work item details & SBWP............................................................................................................................................................................................................. 11
1. Workflow Introduction
A business process can consist of several steps. The workflow ensures that the right work is sent to the right person at the right time in the right
sequence with the right information.
Workflows are very useful for business processes that:
 Contain a sequence of activities.
 Reoccur in the same or similar forms.
 Involve several people or groups of people.
 Require considerable coordination.
Examples: Leave approval, Purchase Requisition creation, Purchase Order creation, etc.

Employee System Manager

Create Leave Application, Submit


Determine Manager

Send for approval

Take Decision

Check Decision

Approved Rejected

Yeah! Approved 

Make Changes &


Resubmit
2. Basics
a. Business Object/ Class
i. Business object (BO) is a collection of Keys, Attributes, Methods and Events for a particular business entity.
b. Workflow Definition
i. It is a sequence of steps which are to be followed and the agents that are required to do some of the steps.
c. Workflow Instance
i. It is a workflow run.
d. Task
i. A step in the workflow definition that can be executed by the system or an agent.
e. Work item
i. A step in the workflow instance, executed by the system or an agent.
f. Agents
i. The users which are required to process the work items.
g. Events
i. Events are actions that occur in the system.

Definition
Workflow: Ex. Material creation Approval Business Object: Ex. Material

Enter Material Details Key


Attributes
Methods
Decision Events
Approved Rejected

Create Material Notify Requestor

Instantiation
Workflow for Material 123 Workflow for Material 456

Enter Material Details Enter Material Details

Decision Decision
Approved Rejected Approved Rejected

Create Material Notify Requestor Create Material Notify Requestor


3. Type of Workflow steps
Every Step of a workflow will have an outcome. This is very important, as the workflow determines the next step on the basis of the outcome of the prev
ious step.

Container Operation Condition

Multiple Condition
Case Switch
Loop Fork

Send Mail User Decision


Wait Step Event Creator

Form Process Control


Activity
This is when you want to execute a method of the BO/ Class. First you create a task and then mention the task number in the Activity step.
Note: If a task has to be executed by an agent always mark it as a General task.
4. Business Objects
Business Object type contains methods, attributes and events which give a component based view of any Business Process.

Business object types are like an ABAP class. At runtime we instantiate or create runtime objects for any BO based upon the key fields we pass.

Every Business Object type will have

 Key fields
o The primary key. Ex. Material Number, PO Number, etc.
 Attributes
o Other properties of the BO
o If custom attribute is added, then code should be written to fetch the value from a table for that attribute
 Methods
o Actions that can be taken on this BO.
o Every method has its own parameters and exceptions
o The parameters have to be explicitly ‘set’ and ‘get’ from the container.
o For custom methods we need to define the parameters and the exceptions
 Events
o Notification of particular changes to the BO.
o If custom events are defined, then they need to be triggered at the right point.

Every Business Object has its underlying code in a program which determines the values of attributes when a BO is instantiated.

Delegation
A standard business object can be enhanced. A new Business Object is created with the standard BO as Supertype. As per inheritance, all properties of th
e Supertype are inherited by the new BO. However, the Supertype has to be delegated. This means that we use the name of the standard BO, even thou
gh we can refer to the custom attributes, methods and events of the new Business Object.

Macros for coding in Business Object:

INCLUDE <cntn01 Include file which has the definition of macros


>
SWC_GET_ELEMENT To read a single line variable from Container
SWC_SET_ELEMENT To write a single line variable in Container
SWC_GET_TABLE To read a multiline variable or internal table from Container
SWC_SET_TABLE To write a multiline variable or internal table in Container
5. Events
It is an occurrence of a change of state in an object, which is published throughout the system.
An event is a component of an object type. The list of possible events is defined with the relevant object type in the Business Object Builder.
Triggering Event: Event whose occurrence starts a task or a workflow
Terminating Event: Event whose occurrence stops a task
For Triggering and Terminating Events:
 The event must be entered as a triggering/ terminating event for the task or workflow that is to be started.
 The event linkage must be activated.
 A task or workflow can have several triggering events.
 Information from the event creation context can be passed in the binding from the event container to the task container or workflow container
Every Event has its own set of parameters, which are in the Event Container.
If custom events are added in the Business object then it has to be triggered at the right point. This can be done by:
Function module Event creation by calling function module SWE_EVENT_CREATE or
SAP_WAPI_CREATE_EVENT
ABAP classes Event creation by calling the method RAISE of the ABAP class CL_SWF_EVT_EVENT or by calling the method RAISE of
an instance of type IF_SWF_EVT_EVENT
Change documents Event creation when change documents are written
Transaction Code: SWEC
General status management Event creation upon status changes
Transaction Code: BSVW

All triggered events can be checked from the Event Trace.


6. Workflow -> Task -> BO, Binding
Binding is the import and export of elements from workflow to task to method and back from method to task to workflow.
Just as in function modules, the data types of the parameters should be same.
There are 5 different containers
 Workflow container
 Task container
 Method container
 Rule container
 Event container

Event Rule

Container Container

Workflow Task Method

Container Container Container

Data from workflow is sent to task and can be Data from workflow container is received in the While writing a code in method, import and ex
received from task via the container. task container and can be sent back to w port parameters have to be exclusively
orkflow container. ‘get’ and ‘set’ from the method container.

Data from task is also sent to method container


and received from method container.
7. Work item details & SBWP
A work item can be of the following types:

 Synchronous or Asynchronous
o Asynchronous indicates that the activity is not complete until a terminating event is received. When asynchronous methods are
executed, workflow does not continue to the next step until it receives an acknowledgement that the method has finished.
o A task that refers to an asynchronous object method must be defined with at least one terminating event. If you define an asynchronous
method, you must ensure that one of the terminating events is triggered after execution of the method.
o At runtime, the relevant work item is only terminated if one of the defined terminating events occurs.
Ex: In a task, a specific order is to be released for billing. In the task, call the (general) method Process order and enter the event billing_
block_deleted as the terminating event.
o Synchronous : At runtime, the relevant work item is generally terminated when the synchronous method has been successfully executed
Ex: The method Display for displaying an object.

 Background or Dialog
o Background: Work item that represents a single-step task at runtime whose execution does not require a dialog and, therefore, can be
controlled automatically by the system.
o Dialog: Work item that represents a task at runtime that requires interaction with the user.
o When a dialog work item is executed, the underlying object method of the task is called. The deadlines for executing dialog work items
are monitored.
o A dialog work item is displayed with ready status in the workflow inbox of the Business Workplace. It is removed from the integrated
inboxes of the other agents when the recipient reserves, executes, or processes this work item with other functions

SAP Business Workplace- SBWP

You might also like