SAP Business Workflow IBM

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 113

IBM Global Business Services

SAP Business Workflow - Basic

Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

DAY TOPIC
DAY1(4 hours) Introduction to Workflow

Workflow Architecture
Basic Workflow Template
Business object overview
Basic Business Object Program
Hands on (Create a Subtype and Delegate)
Question and Answer/Recap
DAY2(4 hours) Tasks

Detailed discussion about the different steps involved in a WF Template


Container and bindings
Workflow Events (Change Doc and ABAP coding)
Hands on (Create task and Workflow Template)
Question and Answer/Recap
DAY3(4 hours) Organizational Plan, Role Resolution (Responsibility + Function Module)

Types of Agents
Hands on (Raise Events and Rule as agent)
Basic Monitoring transaction(SWEL, SWI2_FREQ)
DAY4(4 hours) Hands on -Design workflow on Flipcharts and present to class. Class to be divided in 3 - 4 groups

Question and Answer/Recap

2 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

SAP Business Workflow

SAP Business Workflow® is a cross-application tool that makes it possible to


integrate business tasks/processes between applications.

This tool was introduced in R/3 Release 3.0A, and received a substantial facelift
in the Enjoy Release, 4.6A,which warranted the new name Workflow Builder.

3 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Need of Workflow

2 I wonder who
approves buying this
stuff?
Hmm ! Time to put in a 3
purchase requisition request

TIME IS MONEY!!! I guess I’d better send off


some inter-
inter-office mail to
ask the approvers to
5 approve my requisition.

4 Meanwhile, in
Time drags on . . . Mr. Manager’s office . . .
“What shall I do next?”

Workflow Basic Training © 2007 IBM Corporation


IBM Global Business Services

Drawbacks

Inefficiency.

Each lacks a way to trace where a task is.

Who executed or is executing it.

How much time it required.

Workflow Basic Training © 2007 IBM Corporation


IBM Global Business Services

Why SAP Workflow

Workflow ensures that the right work is sent to the right person at the
right time in the right sequence with the right information.
Tool for the automization of business processes
Not tied up to any paricular application
Operates uniformly accross applications
Coordinate all participating tasks
Provide users with active support
Intelligent routing

6 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

How to use Workflow - (Common Examples)


Workflow is best suited for document routing
Example: If we want to route a candidate’s resume to a set of people

Workflow is best suited for automating business process


Example: If we want various Purchase Orders to be approved by heads of various
department

Workflow is best suited for participation in data creation by a collective set of people
Example: Vendor address by front end, Vendor account by General Accounting

Workflow should not be used solely for notification purpose


Example: Send notification when a SO is created, Invoice is blocked etc.

7 Workflow Basic Training © 2007 IBM Corporation


IBM Global Business Services

SAP Workflow- (BEST Business Practices)

Speed Time to Market


Accelerate the execution of SAP Transactions by routing information quickly
to users for immediate action; Ability to substitute; Ability to Forward Work
Items
Improve Quality and Decision Making
Deliver accurate information to Process Participants; both within the
Enterprise and Externally; Ability to attach documents and Objects to a
work item

Improve Operational Efficiency

Prevent duplication of effort; Pre-defined Business Process and Actors


Eliminate time wasted waiting to take action .

Ensure Compliance
Monitor and Control Processes; Deadline Monitoring and
Escalation Procedures
8 Workflow Basic Training © 2007 IBM Corporation
IBM Global Business Services

SAP Business Workflow - Basic

Workflow Architecture

Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Workflow Architecture

Organisational
Level

Process Level

Business
Object Level

10 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

SAP Business Workflow - Basic

Workflow Definition

Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Workflow Definition

A workflow definition describes the workflow process

Workflow definition consists of

1. Basic Data
2. Information about triggering events
3. Initial Values
4. Containers
5. Bindings

12 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Workflow Builder
The workflow definition is created in the Workflow Builder and displayed
graphically in a network.

Transaction: SWDD
Menu Path: Tools Business Workflow Development Definition tools
Workflow Builder.

13 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Workflow Definition - Steps

A workflow definition is made up of individual modular steps.

14 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Example: Workflow Definition

15 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

How are Workflows Created in a System

