Escolar Documentos
Profissional Documentos
Cultura Documentos
Introduction
Workflow architecture
Task
Events
SAP Business
Workflow
Need of Workflow
2
I wonder who
approves buying
this stuff?
TIME IS
MONEY!!!
4
Time drags on . . .
Meanwhile, in
Mr. Managers office . . .
What shall I do next?
Drawbacks
Inefficiency.
Each lacks a way to trace where a task is.
Who executed or is executing it.
How much time it required.
Workflow
Architecture
Organisational
Level
Process Level
Business
Object
Level
Workflow Definition
Workflow Definition
A workflow definition describes the workflow process
Basic Data
Information about triggering events
Initial Values
Containers
Bindings
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.
Working with
Workflow
Workflow Design
Workflow Steps
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)
which are used for internal process
control and monitoring
(condition,
multiple condition, loop, etc)
2.Steps
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.
Web Activity
Selected container elements are posted using http protocol in XML or SOAP message
Subworkflow
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
Internal process
control (contd.)
WHILE Loop
Steps are processed repeatedly until the conditions
contained in the WHILE step no longer apply.
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
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 .
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.
Standard Task(TS)
Single step
Customer Task(T)
Tasks
Workflow Template(WS)
Multistep
Workflow Task(WF)
Similarities and
differences of task
types
Customer Task (Type T)
Workflow Task (Type WF)
Created by customer
customer
Client-dependent
Client-independent
Single step
Multistep
Tasks
Single-step tasks
Single-step tasks describe elementary business activities.
The multistep tasks form the business framework for a workflow definition
and each references one workflow definition.
Synchronous and
Asynchronous
Methods
Defining a Task
Background
SAPphones
Confirm end of
processing
Important Task
Attributes
General
-Workitems can be executed and forwarded to any SAP
User
Work Item
Executable single-step tasks are represented by work items at
runtime.
Object that represents a task or action in the workflow system at
runtime.
Depending on the work item type, some of these work items are
displayed in a user's work list. Other work items, on the other hand,
are only used and processed internally.
The work items are displayed in the integrated inboxes of their
selected agents, and can be reserved and executed from there.
Workitem Types
W: Dialog work item
Runtime display for a single step task with a user dialog
D: Missed deadline work item
The message recipient for the missed deadline is informed.
F: Workflow work item
Runtime representation of a multi step task
B: Background work item
Runtime display for a task executed in the background.
E: Wait step work item:
Runtime display for a wait step in the workflow definition.
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&
Interfaces
Key Fields
Key fields are designed to uniquely identify the
object type.
Attributes
Attributes provides access to data.
ABAP Dictionary Field
Virtual
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 :
Methods
lt
u
s
e
R
Import
Parameters
METHOD
Export
Parameters
io
pt
ce s
Ex n
independence:
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.
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)
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
Events
Events describe the change in the status of an object.
Workflow are usually started using events
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.
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.
Calling
Program
KNA1
ZKNA1
Method:
Method:
Change password
Change password
Objects in the
workflow
Posting document
Customer document
Vendor document
Asset document
G/L account document
Price change
Purchasing document
Sales document
Sales order
Generate events from status management
Archive Link Interface
IDoc outbound processing
Types of Containers
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.
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
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.
Role parameter container
Contains the elements required as input in connection with the
role
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.
What is a Container?
Container
Definition
Container
Instance
Field values
Application
Data
Multiline lists
of field values
Object
references
Definition
R/3
Runtime
Defining Container
Elements
Element name Data type
Description Multi-line Value
reference
Element
Element
Element
1
2
3
Database Field
Database Field
Object Type
Definition
Description
Description
Description
1
2
3
X
X
Runtime
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
Task
Method
Event
Role
Container Container Container Container
1
triggering
triggering
event
event
2
4
3
6
7
11
sync
sync
task
task
sync
sync
task
task
5
9
10
8
12
15
async
async
task
task
sync
sync
metho
metho
dd
sync
sync
metho
metho
dd
role
role
13
async
async
metho
metho
dd 14
terminating
terminating
event
event
Some Standard
Container elements
WI_Object_Id:
At runtime, the task container element
_WI_Object_Id contains the
reference to the object
which is processed in the object method.
_WI_Result :
If the customer task/standard refers
to a synchronous object
method the result of the
method is available in the element of the task container.
_Evt_Object :
This reference to the object initiating
the event allows you to
access the attributes of
this object
Container Marcos
Definition and Initialization
SWC_CONTAINER <Cont>
SWC_CONTAINER_CREATE <Cont>
Reading and Setting elements
SWC_GET\SET_ELEMENT <cont> <element> <value>
SWC_GET\SET_TABLE <cont> <element> <int_tab>
CUSTOMER_NUMBER =
CUSTOMERNUMBER
CUSTOMERNUMBER
SALES_ORGANIZATION
SALES_ORGANIZATION =
=
SALESORGANIZATION
SALESORGANIZATION
-----------.
IMPORTING
IMPORTING
RETURN = RETURN
TABLES
SALES_ORDERS
SALES_ORDERS =
=
SALESORDERS
SALESORDERS
EXCEPTIONS
EXCEPTIONS
OTHERS
OTHERS = 01.
CASE
CASE SY-SUBRC.
SY-SUBRC.
WHEN
" OK
WHEN 0.
0.
WHEN
"" to
WHEN OTHERS.
OTHERS.
to be
be
implemented
ENDCASE.
ENDCASE.
Writing/Reading
Container Elements
Defined as Field Values
SWC_SET_ELEMENT
SWC_SET_ELEMENT CONTAINER
'Return'
'Return' RETURN.
RETURN.
SWC_SET_TABLE
SWC_SET_TABLE CONTAINER
CONTAINER
'SalesOrders'
'SalesOrders' SALESORDERS.
END_METHOD.
END_METHOD.
Declaration:
Data: <object> TYPE SWC_OBJECT
Example
DATA: Customer type SWC_OBJECT
Definition:
SWC_CREATE_OBJECT<Object>
<ObjectType><ObjectKey>
Example
SWC_CREATE_OBJECT Customer KNA1
customer_number
Events
Event
Types of Event
Creation
Message
Message
Control
Control
Status
Status
Management
Management
Change
Change
Document
Document
Specific
Specific
HR Tables
HR Tables
ABAP Code
ABAP Code
In User Exit
In User Exit
Event Creation of
Change Document
Changing
Changing
Master
Master data
data
Change
Change logged
logged
using
using
change
change documents
documents
Event
Event creation
creation
(SWEC)
(SWEC)
Event
Event linkage
linkage is
is
done
done to
to connect
connect to
to
the
the workflow/
workflow/ task
task
Event Creation of
Status Management
Status
Status
Management
Management
Event
Event creation
creation
((BSVW
BSVW ))
Event
Event linkage
linkage is
is
done
done to
to connect
connect to
to
the
the workflow/
workflow/ task
task
Event Creation of
Message Control
Triggering an event using message control occurs with NAST.
Create
Create Message
Message type
type and
and define
define
workflow
workflow as
as transmission
transmission medium
medium
Create
Create Condition
Condition Table
Table
Create
Create Access
Access Sequence
Sequence
Assign
Assign Access
Access Sequence
Sequence
to
to defined
defined message
message type
type
Define
Define Condition
Condition Records
Records
Assign
Assign message
message type
type To
To procedure
procedure
SY-SUBRC==0.
0.
IFIFSY-SUBRC
COMMITWORK.
WORK.
COMMIT
ENDIF.
ENDIF.
Event Creators,
Receivers and Event
want
Linkage Anybody
this event?
Event
Published
Events
Linkage
Receivers
Creator
Event Trace
Transaction: SWEL
Menu Path :Basic menu -> Tools -> Business Workflow -> Development -> Utilities ->
Events -> Event Trace.
The Event trace needs to be switched on for the event to be visible in the trace
Organisational Structure
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
Create Organisational
Plan
CreateExecutive
ExecutiveBoard
Board
Create
CreateSales
Salesregion
region, ,Production
Production
Create
Administrator, ,Sales
SalesManager
Manager
Administrator
SalesManager
Managereastern
easternZone
Zone
Sales
AssignHolders
Holders
Assign
Assigntasks
tasks
Assign
CreateSales
SalesOrder
Order
Create
Position: Secretary
Position: Secretary
Position: FI administrator 1
Position: FI administrator 1
Position: FI administrator 2
Position: FI administrator 2
Manager job
Manager job
Task
User 1
User 1
Job for secretary
Job for secretary
Task
User 2
User 2
User 3
User 3
Job for FI employee
Job for FI employee
User 2
User 2
Task
Transaction - PPOCW
Agent
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.
Types of Agents
Possible agents
Possible agents
are a collection of
are a collection of
agents who qualify to
agents who qualify to
execute a work item
execute a work item
Processing
ProcessingAgents
Agents
Deadline
DeadlineAgents
Agents
Notification
NotificationAgents
Agents
Selected agents
Selected agents
are those possible
are those possible
agents who are
agents who are
elected to execute a
elected to execute a
task at runtime
task at runtime
Actual
Actualagent
agentisisthe
the
agent
among
those
agent among those
selected
selectedagents
agentswho
who
actually
processes
actually processesthe
the
work
workitem
item
Role Resolution
A role defines rules by which selected agents can be determined at runtime through
role resolution. Role resolution restricts the number of possible agents.
Role
Resolution
Role = Rules
(Supervisor of
User PBACON)
Selected Agent(s)
(Mr. Banning)
Standard Rules
A rule container is defined for each rule.
The rule parameters determine which information is required for the rule resolution
to be executed at runtime.
If an error occurs during rule resolution, setting the termination indicator for the rule
resolution determines how the workflow will continue:
Flag is selected - the workflow assumes an Error status and a notification is sent
to the workflow administrator.
Indicator is not activated - the workflow forwards this work item to ALL possible
agents.
Rule Basics
Transaction : PFAC_INS(Create)
Menu Path: Tools Business Workflow Development Definition tools Rules for Agent
Assignment Create/Change/Display.
Rule Definition in a
Activity Step Type
Various options to create standard rules :
1. Responsibility
2.
3.
4. Functions
Smith
Jones
Mr. Miller
Position : Administrator
HR
HR
Anna
George
Peter
Michael
David
Ross
William
Employee
Employee Names L-Z
Mr.
Mr. Andrew
Andrew
Position : Administrator
HR
Responsibility:
Example
Rules Container Definition
Containe
r
Element
AreasElement
of Responsibility
Value
From
A*
Which Value?
L*
Data
Type
Name
Unam Name
From
Name
e
To
K*
Z*
Employee
Which Agent
s from A-Z
Employee
Mr. Miller
Mr. Andrew
Evaluation path describes how to find one or more organizational objects based
On an initial organizational units
Example
Evaluatio
n path
Meaning
Superiors of a users
SAP_HOL
Holder of a position
Name
Data
type ref
Description
Exam
ple
OTYPE
OBJECOTYPE
Type of organizational
management object
US
OBJID
OBJEC_R
EALO
ID of organizational
management object
SMIT
H
ORG_A
WFSYST_ Organizational
USSM
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
Para Name
mete
r
Type
2.
3.
4.
Data
Type
Ref
Meaning
format
Exce
ption
NOBODY_F
OUND
Exception indication
no agents found
Laboratory
Sales Office
Tasks: Possible
Agents & Default
Roles
Possible agents
User
Position
Job
Default role
Business
Workplace
TASK
Triggering
Event
R/3 action
Workitem completed
Notification
Active
IDOC
Monitoring
Processing
Notification
of successful posting
E x c e p t io n
R a is e d
D e te r m in e
R e c ip ie n ts
U s e r/G ro u p
g e ts n o tifie d
v ia a w o r k ite m
R e s ta rt th e
p ro c e s s
F ix th e e r r o r
U s e r c h e c k s in b o x
a n d e x e c u te s th e
w o r k ite m
Yes
C a n e rro r b e
f ix e d ?
No
End
P u rg e th e ID o c
Active Monitoring
Active monitoring allows to specify threshold values for the state of the system
For e.g threshold can be on the number of IDocs in error or the time limit
Report Program RSEIDOCA can be executed periodically
Selection screen takes as input the threshold values and persons to be notified
When defined threshold is exceeded Single Step Task TS30200088 is executed
Notification of
Successful Posting
Necessary Steps:
Create new object type in Business Object Repository for IDOC; object
is child of IDOCAPPL
Workflow log-SWI2_FREQ
Maintain start
conditions for
workflow:
SWB_COND
Some Important
Diagnosis
Transaction
PFTC/SWDD: Task editor/Workflow Builder
SWU3: Verify Workflow Customizing
SWEL: Event Log
SWE2: Event type linkage
SWU0: Event simulation
SWI1: Work item list
OOCU: Customizing overview
SWUE/SWUS: Event/workflow trigger
Some Important
Tables