Vous êtes sur la page 1sur 117

IBM Global Services

SAP Business Workflow

Copyright IBM Corporation 2003

IBM Global Services

Course Content
Introduction Workflow architecture Workflow Definition and workflow Template Workflow steps in details Task Business Objects and Methods Container Structure and Container Programming Events Organisational structure and role resolution Different types of Agent Workflow and ALE
| Copyright IBM Corporation 2003

IBM Global 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.

Copyright IBM Corporation 2003

IBM Global Services

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

TIME IS MONEY!!!
4

I guess Id better send off some inter-office mail to ask the approvers to approve my requisition.

Time drags on . . .

Meanwhile, in Mr. Managers office . . . What shall I do next?

Copyright IBM Corporation 2003

IBM Global Services

Drawbacks
Inefficiency. Each lacks a way to trace where a task is. Who executed or is executing it. How much time it required.

Copyright IBM Corporation 2003

IBM Global 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

Copyright IBM Corporation 2003

IBM Global Services

SAP Business Workflow Architecture

Copyright IBM Corporation 2003

IBM Global Services

Workflow Architecture
Organisational Level

Process Level

Business Object Level

Copyright IBM Corporation 2003

IBM Global Services

Workflow Definition

Copyright IBM Corporation 2003

IBM Global Services

Workflow Definition
A workflow definition describes the workflow process

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

Copyright IBM Corporation 2003

IBM Global 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.

Copyright IBM Corporation 2003

IBM Global Services

Workflow Definition - Steps


A workflow definition is made up of individual modular steps.

Copyright IBM Corporation 2003

IBM Global Services

Example: Workflow Definition

Copyright IBM Corporation 2003

IBM Global 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.

Copyright IBM Corporation 2003

IBM Global Services

Working with Workflow

Copyright IBM Corporation 2003

IBM Global Services

Workflow Design

Copyright IBM Corporation 2003

IBM Global Services

How workflow gets executed

Copyright IBM Corporation 2003

IBM Global Services

Workflow Toolbox - SWUS


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

Copyright IBM Corporation 2003

IBM Global Services

Workflow Steps

Copyright IBM Corporation 2003

IBM Global 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)

Copyright IBM Corporation 2003

IBM Global 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. Document from template - PA document is created from a document template using variables in the text that are filled during program execution. Web Activity - Selected container elements are posted using http protocol in XML or SOAP message

Subworkflow
-

An activity which refers to a workflow rather than a task


| Copyright IBM Corporation 2003

IBM Global 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.

Copyright IBM Corporation 2003

IBM Global Services

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

Copyright IBM Corporation 2003

IBM Global 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 .

Copyright IBM Corporation 2003

IBM Global 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

Copyright IBM Corporation 2003

IBM Global Services

Task & Workflow Definition

Copyright IBM Corporation 2003

IBM Global Services

Tasks are used to describe a business process

Standard Task(TS) Single step Customer Task(T) Tasks Workflow Template(WS) Multistep Workflow Task(WF)

Copyright IBM Corporation 2003

IBM Global Services

Similarities and differences of task types

Customer Task (Type T) Workflow Task (Type WF) Created by customer customer With validity period Client-dependent Must be linked to its possible possible agents when it is defined

Standard Task (Type TS) Workflow Template (Type WS) Created by SAP and Without validity period Client-independent Must be linked to its agents when it is defined

Copyright IBM Corporation 2003

IBM Global Services

Single and Multistep Tasks


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

Single step

References one object type method and displays one step in the business process

Tasks
Represents the business process and is a sequence of individual tasks and control steps
Copyright IBM Corporation 2003

Multistep

IBM Global 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.

Copyright IBM Corporation 2003

IBM Global 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).

Copyright IBM Corporation 2003

IBM Global Services

Task Definition Synchronous and Asynchronous Methods

Copyright IBM Corporation 2003

IBM Global Services

Defining a Task

Copyright IBM Corporation 2003

IBM Global Services

Settings for Tasks


Task executed in background depending on object method At runtime user can create attachments User explains explicitly that work item is no longer is to be processed Confirm end of processing

Background SAPphones

The workflow dials the telephone number attached to the current customer
| Copyright IBM Corporation 2003

