You are on page 1of 85

Sap Workflow Training

Content:
Sap workflow introduction

Automatic workflow customizing

Creation of business objects

Creation of events

Creation of tasks

Integration of organizational management


Sap Workflow Training
Workflow Execution: SAP Business Workflow
Runtime System

Central Access Point for a User: Integrated Inbox


Sap business workflow introduction

SAP Workflow is a tool to automate complex business processes where


there is more than one user involved. SAP workflow maps the position in
organization because SAP believes that Positions are more stable than the
people.

SAP Workflow is a process tool that is designed to facilitate and automate


business processes involving the tasks sequence performed by the users
(people in the workplace) and ensure that the right work is assigned in the
right sequence at the right time to the right person in the workflow.

The SAP workflow can be linked to other software tools such as Microsoft
Outlook or Lotus Notes. Using SAP Workflow, each step of a business
transaction can be easily monitored throughout the initiation and completion
of the business processes.
Sap business workflow introduction

SAP Business Workflow is the R/3 tool for handling the process
automation within R/3 or between R/3 systems and other systems
involved in the business process. It is flexible enough to handle ad hoc
processes such as the circulation of an electronic document.

Using SAP Workflow, each step of a business transaction can be easily


monitored throughout the initiation and completion of the business
processes. The SAP Workflow enables the process owners to track
deadlines, determine the workload as well as provide statistics on the
length of time to complete work processes.
Sap business workflow introduction
When do I need workflow?

It is particularly beneficial:

when different people are involved in different parts of the process.

when a process only occurs periodically and the users need to be


reminded of what they need to do.

when the duration of the process is critical and deadlines have to be met.
Sap business workflow introduction
How does it work?

When the workflow runs it creates work items which are like e-mails,
but

they have the advantage that they contain the intelligence needed to
execute the relevant task with the correct data when the operational
user executes them,

they provide their own functionality so that the operational user has
access to everything that is useful to improve the flow of the process,
Sap business workflow introduction
How does it work?

they disappear on their own when they have been executed by


someone else or made obsolete.

These work items can be received in the R/3 business workplace, MS


Outlook© (or any other MAPI compatible client), Lotus Notes, or work
item notifications can be distributed by e-mail
Sap business workflow introduction
Advantages of sap business workflow:

combines integrated organizational management with flexible


assignment of tasks and responsibilities to locations, positions, jobs,
groups, or individuals,

actively supports a quick implementation of workflow technologies


through predefined workflow templates, Workflow Wizards and flexible
adjustment options,

interfaces to other mail clients such as Lotus Notes and MS Outlook


Automatic workflow customizing

Automatic Customizing covers all the activities that concern the technical basic
settings.
The following standard settings are amongst those made:

Configuring a client-specific RFC destination

Maintaining a workflow system administrator

Scheduling all background jobs for the workflow system

Setting an active plan version

Classifying SAP tasks and SAP workflows as general tasks


Automatic workflow customizing
Path: ABAP Workbench->Development->SAP Business Workflow
->Utilities->Automatic Workflow Customizing-code: SWU3
Automatic workflow customizing
Automatic workflow customizing
Creation of business objects

The business object types are identified and described with


their object methods in the Business Object Repository (BOR) of
the R/3 System.
Creation of business objects
Creation of business objects

Object Type:

It’s a data with which you want to work in a workflow (e.g.


Material, Customer) Objects are created at runtime and are
specific instances of defined object types. Many object types are
delivered by SAP.

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.
Creation of business objects
Hands On An Existing Object Type

Transaction Code: SWO1 for Object type:

a) New Custom Business Object

b) Enhancement of existing BO (Delegation


Required)
Internal technical key of a business object in the
Business Object Repository (BOR).

Business objects are identified in the BOR by object


type (for example BUS2000270) and a descriptive
English name (for example CRM Grantor
application). Both identifiers must be unique across
all object types.
Creation of business objects
Creation of business objects
Creation of business objects

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.


Creation of business objects
Creation of business objects
Key Fields: Key fields are designed to
uniquely identify the object type.
Creation of business objects
Creation of business objects

Attributes:

Carries the properties for the key field. It provides access to


data.

The majority of attributes are data-dictionary fields (for example,


the current user status attribute is defined by
CRMT_STATUS_INFO-USER_STAT). When you access an
attribute of an object, you execute a SQL statement that retrieves
the corresponding field in the database.
Creation of Sub objects type

A subtype of an object is another object whose creation is based upon a


parent object (see the preceding manager/employee example).

The subtype maintains references to all the attributes and methods of its
parent object. This means that any methods and attributes defined on the
parent can be executed and accessed on the child object

If a subtype object were merely a copy of its parent, then all the code
contained within the parent would be physically copied to the child. This is
not the case.