Within workflow templates, there is a key with the following structure:


- A WS task abbreviation for the workflow template
- An 8-digit sequence number

From the structure of the 8-digit number, the system knows whether the
template is a standard template delivered by SAP or one created by the
customer.

Customer-defined templates start with the prefix number that was defined in
Customizing for the system and client.

16 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

How workflow gets executed

17 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Workflow Toolbox - SWUS

Transaction: SWUS.
Menu Path: Tools -> Business Workflow -> Development -> Runtime Tools-
Tools-> Start
Workflow (Test Environment).

18 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

SAP Business Workflow - Basic

Business Object

Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Object Types & Workflow

SAP Business Workflow has been developed on an object-


oriented basis.

The business object types are identified and described with their
object methods in the Business Object Repository(BOR) of the
R/3 System.

Generally one object is created in the system and then processed in


a workflow over several steps by various employees.

20 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Object Types & Objects

Workflow deals with object types. Object types are definitions of


data. In order to access database data, workflow uses the object
type interface.

Most of the information represented by object types is available in


the ABAP/4 Dictionary.

Objects are created at runtime and are specific instances of defined


object types.

Many object types are delivered by SAP. In addition, the customer


can create new object types or extend SAP objects by creating
subtypes (child objects). New customer objects or subtypes may
be desired if the delivered SAP object does not contain all the
characteristics (attributes) or processing options (methods) desired.

21 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Object Type - Definition

22 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Interfaces

Interfaces are a combination of attributes, methods, and events to be used


in common among multiple object types. The purpose of interfaces is to
define common functionality in one object type, and to assign that common
functionality via an interface to multiple object types across the Business
Object Repository. This avoids redundancy of data and functionality
definition.

Each new object type automatically receives the interface IFSAP, the SAP
standard interface. IFSAP provides every object type with the following:
Method Display
Method ExistenceCheck
Attribute ObjectType

23 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Key Fields

Key fields are designed to uniquely identify the object type.

If the key field has a data type reference of a dictionary table field, the runtime
system will look to that table field to retrieve the value of the key when
processing the object. When the key field is created, the ABAP/4 program code
is generated automatically when the object type is generated.

24 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Attributes

Attributes provides access to data.

ABAP Dictionary Field Virtual

25 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Methods

Methods incorporate the permitted functions available for an object.


Methods have importing and exporting parameters as well as exceptions.

Methods can be created using :

26 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Methods

u lt
es
R

Import METHOD
Export
Parameters Parameters

Ex
ce
pt
io
ns
27 Workflow Basic Training Jan-2007 © 2007 IBM Corporation
IBM Global Business Services

Methods - Call attributes


–Dialog / or background :

Execution of the method is via a work item in a user’s integrated


inbox or in background by the workflow runtime system. Background
methods cannot use messages or exceptions because they cannot
be processed by the background system and will result in
termination of the program.

–Synchronous / Asynchronous

•Synchronous methods finish executing before handing control back


to the calling program. These types of methods can return export
parameters, results and exceptions. Asynchronous methods do not
return control to the calling program immediately. Once executed,
they depend upon events to communicate the results of the method
back to the calling program. Asynchronous object methods cannot
have results, export parameters or exceptions.

28 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Methods - Call attributes

Result:

Synchronous methods may return an export parameter as a result. A


result can be defined like a dictionary field or an object type .

Instance independence:

Indicates whether an object reference is passed to the method by binding


at the time of execution. Methods that generate and return an object
reference, such as Create, or methods that generate a report listing should
be instance independent.

29 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Import /Export Parameters

•The method parameter container contains references to all import, export


and result parameters which need to be exchanged back and forth between
the calling program (single-step task) and the method. Binding is necessary
between the single-step task and the method parameter container to
accomplish the data transfer.
•Import parameters are those values which are necessary to execute the
method. Import parameters are retrieved from the container CONTAINER
using the macro instructions SWC_GET_ELEMENT (single-line) or
SWC_GET_TABLE (multiline).
•Export parameter values are passed to the container CONTAINER using the
macro instructions SWC_SET_ELEMENT (single-line) or SWC_SET_TABLE
(multiline). The result parameter is passed to the CONTAINER element
RESULT via the same macro instructions.