IBM Global Services

Important Task Attributes


General -Workitems can be executed and forwarded to any SAP User General Forwarding Allowed -Workitems can be forwarded to any user General Forwarding Not Allowed -Work items can be forwarded to possible users Forwarding not allowed -No forwarding allowed

Copyright IBM Corporation 2003

IBM Global Services

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.

Copyright IBM Corporation 2003

IBM Global Services

Work Items Types

Copyright IBM Corporation 2003

IBM Global Services

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.

Copyright IBM Corporation 2003

IBM Global 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&

Copyright IBM Corporation 2003

IBM Global Services

Task and its various component in SAP

Copyright IBM Corporation 2003

IBM Global Services

Business Object Definition and Implementation

Copyright IBM Corporation 2003

IBM Global Services

Object Types & Workflow


SAP Business Workflow has been developed on an objectoriented 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.

Copyright IBM Corporation 2003

IBM Global 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.

Copyright IBM Corporation 2003

IBM Global Services

Object Type - Definition

Copyright IBM Corporation 2003

IBM Global 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

Copyright IBM Corporation 2003

IBM Global 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.

Copyright IBM Corporation 2003

IBM Global Services

Attributes
Attributes provides access to data. ABAP Dictionary Field Virtual

Copyright IBM Corporation 2003

IBM Global 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 :

Copyright IBM Corporation 2003

IBM Global Services

Methods
lt u s e R

Import Parameters

METHOD

Export Parameters

io pt ce s Ex n
Copyright IBM Corporation 2003

IBM Global Services

Methods - Call attributes


Dialog / or background : Execution of the method is via a work item in a users 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.
| Copyright IBM Corporation 2003

IBM Global 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.

Copyright IBM Corporation 2003

IBM Global 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.

Copyright IBM Corporation 2003

IBM Global 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)

Copyright IBM Corporation 2003

IBM Global 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

Copyright IBM Corporation 2003

IBM Global Services

Events
Events describe the change in the status of an object. Workflow are usually started using events

Copyright IBM Corporation 2003

IBM Global 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.

Copyright IBM Corporation 2003

IBM Global 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.

Copyright IBM Corporation 2003

IBM Global 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 Calling Program Method: Change password

ZKNA1 Method: Change password

Copyright IBM Corporation 2003

IBM Global Services

Objects in the workflow

Copyright IBM Corporation 2003

IBM Global Services

Business Object Repository (BOR)


Transaction: Menu Path: SW01 Tools Tools - Business Workflow Defination tool Busniness Object Builder

Copyright IBM Corporation 2003

IBM Global Services

Containers and Bindings


- Workflow -

Copyright IBM Corporation 2003

IBM Global Services

Types of Containers

Copyright IBM Corporation 2003

IBM Global 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.
| Copyright IBM Corporation 2003

IBM Global 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

Copyright IBM Corporation 2003

IBM Global 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. 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.

Copyright IBM Corporation 2003

IBM Global Services

What is a Container?
Container Definition Container Instance R/3

Field values Multiline lists of field values Object references Definition Runtime

Application Data

Copyright IBM Corporation 2003

IBM Global Services

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

Copyright IBM Corporation 2003

IBM Global 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

Copyright IBM Corporation 2003

IBM Global Services

Container & Dataflow


Workflow Container Task Method Event Role Container Container Container Container
2 3 6 7 11 4

triggering triggering event


5

sync task task sync task task


8 9

sync sync metho metho d d sync metho metho d d

10

role role
13

12 15
|

async async task task

async async metho metho d d 14

terminating event event


Copyright IBM Corporation 2003

IBM Global Services

Container Data Structure

SWC_CONTAINER

Declare Container

SWC_CREATE_CONTAINER

Initialize Container

SWC_RELEASE_CONTAINER

Release Container

Copyright IBM Corporation 2003

IBM Global Services

Writing/Reading Container Elements Defined as Field Values


Container Instance Variable Variable Internal Table Internal Table SWC_GET_ELEMENT SWC_SET_ELEMENT SWC_GET_TABLE SWC_SET_TABLE SWC_DELETE_ELEME NT
delete value

Copyright IBM Corporation 2003

IBM Global Services