The subtype simply maintains references to its parents methods and


attributes. The real difference is that the subtype lets you redefine these
methods and attributes.

You can easily add your own business rules to the parent methods by
redefining the subtypes method. In the following example, I will show why
this distinction is so important.
Creation of sub object type
Create sub business object type:
Path: ABAP Workbench ->Development->Business Object Builder
T-code: SWO1.
Enter standard business object name for which you need to create sub type.
Creation of sub object type
Creation of sub object type
Delegation:

Now that you have implemented a new zrmsfmwfgetdetails method, you need to tell
the SAP system to use the defined version of zrmsfmwfgetdetails and not the version
that was delivered on the bus2000270 object. This is similar to object-oriented
inheritance but the two concepts do have fundamental differences.

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.
Creation of sub object type
Creation of sub object type
Creation of business objects
Creation of business objects

Methods:

the methods of an object represent the actions you take with


objects attributes.

Methods usually refer to existing ABAP functions, such as


function modules, transactions and dialog modules.

They are called using a standard interface, which is determined


basically by the method ID and the method parameters. The
actual implementation of a method is not externally apparent.
Creation of business objects
Creation of methods
Creation of methods
Creation of methods
Creation of methods
Creation of methods
Creation of methods
Creation of methods
Creation of methods
Creation of methods
Creation of events

Events
An event may start, terminate or continue tasks and workflows.
The list of possible events is defined with the relevant object type
in the Business Object Builder. This list can be extended
according to customer requirements using the delegation
concept. The actual creation of the events added must be
catered for.
Each event carries information from its creation context in its
event container. This information is available to the receiver of
the event and can be used for event-driven control and
communication mechanisms..
Creation of events
Types of event creation method:

•Creation of Events Upon Status Changes

•Creation of Events When Change Documents are Written

•Creation of Events via Message Control

•Creation of Events Upon LIS Exceptions

•Creation of Events via Business Transaction Events 

•Creation of Events by Calling a Function Module

•Creation of Events by Using ABAP Classes


Creation of events
Creation of Events Upon Status Changes:

Event creation can be connected to changes in system status or user status


without modifying an existing application.

A status is an indicator that can have only the states set (active) or not set (not
active). Statuses that can have more than these two states are not supported.

These statuses can be set by the system (system status) and by the user
(user status).
System statuses are indicators that are only set by the system. Their purpose
is to document the current state of an object from the system viewpoint.

User statuses are indicators defined by the user, which document the
processing state of the object from the viewpoint of the user.
Creation of events Upon Status Change
Choose Tools → Business Workflow → Development → Definition Tools → Events
→ Event Creation → Status Management. Alternately, you can go to transaction
BSVW.
Creation of events Upon Status Change
Creation of events Upon Status Change

Enter a status object type in the field StatusOT and the object type whose status
change is to be indicated by the event created in the field BusinessOT. Enter the ID
of the event to be created in the field Event. For ex-As an event is to be triggered for
a change in the status of a grantor application, then status object type should be
chosen as GRH and the object type has been created with BUS2000270 (Grant
application). zuser_status_e0018 (dept pending check) as triggering event for dept
level workflow.
Creation of events Upon Status Change

Then select the row and click on “Status Restrictions”. Click on new entries and add
the statuses with which the event needs to be linked. For ex- If the statuses E0018
(Dept pending check) are to be linked, then these are added to system statuses.
Afterwards, save the entries.
Thus, if any grant application are saved with status E0018, the event
ZUSER_STATUS_E0018 would be triggered. Thus this event can now be used as
the triggering event of a workflow or a task as usual.
Creation of events Upon Status Change

If you got this error message "No key information available for status object GRH".
Then go to SM30 enter view name BSVWVCOUP6
Creation of events
Evaluation and Maintenance of Type Linkages 

The type linkage describes the assignment of a receiver function module and a receiver
type to a particular combination of object type and event.

A type linkage must be created if the system is always to react to an event of a particular
object type. The type linkages are evaluated at runtime by the event manager. The event
receiver should define a type linkage using a function module provided.
Creation of events
If you enter an event as a triggering event of a workflow, for example, the following
entries are made automatically:
Object type and event ID
Workflow to be started as receiver type
Function module SWW_WI_CREATE_VIA_EVENT_IBF as receiver
function module
Creation of events
Evaluation and Maintenance of Instance Linkages

The instance linkage describes the assignment of a receiver instance to a particular


combination of object type, object key and event.

This linkage defined by the receiver instance itself using a function module provided.
An instance linkage is always defined at event receiver runtime.
Creation of events
The general part of the instance linkage is the same as a type linkage that uses the
entry WORKITEM or EVENTITEM as receiver type. There can be several instance
linkages for one type linkage of this kind.
Creation of events using change document
Change Documents