30 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Exceptions

•Error handling is accomplished through the use of method exceptions


(synchronous methods only).

•The workflow definition can branch according to these possible error


states and allow for subsequent steps to handle these conditions.
Messages and exceptions cannot be used with background methods
because they will terminate the program.

•Number of the exception:


• 0001-1000: exceptions defined for interfaces
• 1001-7999: application-specific exceptions (free for SAP
development)
• 8000-8999: exceptions raised by the object manager
• 9000-9999: exceptions defined by the customer (free for
customers)

31 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Exceptions

•Exceptions are implemented within a method, between the macro


instructions BEGIN_METHOD and END_METHOD.
–EXIT_RETURN Code Variable1 Variable2 Variable3 Variable4.
• Code = the 4-digit number of the exception
• Variable1 through Variable4 correspond to up to 4 variables
which can be derived from the message issued with the
exception.
•The following exceptions (for temporary errors) are also available to
allow exiting of the program:
–EXIT_OBJECT_NOT_FOUND = object not found
–EXIT_CANCELLED = cancelled by the user

32 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Events

Events describe the change in the status of an object.


Workflow are usually started using events

33 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Object Type - Release Status


Not accessible at runtime.

Only in test or internal use, possibly unstable.

Released for use by the customer.

The functionality has been replaced. The old


functionality is still supported for two releases.

34 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Subtype

The subtype inherits all attributes, methods and events of the supertype and is
open for new customer-specific attributes, methods and events. The key fields
of the supertype and subtype must be identical. This means that any methods
and attributes defined on the parent can be executed and accessed on the
child object.

35 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Delegation

Transaction: Menu Path: SW01


Tools Business Workflow - Development - Definition tools - Business Object Builder -
Settings - Delegate

This delegation is powerful because it lets you implement your own business logic
without modifying any SAP code. As long as the objects are properly delegated,
your method will be executed.

KNA1 ZKNA1
Calling Method: Method:
Program
Change password Change password

36 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Objects in the workflow

37 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Some common Business Objects and Interfaces

BKPF Posting document


BUS2019 Customer document
BUS2020 Vendor document
BUS2041 Asset document
BUS2069 G/L account document
BUS2029 Price change
EKKO Purchasing document
VBAK Sales document
DRAW Drawing Object
BUS2032 Sales order
BUS1001 Material Master
BUS1010 Customer Credit Account
BUS1022 Fixed Asset Object
BUS1065 Employee
BUS2012 Purchase Order
BUS2078 QA Notifications
IFSTATUS Generate events from status management
IFARCH21 Archive Link Interface
IFIDOCOUT IDoc outbound processing

38 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

SAP Business Workflow - Basic

Business Object Programming

Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Business Objects – Programming


Key Features
BOR programming makes extensive use of macros.
The macro instructions required for programming are incorporated via the include <object>.
Attribute programming
Database Field
Indicator that the attribute value is determined directly from the content of a database field
Code gets automatically generate
Virtual Field
Requires Implementation in the program of object type
ex :- GET_PROPERTY Total CHANGING CONTAINER.
DATA : Price TYPE Zprice,
Qty TYPE Zqty.
IF object-total is initial.
SWC_GET_PROPERTY self ‘Price’ Price.
SWC_GET_PROPERTY self ‘Quantity’ Qty.
Object-Total = Price * Qty.
ENDIF.
SWC_SET_ELEMENT CONTAINER ‘Total’ object-total.
END_PROPERTY.
40 Workflow Basic Training Jan-2007 © 2007 IBM Corporation
IBM Global Business Services

Business Objects – Programming cont…


For multiline attribute the structure will look like
GET_PROPERTY <AttributeID> CHANGING CONTAINER.
……code
SWC_SET_TABLE CONTAINER <AttributeID> InternalTable
END_PROPERTY.

Methods Programming
BEGIN_METHOD <MethodID> CHANGING CONTAINER.
…..code
END_METHOD.
Ex : BEGIN_METHOD display CHANGING CONTAINER.
SET PARAMETER ID ‘MAT’ FIELD object-key-material.
CALL TRANSACTION ‘MM03’ AND SKIP FIRST SCREEN.
END_METHOD.

