Beruflich Dokumente
Kultur Dokumente
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
Need of Workflow
2
Hmm ! Time to put in a purchase requisition request I wonder who approves buying this stuff?
TIME IS MONEY!!!
5
I guess Id better send off some inter-office mail to ask the approvers to approve my requisition.
4 Time drags on . . .
Drawbacks
Inefficiency.
Workflow Architecture
Organisational Level
Process Level
Workflow Definition
Workflow Definition
A workflow definition describes the workflow process
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.
Workflow Design
Workflow Steps
Steps which are used for internal process control and monitoring (condition, multiple condition, loop, etc)
Subworkflow
-
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.
Standard Task(TS) Single step Customer Task(T) Tasks Workflow Template(WS) Multistep Workflow Task(WF)
Created by customer With validity period Client-dependent Must be linked to its possible agents when it is defined
Created by SAP and customer Without validity period Client-independent Must be linked to its possible agents when it is defined
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
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
Defining a Task
Background SAPphones
The workflow dials the telephone number attached to the current customer
|
Copyright IBM Corporation 2003
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
Example
Processes request from &_WI_Object_ID.CreatedBy&
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
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.
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
Import Parameters
METHOD
Export Parameters
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.
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.
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
The functionality has been replaced. The old functionality is still supported for two releases.
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.
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.
|
Copyright IBM Corporation 2003
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
What is a Container?
Container Definition Container Instance R/3
Field values
Application Data
Element name
Description
Multi-line
Value
X X
Definition
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
Event Container
1
sync task
sync task
8 9
10
role
13
12
async task
15
async method
14
terminating event
Copyright IBM Corporation 2003
SWC_CONTAINER
Declare Container
SWC_CREATE_CONTAINER
Initialize Container
SWC_RELEASE_CONTAINER
Release Container
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
Transfer value of your object instance to the container element: SWC_SET_ELEMENT CONTAINER MATNR MATERIAL
|
Copyright IBM Corporation 2003
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
Element: PRItems
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
Events
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.
Change Document
Status Management
Message Control
Specific HR Tables
Status Management
Maintain the processing program RSWEMC01 with the FORM routine CREATE_EVENT for the output type EVEN and transmission
medium 9.
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.
Receivers
|
Creator
Copyright IBM Corporation 2003
Event Trace
Transaction: SWEL Menu Path :Basic menu -> Tools -> Business Workflow -> Development -> Utilities -> Events -> Event 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
|
Copyright IBM Corporation 2003
Additional organizational units Create jobs Create positions Assign Holders Assign tasks
|
Manager job
User 1
Task
Job for secretary Position: Secretary User 2 Position: FI administrator 1 User 3 Job for FI employee Position: FI administrator 2
Task
Task
User 2
Agent
Agent is an executor of a work item.
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 are a collection of agents who qualify to execute a work item
Selected agents are those possible agents who are elected to execute a task at runtime
Actual agent is the agent among those selected agents who actually processes the work item
Copyright IBM Corporation 2003
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
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.
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
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
George
Peter
Anna
Michael David
Ross
William
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. Andrew Mr. Miller
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
Description Type of organizational management object ID of organizational management object Organizational management object
2. 3. 4.
Create a rule setting the type Function to be executed. Enter the created function module name Create container elements.
Possible agents
User Position Job Org. Unit Person
Default role
Business Workplace
TASK
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
IDOC Processing
Notification of successful posting
Exception Raised
Determine Recipients
Yes
End
Workitem appears in user's Inbox Execute Workitem Display IDoc for user processing (IDoc method "InputForeground") Fix error and reprocess IDoc or Flag IDoc for deletion ALE triggers end ev ent
i nput Fi ni shed
Workitem completed
7.
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