Many business objects are changed frequently, and these changes are logged into
change documents to make the changes traceable. Change documents can be
created for changes already made as well as for planned changes. The creation of
an event can be connected to the writing of these change documents, thus
connecting them to triggering of workflows.

The assignment between a change document object and a business object


type/event must be maintained in a system table. The system then creates the
event whenever a change document is written for the change document object. The
change document is written when the change is updated.
Creation of events using change document
Path: ABAP Workbench ->Development->SAP Business Workflow->Definition tools
->Events->Event creation->Change documents-> Overview
T-code: SCDO
Select create button
Creation of events using change document
Creation of events using change document
To maintain assignment between a particular change document and an event, go to
transaction SWEC. Alternately, you can go to Tools → Business Workflow →
Development → Definition Tools → Events → Event Creation → Change
Documents → Linkage .

Click on New Entries and add a new record linking the change document to the
required event. It is to be remembered that the business object type to which the
event belongs and the change documents must have the same key fields.
Creation of events using change document
Finally, before a change document object can be used for event creation, certain
settings must be made. This information is required, for example, for correct
assignment between change document object and object type. To maintain the
workflow-relevant settings of change documents, choose Tools → Business
Workflow → Development → Definition tools → Events → Event creation → Change
documents → Define workflow properties. Alternately, you could go to transaction
SWED.
Creation of events using Business Transaction
Business Transaction Events:
G/L accounting and accounts receivable/payable accounting provide
publish and subscribe interfaces, which inform other application
components or external interested parties (partners, customers) that
particular events (such as document entered) have taken place in
financial accounting. The data this creates can be used by the
interested parties for their own subsequent processing. But no data can
be returned to G/L accounting or accounts receivable/payable
accounting.
SAP Business Workflow uses this interface to create events of object
types defined in the Business Object Repository from its events. These
events can be used as triggering events of a workflow.
Let us look at a simple scenario of configuring Business Transaction
Events:
Go to Financial Accounting → Financial Accounting Global Settings →
Business Transaction Events.
Creation of events using Business Transaction
Creation of events using Business Transaction
Execute and go to Environment → Infosystem (Processes).

Execute the transaction with the default values.


Creation of events using Business Transaction
Find the correct interface for updating the document.
Creation of events using Business Transaction
Place the cursor on the key 00001120 and click on Sample Function Module
This navigates you to SE37 (Function Builder). Copy the function module
(SAMPLE_PROCESS_00001120) for coding.

Inside the created function module ZSAMPLE_PROCESS_00001120, you can call the
function module SWE_EVENT_CREATE to trigger any event which has been added
as the triggering element for a workflow or a task.
Creation of events using Business Transaction
Return to the main screen for Business Transaction Events. In order to assign the
function module to an event, create a product as shown.

Add a New entry as shown. Ensure that the Active check box is checked, otherwise
the BTE won’t trigger. Save and return to the main menu.
Creation of events using change document

Add a new entry as shown for 00001120 and save it.

Now, that the configuration steps are completed, if a new document is created
through transaction FB01, the triggering event for the workflow will be created along
with it.
Creation of events Upon LIS Exception
Creation of Events Upon LIS Exceptions

The Early Warning System uses the key figures of the Logistics Information System
(LIS). The Early Warning System enables you to select and check weak points within
Logistics. The Early Warning System enables you to search for exceptional situations,
thus helping you to recognize and rectify potential problems at an early stage.

You define the exceptional situation as Exception within the Early Warning System. An
exception consists of the specification of characteristics and/or characteristic values
(such as vendor, material) and conditions. Conditions can be created as threshold
values (such as materials/vendors with an order value greater than €5000), as trends
(such as a positive trend in the order value) or as planned/actual comparisons.

For more information on the LIS and the Early Warning System choose Logistics
->Logistics (General) ->Logistics Information System -> Early Warning System:
Overview.
Creation of events by calling function module
Creation of Events by Calling a Function Module

You can create events from application or system programs by calling one of the
relevant function modules SWE_EVENT_CREATE or
SAP_WAPI_CREATE_EVENT .

For the following special cases, there are other function modules, which actually
use the functionality of the above function module internally:

SWE_EVENT_CREATE_IN_UPD_TASK
This function module makes it possible to create events in an update task. In
contrast to the function module SWE_EVENT_CREATE , it can be called with the
addition of IN UPDATE TASK .

SWE_EVENT_CREATE_FOR_UPD_TASK
The event is created in the update task.
Creation of Events by Using ABAP Classes
The triggering of events described here relates to events that are processed by
the event manager. These events must be triggered by the ABAP class
CL_SWF_EVT_EVENT.

If an event is triggered by the following ABAP objects command, this has no