41 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Writing/Reading Container Elements Defined as Field Values

BEGIN_METHOD GETLIST CHANGING CONTAINER.


DATA:
CUSTOMERNUMBER LIKE BAPI1007-CUSTOMER,
SALESORGANIZATION LIKE BAPIORDERS-SALES_ORG,
------
------
RETURN LIKE BAPIRETURN,
SALESORDERS LIKE BAPIORDERS OCCURS 0.
SWC_GET_ELEMENT CONTAINER 'CustomerNumber' CUSTOMERNUMBER.
SWC_GET_ELEMENT CONTAINER 'SalesOrganization' SALESORGANIZATION.
------
------.
SWC_GET_TABLE CONTAINER 'SalesOrders' SALESORDERS.

CALL FUNCTION 'BAPI_SALESORDER_GETLIST'


EXPORTING
CUSTOMER_NUMBER = CUSTOMERNUMBER
SALES_ORGANIZATION = SALESORGANIZATION
------
------.
IMPORTING
RETURN = RETURN
TABLES
SALES_ORDERS = SALESORDERS
EXCEPTIONS
OTHERS = 01.
CASE SY-SUBRC.
WHEN 0. " OK
WHEN OTHERS. " to be implemented
ENDCASE.

SWC_SET_ELEMENT CONTAINER 'Return' RETURN.


SWC_SET_TABLE CONTAINER 'SalesOrders' SALESORDERS.
END_METHOD.

42 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Business Objects – Programming cont…

An object reference can be created in method using SWC_CREATE_OBJECT


macro
BEGIN_METHOD <MethodID> CHANGING CONTAINER.
… ..code
data : user type swc_object.
SWC_CREATE_OBJECT user ‘User’ <user id>.
SWC_GET_PROPERTY user ‘Name’ <name field>.
… code
END_METHOD.

43 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Business Objects – Programming cont…


Exception is methods can be raised using the macro EXIT_RETURN
EXIT_RETURN <Exception #> <Var1> <Var2> <Var3> <Var4>
Where <Exception #> is the exception number defined for method

Macros for Method Exceptions


EXIT_RETURN <Exception #> <Var1> <Var2> <Var3> <Var4>
Returns the exception

44 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Container Marcos

Definition and Initialization

SWC_CONTAINER <Cont>
SWC_CONTAINER_CREATE <Cont>

Workflow Basic Training © 2007 IBM Corporation


IBM Global Business Services

SAP Business Workflow - Basic

Task and Workflow Template

Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Single and Multistep Tasks

Transaction : PFTC
Menu Path -> Tools -> Business Workflow -> Development -> Definition tools ->Tasks

References one object type


Single step method and displays one step
in the business process

Tasks

Represents the business


process and is a sequence of
Multistep individual tasks and control
steps

47 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Single-step tasks

Single-step tasks describe elementary business activities.

Single-step tasks operate on an object and refer to one object method


each

Single-step tasks are linked to their possible and permitted agents


whose organizational assignments are described in the organizational
plan of the enterprise.

Executable single-step tasks are represented by work items at runtime.

48 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Workflow definition - Multistep tasks


A workflow definition has a modular structure consisting of individual steps which
are linked together.

The multistep tasks form the business framework for a workflow definition and
each references one workflow definition.

A step in a workflow definition can be an activity.

An activity always refers to one task (= single-step task or multistep task).

An activity with one simple triangle refers to a task.

An activity with three triangles refers to a workflow (subworkflow).

49 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Task Definition – Synchronous and


Asynchronous Methods

50 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Defining a Task

51 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Settings for Tasks

Task executed in At runtime user can


background create attachments
depending on
object method User explains explicitly
that work item is no longer
is to be processed

Background Confirm end of


SAPphones processing

The workflow dials


the telephone
number attached to
the current customer
52 Workflow Basic Training Jan-2007 © 2007 IBM Corporation
IBM Global Business Services

Workitem Text

Title of workitem in the Business Workplace

First create the workitem text and position the cursor to include a varible

Choose the 'Insert variable' icon under the workitem text

Example
Processes request from &_WI_Object_ID.CreatedBy&

53 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

SAP Business Workflow - Basic

Workflow Steps

Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Workflow definition steps