Writing to Container Elements Defined as Object Types


Container Instance: CONTAINER Object Element: MATRL

Declare a variable as the key of your object: DATA: MATNR LIKE MARA-MATNR. Fill the key with a value: MATNR = 123456. Declare a variable as an object: DATA: MATERIAL TYPE SWC_OBJECT.

Create an instance of your object in your program: SWC_CREATE_OBJECT MATERIAL MARA MATNR.
Object type from B.O.R. Key of object you previously defined

ransfer value of your object instance to the container element: SWC_SET_ELEMENT CONTAINER MATNR MATERIAL
| Copyright IBM Corporation 2003

IBM Global Services

Reading Container Elements Defined as Object Types


Declare a variable as an object: DATA: MATERIAL TYPE SWC_OBJECT. Read value of container element to your object: SWC_GET_ELEMENT CONTAINER MATRL MATERIAL. Declare a variable as the key of your object: DATA: MATNR LIKE MARA-MATNR. Read the object type key into your variable: SWC_GET_OBJECT_KEY MATERIAL MATNR. Declare a variable to hold the object type: DATA: OBJTYPE LIKE SWOTOBJID-OBJTYPE. Obtain the object type from your object type variable: SWC_GET_OBJECT_TYPE MATERIAL OBJTYPE.
| Copyright IBM Corporation 2003

Container Instance: CONTAINER

Object Element: MATRL

IBM Global Services

Writing to Container Elements Defined as Multiline Object Types


Declare a variable as an internal table object: DATA: REQITEMS TYPE SWC_OBJECT OCCURS 0. Since this internal table has no header, declare a work area: DATA: REQITEM TYPE SWC_OBJECT. Declare key fields of the object (e.g. called PREQKEY) and fill them (e.g. within a select loop). Create an instance of your object for each table line: SWC_CREATE_OBJECT REQITEM BUS2009 PREQKEY. Append the object instance to the internal table: APPEND REQITEM TO REQITEMS. Once the internal table is filled, transfer the internal table to the multiline container element: SWC_SET_TABLE CONTAINER PRItems REQITEMS.
| Copyright IBM Corporation 2003

Container Instance: CONTAINER

Element: PRItems

IBM Global Services

Reading Container Elements Defined as Multiline Object Types


Read value of multiline container element into your internal table object: SWC_GET_TABLE CONTAINER PRItems REQITEMS. Declare your object: DATA: REQITEM TYPE SWC_OBJECT. Declare a variable to hold the object type: DATA: OBJTYPE LIKE SWOTOBJID-OBJTYPE. Loop through your internal table object REQITEMS into individual REQITEM entries. Perform operations as needed. Use this macro to get the keys of each entry: SWC_GET_OBJECT_KEY REQITEMS PREQKEY Use this macro to get the object type of each entry: SWC_GET_OBJECT_TYPE REQITEMS OBJTYPE.
| Copyright IBM Corporation 2003

Container Instance: CONTAINER

Object Element: PRItems

IBM Global Services

Events

Copyright IBM Corporation 2003

IBM Global 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.

Copyright IBM Corporation 2003

IBM Global Services

Types of Event Creation

Change Document

Status Status Management Management

Message Message Control Control

Specific Specific HR HR Tables Tables

ABAP ABAP Code Code In In User User Exit Exit

Copyright IBM Corporation 2003

IBM Global Services

Using Customizing for event trigger


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

Copyright IBM Corporation 2003

IBM Global Services

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

Copyright IBM Corporation 2003

IBM Global Services

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

When user status changes to E002 , event is triggered


| Copyright IBM Corporation 2003

IBM Global Services

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
| Copyright IBM Corporation 2003

Maintain the processing program RSWEMC01 with the FORM routine CREATE_EVENT for the output type EVEN and transmission medium 9.

IBM Global Services

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.
CALL FUNCTION 'SWE_EVENT_CREATE' EXPORTING OBJTYPE = OBJTYPE OBJKEY = OBJKEY EVENT = EVENT CREATOR = APPLICANT START_WITH_DELAY = ' ' IMPORTING EVENT_ID = EVENTID TABLES EVENT_CONTAINER = CONTAINER EXCEPTIONS OBJTYPE_NOT_FOUND = 01. IF SY-SUBRC = 0. COMMIT WORK. ENDIF.
| Copyright IBM Corporation 2003