significance for the event manager:
RAISE EVENT <evt> EXPORTING... <ei> = <f i>...
However, in the event handler method the event can be triggered for the event
manager by using the ABAP class CL_SWF_EVT_EVENT. See also:     ABAP
Objects -> Triggering and Handling Events.

There are implementation examples in the CL_SWF_FORMABSENCdemo


class. To trigger the event, use a static method (method: DELETE of the demo
class) or an instance method (method: UPDATE of the demo class).

For a description of the internal processing, see Creation of Events by Calling a


Function Module. The ABAP class CL_SWF_EVT_EVENT has two methods,
RAISE and RAISE_IN_UPDATE_TASK, which behave in the same way as the
function modules SWE_EVENT_CREATE and
SWE_EVENT_CREATE_FOR_UPD_TASK.
Event Simulation
The creation of an event is simulated and the result specifies which tasks and
workflows would be started as receivers of this event.
The result of the test also shows whether errors were diagnosed in connection with the
simulated start of the task, which may result in the task or workflow not being started.

The respective error causes are designated with a letter. The legend can be consulted for
an short explanation of the error causes. The most common error causes are:

•There is no workflow definition for the workflow to be started (error cause a).
•The workflow is not activated (error causes b, c).
•The type linkage between the triggering event and the task or workflow has not been
activated (error cause e).

The binding definition from the event container to the workflow or task container has
errors (error causes h, i). The task or workflow may nevertheless be started but will
probably not be processed as expected.
Event Simulation
Path: ABAP Workbench->Development->SAP Business Workflow
-> Utilities-> Events-> Simulate event
T-code: SWU0
Event Trace 
All events created correctly are logged in the event trace irrespective of whether
potential receivers exist.
If a receiver is entered in the event trace, it does not necessarily mean that this
receiver was called successfully.

Event Trace
Path: ABAP Workbench->Development->SAP Business Workflow
-> Utilities-> Events-> Event Trace-> Switch Event Trace On/Off
T-code: SWELS

Event data:
Triggering object type,
triggering object
Event ID,
Triggering program,
Trigger date and time.
Display Event Trace 
Path: ABAP Workbench->Development->SAP Business Workflow
-> Utilities-> Events-> Event Trace-> Display Event Trace
T-code: SWEL
Creation of tasks
Tasks are the central element in the workflow system.
Tasks are used to describe a business process. These tasks may require a single step
(single-step task) to be executed or several, possibly parallel, steps (multistep task)

Standard task (single-step task, task type TS)


Customer task (single-step task, task type T )
Workflow template (multistep task, task type WS)
Workflow task (multistep task, task type WS)
Task group (task type TG)

Customer tasks are client-dependent and have a period of validity. They are
therefore integrated in organizational management with its planning and time
limitation options.
Standard tasks are client-independent and are defined without a period of validity
Creation of standard task

The workflow system automatically makes proposals for the following binding
definitions:
Binding definition from workflow container to task container
Binding definition from task container to workflow container
Binding definition from task container to method container
Binding definition from method container to task container
Creation of standard task
Creation of sub object type

Task container is used to process the container elements. Each task container already
contains the workflow system elements and any additional elements for the method
parameters of the referenced object method.
Creation of sub object type

You can define bindings from the task container to the following containers:
Workflow container
Role container
Method container
Creation of standard task
Creation of standard task
Workflow builder

The Workflow Builder provides a graphical view of the workflow definition. The
alphanumeric workflow editor provides a textual view of the workflow definition in
a tree display, as an alternative to the Workflow Builder.

Steps used to create workflow:


•Activity
•User decision
•Condition
•Multiple condition
•Event for event
•Fork
•Loop
•Wait for condition
•Container operation
Activity

Execution of a task. This task can be a single-step task or a multistep task.


The system inserts a step of the type Activity into the workflow definition. To ensure
the consistency of the workflow definition, all active outcomes are inserted with the
actual step. For each outcome, the system adds a branch in the workflow definition
and puts an undefined step into this branch. To ensure the consistency of the block
structure, all branches created are brought together before the next step of the
workflow definition.
At runtime, an activity is represented with a work item of one of the following types:
Dialog work item if the activity references a single-step task with dialog.
Background work item if the activity references a single-step task processed by the
system without dialog.
Workflow work item if the activity represents a multistep task.
Activity
Activity
User Decision

In a user decision, the recipients receive the task description together with the
possible decision options during execution. You can use a user decision in the
following situations:
Only one of several possible alternatives can be processed in the workflow from a
business point of view at execution time.
A decision about the progression of the workflow must be made in dialog with a user.
An instruction (= user decision with only one decision option) is required to continue
the workflow.
For approval and release steps, possibly in connection with a secondary method
(the latter is possible without the application having to cater for these functions).
User Decision

good,
in which place you are working in india?

You might also like