Workflow definition is made up of individual steps. When creating a step in a


workflow definition, the step type must be specified first.

There are
1. Steps which refer to business activities (activities & user decision)

2. Steps which are used for internal process control and monitoring
(condition, multiple condition, loop, etc)

55 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Business Activities Steps

Activity
Can be a single step task with basic business functionality
Can be a multi-step task, which reference to a workflow definition

User Decision
This provides an opportunity for user interaction with the system.
The response to this decides the selection of the subsequent step.

Subworkflow
An activity which refers to a workflow rather than a task

56 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Internal process control Steps

Condition
Branch on the basis of control information from the runtime dependent
context of the workflow.
An attribute of this object can also be accessed for condition evaluation
Condition evaluation can be done by
Field comparison e.g constants , object attribute, system fields

Multiple condition
In contrast to condition, multiple condition makes it possible for the
workflow definition to branch in more than two branches.

For evaluation of the multiple condition, the value of the basis of


comparison is checked at runtime against the comparison values and
branched accordingly.

57 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Internal process control (contd.)

Until Loop
Steps are processed repeatedly until the condition contained in the UNTIL step
is true.

Fork
Used for parallel processing branches.
Only a part of the parallel processing branches actually has to run to continue
the workflow.
Dynamic parallel processing is also possible

58 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Internal process control (contd.)

Send mail
Text entered in this step can be used to send a mail to the agent assigned

Container operations
Used to perform arithmetic operation of value assignment to workflow
container elements using constants and data in the workflow container .

59 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Internal process control (contd.)

Event Creator
An event is created when this step in the workflow is reached.
Other workflows can be started as a reaction to the event created in this
step. This event must be the triggering event of the relevant workflow tasks
and/or templates.

WAIT for event


Used to stop the whole execution of the workflow until the event is created
in the system.
Used to wait for events for parallel processing

60 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

SAP Business Workflow - Basic

Containers and Bindings

Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Types of Containers

Workflow Basic Training © 2007 IBM Corporation


IBM Global Business Services

Workflow Container

The workflow container contains


workflow-specific system variables
and other elements which are
defined explicitly.
As part of the definition of the
workflow task, the import and export
parameters of the workflow are
defined as elements of the workflow
container.
When the workflow is defined in the
workflow editor, elements can also
be added to the workflow container.
These elements are then "local
variables" within a workflow definition
and can be used, for example, to set
up a counting loop.

63 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Task Container

Each task container already


contains the workflow system
variable and any additional elements
for the method parameters of the
referenced object method.

You have to add additional elements


to the task container for additional
values are required for variable
replacement in the work item text or
in the long texts

64 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Other Types of Containers

Event parameter container


Contains an element which can take the (object) reference to the object
whose change of status is announced via the event.

Rule parameter container


Contains the elements required as input in connection with the rule
resolution to be run at runtime.

Method parameter container


Contains elements which will be required as import and export parameters
in connection with the method execution.

65 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Binding

A binding is simply the art of of pouring selected container elements from


one container into another.

The binding editor is available when defining:


Workflow definitions
Triggering events
Workflow steps
Workflow steps ( Standard roles/ Object methods with parameters)

The binding editor always references the container to receive the


application data. Binding definitions can reference:
Constants
Variables (container elements)
System fields

66 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Container & Dataflow

Workflow Task Role Method Event


Container Container Container Container Container
1
2 triggering
event
3 4
sync sync
6 task 5 method

7 9
sync sync
task method
11 10

8 role
12 13
async async terminating
task method event
15 14
Workflow Basic Training © 2007 IBM Corporation
IBM Global Business Services

SAP Business Workflow - Basic

Events

Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Event

An event describes a possible status change for an object in the SAP


System.

Before an event can be used in a workflow, it must be defined in the


Business Object Repository for the object type.

Events must be triggered explicitly. The application itself can be the


triggering agent.

69 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Types of Event Creation

Status Message
Change
Management Control
Document

ABAP Code
Specific
In User Exit
HR Tables

Workflow Basic Training © 2007 IBM Corporation


IBM Global Business Services

Using Customizing for event trigger

Menu Path :Basic menu -> Tools -> Business Workflow -> Development -> Definition tools
-> Events