IBM Global Services

Event Creators, Receivers and Event Linkage


Anybody want this event?

Event Published Events Linkage

Receivers
|

Creator
Copyright IBM Corporation 2003

IBM Global Services

Type Linkage Entry


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

Copyright IBM Corporation 2003

IBM Global Services

Event Trace
Transaction: SWEL Menu Path :Basic menu -> Tools -> Business Workflow -> Development -> Utilities -> Events -> Event Trace.

Copyright IBM Corporation 2003

IBM Global Services

Organisational Structure

Copyright IBM Corporation 2003

IBM Global 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

Copyright IBM Corporation 2003

IBM Global 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
| Copyright IBM Corporation 2003

IBM Global Services

Create Organisational Plan


Transaction: Menu Path: PPOCW Tools Business Workflow - Development - Environment - Organizational Management Simple Maintenance Org plan basic data - Create Create root organizational unit Create Executive Board

Additional organizational units Create jobs Create positions Assign Holders Assign tasks
|

Create Sales region , Production Administrator , Sales Manager Sales Manager eastern Zone

Create Sales Order


Copyright IBM Corporation 2003

IBM Global Services

Assigment Workflow Task Organizational Objects


Organizational Organizational unit: unit: FI FI department department Position: Position: Head Head of of FI FI depatment depatment Manager Manager job job User User 1 1 Job Job for for secretary secretary Position: Secretary Secretary User User 2 2 Position: Position: FI FI administrator administrator 1 1 Task Task

User User 3 3 Job Job for for FI FI employee employee Task

Position: Position: FI FI administrator administrator 2 2 User User 2 2

Copyright IBM Corporation 2003

IBM Global Services

Agent Assignment and Role Resolution


- Workflow -

Copyright IBM Corporation 2003

IBM Global 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.

Copyright IBM Corporation 2003

IBM Global Services

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

Processing Processing Agents Agents Deadline Deadline Agents Agents Notification Notification Agents Agents

Selected Selected agents agents are are those those possible possible agents agents who who are are elected elected to to execute execute a a task task at at runtime runtime

Actual agent is the agent among those selected agents who actually processes the work item
Copyright IBM Corporation 2003

IBM Global Services

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

List of possible agents (executors) of a task (All supervisors in a dept.)


|

Role = Rules (Supervisor of User PBACON)

Selected Agent(s) (Mr. Banning)


Copyright IBM Corporation 2003

IBM Global Services

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.

Copyright IBM Corporation 2003

IBM Global 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

Copyright IBM Corporation 2003

IBM Global 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 1. Evulution paths (Pure configuration no ABAP coding) 1. Organizational data (Pure configuration no ABAP coding) Jobs , positions 1. Functions to be executed ABAP Code Function Module

Copyright IBM Corporation 2003

IBM Global Services

Rule Definition with Responsibility: Example


Employee Employee Names Names A-K
Jones Smith

Mr. Miller Position : Administrator HR HR

George Peter

Anna Michael

David Ross William

Mr. Mr. Andrew Andrew Position : Administrator HR

Employee Employee Names Names L-Z L-Z

Copyright IBM Corporation 2003

IBM Global Services

Rule Definition with Responsibility: Example


Rules Container Definition
Container Element Element Data Type Uname Name Name

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

Mr. Andrew

Copyright IBM Corporation 2003

IBM Global Services

Evaluation path as Rule


Transaction : OOAW Menu Path:

Evaluation path describes how to find one or more organizational objects based On an initial organizational units Example
Evaluation path WF_ORGUN WF_ORGUS US_CHEF SAP_HOLD Meaning Get organization unit for a user id/person id All users of a organization unit,job, position Superiors of a users Holder of a position

Copyright IBM Corporation 2003

IBM Global Services

Evaluation path as Rule contd.


Here are the basic steps: 1. 2. 3. 4. 5. Determine the evaluation path that needs to be used Create a rule setting the type Function to be executed. Enter function module RH_GET_STRUCTURE Enter the evaluation path determined in step 1 above Following rule container needs to be created
Name OTYPE OBJID ORG_AGENT Data type ref OBJEC-OTYPE OBJEC_REALO WFSYST_AGENT Description Type of organizational management object ID of organizational management object Organizational management object Example US SMITH USSMITH

