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

SAP ABAP Workflow

Agenda

▪ Day – 1 :
– What is workflow?
– Business Object
– Data flow

▪ Day – 2 :
– Workflow Builder
– WF Template, Task, Agents, Rules, deadlines, program exits

▪ Day – 3 :
– Workflow example
– Workflow Trouble shooting
– Important Transactions

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 2


1

Introduction

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 3


What is 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

▪ Useful for business processes that


– Contain sequence of activities
– Reoccur in the same or similar forms
– Involve groups of people
– Require considerable co-ordination

▪ Workflow management consists of the automation of business


procedures during which documents, information or tasks are passed
from one participant to another in a way that is governed by rules or
procedures.

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 4


What is Workflow?

Workflow Business Scenario:


Some of the Typical Workflow Business Scenarios in Purchase to Pay are
Purchase Requisition Approval, Purchase Order Approval and Invoice
Approval for blocked invoices and so on. These are preconfigured Scenarios
that can be used by setting up the appropriate data in SAP Customizing.

Overall Purchase-to-Pay Scenario

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 5


What is Workflow?

▪ SAP Workflow design is based on 5 Key Questions

Relationship between these Questions and the Workflow Terminology

What?
What question refers to each activity to be executed – it could be a task, a user
decision, email notification or document generation activity? A task might
execute a transaction, a report, a function module, BAPI or a method called
within the program code. A task is used to define an activity that can be
executed within a workflow definition or independently as a single step.

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 6


What is Workflow?

▪ With What Object?


With What Object refers to the Business Object types and its methods. A
business object is the representation of a business entity in the SAP System.
Examples are Invoice-Post, Purchase requisition-Approve, Material-Change
etc.

▪ When?
Events tell the workflow an activity has happened so that the workflow can
react to it. Event is the change in state of a business object instance. Events
are used when a business application may need to tell the workflow engine to
start a business process, or when an activity is finished, or when that an activity
that was started is no longer required.

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 7


What is Workflow?

▪ In what order?
A Workflow definition describes the business process to be mapped and its
order. A Workflow definition consists of individual, sequential steps for a
business process and is maintained via workflow builder. The workflow
definition is like a flowchart that controls the order in which the individual steps
are executed and any temporary data needed along the way. The workflow
container is used to hold all temporary data. A workflow definition consists of a
triggering event (which starts the workflow) and steps.

▪ Who?
Who refers to the recipients of a work item established by the system at
runtime. The recipients (selected agents) are derived from the intersection of
possible agents and responsible agents barring excluded agents .The recipient
who actually executes the work item is termed as the Actual Agent. To decide
who should receive a work item and execute the task, we generally use
organization plans or roles.

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 8


SAP Workflow Business Terminology

▪ Business Objects

▪ Business Workplace or inbox / UWL (portal)

▪ Workflow definition

▪ Tasks

▪ Events

▪ Agents

▪ Workitems

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 9


What is Workflow?

▪ Execution of the workflow

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 10


2

Business Object Builder

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 11


Business Object Types and the Business Object
Repository

Business Object Type


A business object is described by the following elements.

Object ID Unique ID of the object type


Key field Unique identifier of the object at runtime
Object name Unique name of the object type
Components Differentiated internal structure elements of the object
Attribute Property of an object: Entered by, entered on, etc.
Methods How can an object be edited?
Events Which states can an object adopt? created, deleted,
changed,
etc.

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 12


Business Object Types and the Business Object
Repository

Business Object Repository


▪ Object types are developed by the applications, stored in the Business
Object Repository (BOR), and edited using the Business Object Builder.
▪ BAPIs, which are used to call external functions from the SAP system, are
methods of a business object type.
▪ In the SAP Workflow, you access the data of an object using the
corresponding object type.
▪ SAP ArchiveLink, the component used for storing documents in an archive
system and linking them to business objects, also uses business object
types.

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 13


Business Object Types and the Business Object
Repository

Object Type and Object Instance

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 14


Business Object Types and the Business Object
Repository

Object Type and Object Instance


Object types (classes) describe an abstract business object, the
characteristics/attributes (data) that belong to it as well as methods and events.
The above slide contains the .Aircraft. object type.

Specific objects are instances of the object type.

You can derive subtypes from object types. Subtypes inherit all of the
characteristics (attributes), methods and events of the original object type.
You can add characteristics (attributes), methods and events to subtypes. On
the above slide, .Cargo plane. and .Passenger plane. are subtypes of the
object type.

At present, multiple inheritance is not directly supported by SAP business


objects. However, SAP provides general interfaces. An object type can
implement any number of these interfaces.

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 15


Business Object Types and the Business Object
Repository

Object Type and Object Instance


Business object instances contain actual data (for example, a sales order). An
object type can have any number of instances. The lower part of the slide
contains specific instances of the "Cargo plane" and "Passenger plane" object
types whose keys may be used for unique assignment.

Addressing Instances in the Workflow


When a workflow is executed, each of the objects in the workflow have a
specific instance which can be used to access the attributes (material number,
material description and material type on this slide) and object methods (create,
display, change and delete on this slide) in the workflow.