71 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

1. Event Creation of Change Document

Change logged Event linkage is


Changing Event creation
using done to connect to
Master data (SWEC)
change documents the workflow/ task

72 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

2. Using ABAP Code

This is using done by writing custom code e.g. by using SAP FM like
SWE_EVENT_CREATE inside user exits, BADI etc.

73 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Event Creators, Receivers and Event Linkage

Anybody want
this event?

Event

Published
Events

Linkage

Receivers Creator
Workflow Basic Training © 2007 IBM Corporation
IBM Global Business Services

Type Linkage Entry

Transaction: SWE2
Menu Path :Basic menu -> Tools -> Business Workflow -> Utilities > Other tools >Event linkage

Workflow Basic Training © 2007 IBM Corporation


IBM Global Business Services

SAP Business Workflow - Basic

Agent Assignment and Role Resolution

Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Agent

Agent is an executor of a work item.

Agent is responsible for executing a task in a workflow.

Agent is determined by the system either through organizational chart


or directly if user is assigned as agent for a particular task.

If the agents of the individual workflow steps are determined using the
customer-specific organizational chart, your agent assignment in the
workflow remains flexible to change.

77 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Types of Agents

Possible agents Processing Agents


are a collection of
agents who qualify
to execute a work Deadline Agents
item

Notification Agents

Selected agents
Actual agent is the
are those possible
agents who are agent among those
elected to execute a selected agents who
task at runtime actually processes the
work item

78 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Tasks: Possible Agents & Default Roles

Possible agents
User Position Job Org. Unit Person

Default role
Business
Workplace
TASK

The workplace displays the


work items for a agent

Workflow Basic Training © 2007 IBM Corporation


IBM Global Business Services

How are Selected Agents Determined With and Without a


Default Role?

Possible Agents
Triggering
Event
Task definition with
no default role

Task definition with


default role

Workflow Basic Training © 2007 IBM Corporation


IBM Global Business Services

How are Selected Agents Determined With a WF Agent?

Triggering
Event All possible agents who
qualify to execute task
Task definition with
no default role

Task definition with


default role

Step definition at workflow


defn. level with an agent
specified. This overrides
default role at task defn. level

Workflow Basic Training © 2007 IBM Corporation


IBM Global Business Services

Rule Basics

Transaction : PFAC_INS(Create)
Menu Path: Tools – Business Workflow – Development – Definition tools – Rules for Agent
Assignment – Create/Change/Display.

Each rule gets a 8 digit generated by the system prefixed with AC


Rules can be tested using PFTC or by function module ‘RH_GET_ACTORS’

82 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Rule Definition in a Activity Step Type

Various options to create standard rules :

1. Responsibility (Pure configuration no ABAP coding)


Defined Value ranges are assigned to Agents
Data is filled from workflow container at runtime

2. Evalution paths (Pure configuration no ABAP coding)

3. Organizational data (Pure configuration no ABAP coding)


Jobs , positions

4. Functions to be executed – ABAP Code – Function Module

83 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

1. Rule Definition with Responsibility: Example

Employee Names A-K

Jones Smith

Mr. Miller George Anna


Position : Administrator Mr. Andrew
Peter
HR Position : Administrator
Michael HR
David

William
Ross

Employee Names L-Z

84 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Rule Definition with Responsibility: Example

Rules Container Definition


Container Element Data Type Name

Element Uname Name

Areas of Responsibility
Value From From To Name Mr. Miller
A* K* Employees from A-Z

L* Z* Employees from L-Z Mr. Andrew

Which Value? Which Agent

85 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

2. Role Resolution with Function Modules

Role resolution with function module should be done only for complex criteria

Here are the basic steps:


1. A function module with the following interface is created
Parameter Name Data Type Ref Meaning
Type
Table AC_CONTAINER SWCONT Incoming rule container
Table ACTOR_TAB SWHACTOR Outgoing list of agents in agent format
Exception NOBODY_FOUND Exception indication no agents found

2. Create a rule setting the type ‘Function to be executed’.


3. Enter the created function module name
4. Create container elements.

Workflow Basic Training © 2007 IBM Corporation


IBM Global Business Services

SAP Business Workflow - Basic