Copyright IBM Corporation 2003

IBM Global Services

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 Type Table Table Exception Name AC_CONTAINER ACTOR_TAB NOBODY_FOUND Data Type Ref SWCONT SWHACTOR Meaning Incoming rule container Outgoing list of agents in agent format Exception indication no agents found

2. 3. 4.

Create a rule setting the type Function to be executed. Enter the created function module name Create container elements.

Copyright IBM Corporation 2003

IBM Global Services

Execution of a Role Resolution via Organizational Objects


Via organizational objects: Role resolution utilizing organizational data analyses the assignment of an organizational object (plant, laboratory, MRP controller, planner group, shipping point, sales office) to a position or organizational unit. Plant Laboratory Sales Office

Copyright IBM Corporation 2003

IBM Global 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

Copyright IBM Corporation 2003

IBM Global 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

Copyright IBM Corporation 2003

IBM Global Services

How are Selected Agents Determined With a WF Agent?


Triggering Event 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

All possible agents who qualify to execute task

Copyright IBM Corporation 2003

IBM Global Services

Workflow and ALE

Copyright IBM Corporation 2003

IBM Global Services

ALE error handling


U s e r a c t io n R3 / a c t io n

E r r o r in in b o u n d fu n c t io n m o d u le A L E t r ig g e r s e r r o r e v e n t
in p u t E r r o r O c c u r r e d

W o r k i t e m a p p e a r s i n u s e r 's I n b o x E x e c u te W o r k ite m D is p la y ID o c fo r u s e r p r o c e s s in g (ID o c m e th o d " In p u tF o r e g r o u n d " ) F ix e r r o r a n d r e p r o c e s s ID o c or F la g ID o c fo r d e le t io n A L E t r ig g e r s e n d e v e n t


in p u t F in is h e d

W o r k ite m c o m p le t e d

Copyright IBM Corporation 2003

IBM Global Services

Workflow and ALE


Error Notification Active Monitoring IDOC Processing Notification of successful posting

Copyright IBM Corporation 2003

IBM Global Services

Workflow and Error Notification


B u s i n e s s U s e r A n a l y s i s

x c e p t i o R a is e d

D R

U s e r / G r o u pU s e r c h e c k s e t e r m i n e g e t s n o t i f i e da n d e x e c u t e e c i p i e n t s v i a a w o r k i t e mw o r k i t e m

i n s

b o x t h e

R p

s t a r t t h r o c e s s

i x

t h

r r o

a n e r r o f i x e d ?
N o

r g

t h

I D

Copyright IBM Corporation 2003

IBM Global Services

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

Copyright IBM Corporation 2003

IBM Global Services

Setting up Inbound Process via Workflow


The standard system can be configured to start a WF for an incoming IDoc. Useful when review is essential before posting Custom. SAP does not deliver standard. The settings are: --Create the custom task or WF --Create a new process Code ( WE42) and attach this custom WF/Task. --In the Partner Profile, attach the new Process code

Copyright IBM Corporation 2003

IBM Global Services

Notification of Successful Posting


The ALE/EDI interface can raise events on successful posting of an IDOC. The settings are: --Identify the Appl.Obj created by the Idoc. Txn: WE57 --Identify the event that needs to be raised. --Go to BD67, select Process code and populate Object type and Event. --Identify/Create tasks/WF and enable event linkage.

Copyright IBM Corporation 2003

IBM Global Services

ALE error handling

Necessary Steps:

Create new object type in Business Object Repository for IDOC; object is child of IDOCAPPL Create new customer task Create event-couplings linking

Event inputErrorOccured linked to standard task Event inputFinished to function module Create new object type as child of IDOCPACKET

To support mass processing:

Maintain process code to refer the above objects and events

Copyright IBM Corporation 2003

IBM Global Services

Business Workflow Customization


- Workflow -

Copyright IBM Corporation 2003

IBM Global Services

Workflow Customizing - SWU3

Copyright IBM Corporation 2003