In the interface of the task that is currently being executed (a step in the
workflow which executes methods), the object instance is always addressed
using the _WI_OBJECT_ID variable.

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 16


Business Object Types and the Business Object
Repository

Objects in the Workflow

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 17


Business Object Types and the Business Object
Repository

Objects in the Workflow


▪ Workflow are usually started using events. The event defined in the BOR
then acts as a triggering event. Events can complete workflow steps. In this
case, the event is a terminating event.
▪ Tasks call the object type methods and therefore determine the function
executed at runtime.
▪ You can use attributes in steps (condition, loops, and so on), but you can
also use attributes in texts (work item text and the long texts for a task).
▪ The definition of objects can be changed without having to modify workflow
definitions.

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 18


3

Data flow and


new containers

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 19


Data flow and new containers

In order to understand the data flow we need to understand few terms


which will be used to define dataflow.

▪ SAP Application: It is an application component or we can say its a module


like MM, SD, FI, HR etc.

▪ Action happened: Action happened represents the completion of action.


For example: creation of purchase order is an action but Purchase order
created is Action Happened that is completion of action. Similarly change of
Sales order is an action but Sales order changed signifies that action has
happened.

▪ Events: It signifies that action has happened and also signifies the change
in status of document. For example: Purchase Order Created, so Created is
an event. Purchase Requisition approved signifies the change in status of
Purchase order, Approved is Event here.

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 20


Data flow and new containers

▪ Triggering Event:
Event which triggers workflow is called Triggering event.

▪ What it is?
Once Business object is decided and it is also ascertain that on which event
workflow should trigger, it is configured for workflow template using
transaction PFTC under “Triggering Event” Tab.

▪ What happens at backend?


When we configure event for workflow this relationship gets stored in
database tables.

▪ What does Triggering means?


When we perform action .Technically following step should have been
taking place and apart from that there may be many more steps which will
happen.

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 21


Data flow and new containers

▪ Containers: Containers is same as literal meaning that is it contains variables


and its values. There are different containers.

▪ Event Container: It is attached to Event and holds all parameters in Event


Environment.

▪ Workflow Container: Attached to workflow and its scope is global in workflow.


But can not be accessed by method directly.

▪ Task Container: Tasks are attached to activities in workflow and there is a


container attached to it whose scope is task environment.

▪ Method Container: Contains method parameters of Methods.


▪ Binding: Linking two different containers are called binding.
▪ Agents: Person responsible to perform task. It will always be SAP user id. There
are different ways of determining SAP user id. It may attach to position in
Organization structure or may be attach to Job etc. Also it can be determined
using roles determination through function modules.
©La rsen & Toubro Infotech Ltd. Privileged and Confidential 22
Data flow and new containers

▪ Data Flow Diagram

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 23


Data flow and new containers

▪ How does data flow?

When transaction is performed and action has happened an event is


triggered. Event should be in Business Object. The moment event is
triggered event parameters are populated in event container.

Once event is triggered it is checked whether it is configured for any


workflow template and is active? If it finds one and binding is there between
event and workflow container it passes data from event container to
workflow container which is further used by workflow to process steps
configured in it.

Event Container has binding with workflow container only and it is


unidirectional. That is data flows from event container to workflow container
only.

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 24


Data flow and new containers

▪ How does data flow?

Now as workflow moves from one activity to another in workflow builder.


Binding is to be established between workflow container and task container.
It is bi directional. Once data moves to task container it is accessible to
methods of business object through Macro’s.

Sometimes there are method containers available for methods. In those


cases method of business object can access data only if there is binding
between task container and method container. It is also bi directional.

Once data is accessible to method processing is done on that and results


are returned to containers which enables workflow to proceed ahead.

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 25


Data flow and new containers

▪ SAP Workflow Containers


A basic common data structure of the various definition components and execution
components of SAP Business Workflow.

▪ There are 5 different containers


– Workflow container
– Task container
– Method container
– Rule container
– Event container

▪ What is binding?
In workflow terms, the word binding represents, assignment between elements of
two different containers. Binding editor is used to define binding between elements
of different containers.

▪ Points to be noted while defining binding between elements of different containers,


– Elements should belong to same data type.
– Binding can be defined between compatible data types.
©La rsen & Toubro Infotech Ltd. Privileged and Confidential 26
Data flow and new containers

▪ Possible Binding Definitions between Containers:

▪ Workflow Container:
– Binding can be defined from Workflow to Event Container.
– Binding can be defined from Workflow to Task Container.
– Binding can be defined from Workflow to Rule Container.
▪ Event Container:
– Binding can be defined from Event container to Workflow Container.
– Binding can be defined from Event container to Task container.
▪ Task Container:
– Binding can be defined from Task to Workflow container.
– Binding can be defined from Task to Rule container.
– Binding can be defined from Task to Method container.
▪ Method Container:
– Binding can be defined from Method to Task container and method container.
▪ Rule Container:
– Binding can be defined from Rule container to Workflow container.

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 27


Data flow and new containers

▪ Possible Binding Definitions

©La rsen & Toubro Infotech Ltd. Privileged and Confidential 28

You might also like