Organization structure

Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Organizational Structure Business Scenario

An organizational plan in SAP describes the organizational


structure of a company.

The workflow system finds the agents of the individual tasks by


evaluating the organizational plan

The functions to create and maintain organizational plans are part


of the Personnel Planning and Development (PD) part of the SAP
HR module

You must connect this organizational structure to the workflow

88 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Organizational Management

Organizational units contain positions, occupied by employees.

Jobs are abstract descriptions of task assignments.

Positions can be linked to jobs. They inherit all the tasks assigned to
that job.

Users. A user is an SAP logon user ID. It thus represents a single


person.

Persons. A person is a specific employee created in the HR module.

Workflow tasks can be assigned to organizational units, positions,


jobs or users.

The workflow system uses organizational structure to route work items


to the correct recipients

89 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Create Organisational Plan

Transaction: Menu Path: PPOCW


Tools Business Workflow - Development - Environment - Organizational Management -
Simple Maintenance – Org plan basic data - Create

CreateExecutive
Create ExecutiveBoard
Board
Createroot
Create rootorganizational
organizationalunit
unit

CreateSales
Create Salesregion
region, ,Production
Production
Additionalorganizational
Additional organizationalunits
units

Administrator, ,Sales
Administrator SalesManager
Manager
Createjobs
Create jobs

SalesManager
Sales Manager––eastern
easternZone
Zone
Createpositions
Create positions

AssignHolders
Assign Holders

CreateSales
Create SalesOrder
Order
Assigntasks
Assign tasks

90 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Transaction - PPOCW

91 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Workflow Monitoring

Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Event Trace- SWEL

93 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Event Trace - SWELS

The Event trace needs to be switched on for the event to be visible in the trace

94 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Event Log Details


Event linkage/instance Linkage not active.
Full key of the business object is not available to create the instance

The event had a start condition defined and the same was not met.
The evaluation of the check FM condition resulted to FALSE

The event started a workflow/task successfully.

95 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Workflow log-SWI2_FREQ

96 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

SWI2_FREQ Contd.
The agents who have participated in the workflow is displayed here.
For all the background steps – agents is WF-BATCH

The screen displays the status of individual Workflow instance for the selected workflow

97 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Workflow log-SWI2_FREQ – Normal View


This displays the
technical view of the
workflow log

This displays the


graphical view of the
workflow log

This icon indicated a


workflow – parent and
subsequent sub-
workflows

On clicking this the selected/possible and


excluded agents can be viewed if the dialog step
is in READY status. If status in COMPLETED then
the selected agents is no longer available.

98 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Agents involved in Workflow

The agents who have participated in the workflow is displayed here.


For all the background steps – agents is WF-BATCH

99 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Workflow log-SWI2_FREQ – Graphical View


The green line indicated in which step the workflow is currently lying

100 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Workflow log-SWI2_FREQ- Technical View

This displays the status of workflow or task. A complete blue cube denotes Complete status.
A partial blue cube denotes that the task is In Process status. A completely white cube denotes
a task in Ready status. A partially red cube denotes a task in Error.

The value for each container (WF or task) is populated can be viewed

101 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Some Important Jobs


SWWDHEX For deadline monitoring

SWWERRE For error Monitoring

SWEQSRV For Event Queue Delivery

102 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Workflow Explorer - SWDM

103 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Workflow QUIZ

Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

QUIZ
SAP workflow can be used
(i) When work process have to be run repeatedly
(ii) Process involve several people or departments
(iii) Process include a range of activities
(iv) All of the above

SAP Workflow allows process owners


(i) To keep an eye on deadlines
(ii) Provides statistics on the length of time to complete work processes
(iii) Determine the workload with regard to individual participants
(iv) All of the above
(v) All of the above except (iii)

What do you understand by the term agents in SAP workflow.

Agent assignment in SAP workflow can be done using


(i) Organization structure
(ii) Single users
(iii) Security Roles
(iv) All of the above
105 Workflow Basic Training Jan-2007 © 2007 IBM Corporation
IBM Global Business Services

QUIZ
Workflow builder is used for building
(i) Workflow template
(ii) Business object
(iii) Organization structure
(iv) Task

SAP Workflow is triggered by


(i) Events
(ii) Business Object
(iii) Task
(iv) Method

What do you understand by workitem

State difference between workitem and notification

SAP Workflow can handle escalation - True/false

106 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

QUIZ
SAP Workflow uses the existing transactions and functions of the SAP System to form
new business processes – True/False

A background step in a workflow needs agent assignment – True/false

Workflow step which is executed automatically by the system is known as


(i) A background step
(ii) An dialog step
(iii) A internal control step
(iv) None of the above

Business Workflow provides a number of tools for


(i) Defining Workflow
(ii) Analyzing workflows
(iii) Monitoring and reporting workflow
(iv) All of the above

SAP provides several workflows that map predefined business processes which can
be used with simple configuration - True/False

107 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

QUIZ
Which transaction code displays the sap business workflow menu?
a) SWDD b) SWUD c) SWLD d) SWED

What is the transaction to make basic workflow customizing configurations in a system?


a) SWU5 b) SWU6 c) SWUD d) SWU3

When we make a subtype of a standard sap business object which of the following
cannot be modified in the custom object.
a) Interfaces b) Key fields c) Attributes d) Events

Which of the following elements does the interface IFSAP not provide across all business
object types.
Method ExistenceCheck b) Attribute ObjectType c) Event Created d) Method display

Which of the following parameters is not mandatory when we create an event using
the function module swe_event_create?
a) Object key b) Object type c) Event name d) Event parameter(s)

108 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

QUIZ
To create a start condition for an event based on a parameter A, A must be?
a) A key field of the business object for the event
b) Event parameter for that specific event
c) Any field in the lead table for the business object type
d) An attribute of the business object.

8) Which transaction is used to check event type linkages?


a) SWEL b) SWED c) SWI2 d) SWE2

9) Which of the following objects cannot have a instance linkage with an event?
a) workflow template b) standard task c) wait for event step d) create event step

10) Which is the very first step to build a parent workflow template?
a) Attach a triggering event b) Create object type container c) Create the workflow
definition in the builder d) Assign a workitem text to the template.

109 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services
QUIZ
Which of the following workflow steps may be simulated to a CASE ENDCASE statement
in ABAP programming.
User decision b) Condition c) Multiple condition d) Fork

While checking the event trace if we get an entry with a red icon then this signifies?
The event has not been triggered b) the event type linkage is missing c) the event has raised an
exception d) the workflow has gone into error

In the workflow log which of the following information is not available?


Individual task statuses b) the event had a start condition or not c) the user who triggered the
workflow d) the task container values at runtime

When we use rule resolution to determine agents, the rule container receives its data from?
workflow container b) task container c) method parameters d) event container

In which of the following workflow step we cannot check a condition to determine the
process flow.
a) Loop until b) Fork c) Wait for event
110 Workflow Basic Training Jan-2007 © 2007 IBM Corporation
IBM Global Business Services

QUIZ
Why do we need an event linkage?

How are exceptions raised in a business object program for a method?

How are the import parameters accessed in a program.

When should rules using responsibility be used.

State difference between single and multi task. Give a example when each can be used

What do you understand by subworkflow . State the steps of creating a subworkflow.

What is the transaction for customizing?

What is the different between possible agent, selected agent and actual agent?

What it _EVT_OBJECT

111 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

QUIZ
In a particular workflow scenario suppose that I have 5 agents A, B, C, D & E.
Agents A, B & C are defined as possible agents for a dialog task (through agent
assignment in the task), agents A, C, D & E are determined through the default rule
specified in the task definition and agent E is specified as an excluded agent in the
step definition of the dialog task in the workflow template. Then which of the
following is false.

Agents C & D can be selected agents for the step


Agent A can be a selected agent for the step
Agent E is a possible agent but cannot be the selected agent for the task
Agent B can be a selected agent for the step

Which of the following macros will not work in an asynchronous method.


swc_get_property self
swc_get_element container
swc_set_element container
swc_create_object

112 Workflow Basic Training Jan-2007 © 2007 IBM Corporation


IBM Global Business Services

Thank you

Questions?

Comments?

Suggestions?

Within Enterprise

External Business Partners

113 Workflow Basic Training © 2007 IBM Corporation

You might also like