Workflow
Introduction:
We can use
SAP Business Workflow (WebFlow Engine) to define business processes that are
not yet mapped in the SAP System.SAP Business Workflow enables the design and
execution of business processes within SAP application systems. SAP has
introduced this tool to simplify its business process if it requires approval
from different departments.
SAP
Business Workflow is particularly suitable for situations in which work
processes have to be run through repeatedly, or situations in which the
business process requires the involvement of a large number of agents in a
specific sequence.
Workflow
as a term means flow of work from one person to another. It is sequence of
steps which gets processed.
Example: Let us consider
a simple example - "Application of leave". It consists of the
following activities.
1. Employee submits a
leave application form to his manager. (He fills in details like the FROM and
TO dates of leave, the reason for taking leave, his contact number etc)
2. Manager checks the
details of the application
3. In case, he finds that
the reason for taking leave is not specified/detailed properly, he may reject
the leave application.
4. Now, the employee has
to correct the leave aplication, specifying the leave reason properly and
submit the application again.
5. The manager finally
approves the leave application.
Please note that there can be many variations of the
business process. A simple case is discussed here to give your understanding of
workflow, a good start. The procedures can be complex involving many persons,
decisions and approvals.
Therefore SAP has come up with SAP Workflow tool to
automate this manual approval process. It can be integrated with any of the SAP
modules like HCM, CRM, SD, and MM etc.
Disadvantages of manual approval process.
Disadvantages of manual approval process.
Lack of transparency
Long lead times
Lack of deadline monitoring
Advantages
of Workflow
SAP Workflow ensures that the right work is sent in
the right sequence at the right time to the right people".
It is a tool designed to facilitate and automate
business processes that require tasks to be performed by people.
SAP workflow can also be linked to Microsoft Outlook
or Lotus Notes to send email.
Each step of a business transaction can be easily
monitored and processes are completed from the beginning to the end.
Workflow allows process owners to keep an eye on
deadlines, provides statistics on the length of time to complete work
processes, determine the workload with regard to individual employees and save
processing time.
Since Workflow delivers work items to employees
automatically via email, they do not have to wait or inquire about the status
of a particular transaction.
SAP workflow is particularly useful when there is a
business process involving more than one person, when an automatic notification
can replace a manual communication and when there is a defined set of
individuals and/or documents implicated
It organizes one's work, alerts users and directs
traffic by sending work items - once the user executes the work item, then
another one can be sent to another user. For example, a Manager could use
workflow to approve a vacation request from an employee. The workflow
application would ensure that each person involved uses the correct online form
and successfully completes their step before the planned leave was entered into
SAP - either by an Administrator or automatically.
There are many disadvantages to the traditional
paper-based flow of work in a typical office environment. Let us discuss a few
of them.
1. Lack of transparency:
There is no easy way to know the status of the leave application. We probably
have to inquire the manager personally whether he has approved the leave
application or not. There is no system recorded status that we can glance at,
to track the application.
2. Long lead times: Bases
on customer feedback survey, it is found that a traditional paper based approch
involving three people typically takes seven days to complete.
3. Lack of deadline
monitoring: Who knows? The manager might just be sitting on the task for too
long. There is no mechanism in place to ensure that the persons perform tasks
within planned time period.
4. High costs: Paper
based workflows are very costly to support as a result of manual document
processing and archival.
SAP workflow is a cross
application tool that automates the business processes like the "leave
application approval" procedure that we have discussed. Cross application
tool means the tool can be used across various modules of SAP.
There are 9 primary terms that you should be aware of
when learning SAP Business Workflow. This Workflow Tutorial will
describe each of these in detail. These are by no means complete, but will give
you a very basic idea on what most of the key terms used. We will discuss
these terms in the light of the leave application example discussed earlier. We
will call the Leave Application Form as “Notification of Absence” going
forward.
Event
An event represents an action in the system.
For example, “Creating Absence Notification” is an ACTION.
For this action the SAP Application creates an event. This even in turn
triggers a workflow.
Object
Workflow routes the document
among different persons. Each person performs certain activities. Whatever goal
the workflow is intended to achieve, can be put inside an object type. Consider
an Object as a Structure ( Abstract Enclosure ) with certain data and some
logic. For example, there is a standard
object type called FORMABSENC in SAP. This is used for the notification of
leave. It has certain data and some logic.
If you are familiar with Object Oriented Programming then this concept
will be pretty familiar and straight forward.
Data
• KEY
( Absence Notification Number )
• ATTRIBUTES
(Created By , Entered on , Status etc )
Logic
• METHODS
( Create, Approve etc )
• EVENTS
( Created, Deleted etc )
An OBJECT is a specific instance of the OBJECT TYPE. So, if an user created a Leave Application
Form Object of type FORMABSENC , an instance with a unique number ( say 100001
) is created.
An SAP workflow task represents an Activity. It serves a purpose here.
Some examples of tasks are Revise Absence Notification, Approve Absence
Notification etc. The task Approve Absence Notification performs a business
function – Submits the relevant absence notification form to the manager and on
approval , it changes the status of the form to Approved and so on.
Business Workplace is a work area that an SAP user can use
to carry out business Processes.
For example, the business workplace of an user could be his
inbox. Let us take the example of the absence notification again. The employee
submits the notification to his manager. The manager receives the request in
his inbox to approve the absence notification. The manager opens it , checks
the details and approves the same. The request that the manager receives in
this inbox is called a WORK ITEM. In
technical terms, a work item is a run time request of a task in real time. Inbox contains not just the
work items – it may as well contain simple text message. Examples include
Notification messages, that need not be acted upon and are just used to inform
the owner.
SAP Workflow Agent
An Agent is a person who executes a work item. In our
example, manager Mr. John is the agent of the workflow task 'approve absence
notification.
• Possible
agent is the person who is eligible to execute the work item. The name of the
possible agent is mentioned in the workflow task.
• Responsible
agent is the person who should execute the work item, or who is responsible for
acting on the work item.Name of the responsible agent is mentioned in the
workflow step.
• Excluded
agent is the person who should not execute the work item, name of the excluded
agent is mentioned in the workflow step.
Let us consider an example.
John is a manager at the Southern Zone of an
organization. Any manager can execute
the task „approve absence notification‟ in general. Meaning all the managers
have the expertise, authority and eligibility to execute the task of approving.
They are the possible agents who can execute the task. Hence, in the task, we
mention the job 'manager' as the possible agent. This applies to all the
managers in general.
But, it is not a good idea to send the request for
approving absence notification to all the managers. We have to select one responsible
person, who should act on it. So, in the workflow step, we specifically mention
the name of the manager 'John'. He is called the responsible agent.
There might be a requirement that managers of Northern Zone
only should not be able to check/approve the absence notification. In that case
we mention the job 'Manager - Northern Zone' as the excluded agent of the
workflow step.
Hence, the system sends the work item to the responsible
agent who is also the possible agent and not the excluded agent. In this
example, the system sends the work item to John who is also the manager and not
the northern zone manager.
Please note that, for the purpose of this demo session, we
are not detailing on organizational aspects like job, position.
SAP Workflow Step
Steps are the building blocks of a workflow. In other
words, a workflow consists of steps arranged in a sequence. A step in general
refers to a business activity. A step can therefore refer to an activity where
it refers to a task.
As discussed earlier, in the workflow task, as a
responsible agent, we need to mention the name of the person who should execute
the work item of approving absence notification. This method of specifying
directly, the user name or job or position is called fixed agent assignment.
But in some cases, we may want to determine the agent at
run time, i.e when the workflow task is actually executed.
Then, instead of specifying the manager's name, we specify
a RULE 'superior ofworkflow initiator'. What does this rule perform?
It takes the employee as input, refers to the
organizational plan,checks who the superior of the employee is, at that point
in time, and sends the work item to his inbox. This method is called RULE
RESOLUTION.
Please note that there are many other rule types and
discussion of those is not included for this demo session.
Workflow
Now finally lets summarize the term SAP workflow and how
these key terms are linked together.
1. Workflow
engine automates business processes.
2. Workflow
can be triggered by an event.
3. Workflow
definition consists of a sequence of steps.
4. Each
step can be an activity which is nothing but a task.
5. Task
in turn refers to a method of a workflow to implement a specific logic.
6. Steps
can also refer to user decision, and other programattic controls.
7. Runtime
reprsentation of the step is called a work item.
8. This
work item sits in the inbox(business workplace) of the responsible agent
assigned to the step.
9. Agent
determination can make use of Rule.
What are advantages of SAP Business Workflows?
A business process can consist of several steps.
Historically, the
tasks have been coordinated manually or by some informal means
of communication (sticky note, e-mail, shouting, and so on).
The common problem in these approaches is:
tasks have been coordinated manually or by some informal means
of communication (sticky note, e-mail, shouting, and so on).
The common problem in these approaches is:
Inefficiency
Each lacks a way to trace where a task is
Who executed(or is executing it),
How much time it requires.
In contrast, the workflow ensures that the right work is
sent to the right person at the right time in the right sequence with the right
information.
Workflow is a tool for atomization of business processes
Not tied up to any particular application
Operates uniformly across applications
Coordinate all participating tasks
Provide users with active support
Deadline Management is possible
Workflows are very useful for business processes that:
Contain a sequence of activities.
Reoccur in the same or similar forms.
Involve several people or groups of people.
Require considerable coordination.
What are the layers in Workflow Architecture?
There are 3 layers in the Workflow Architecture:
Business Object
Business Process
Organization Model
How Process, Business Logic and People are
linked in Workflows?
The business processes are defined in Workflow builder.
Each and every small work process is called as an activity in the workflow
builder. Each activity consists of a single step task, which can be a standard
task or a workflow template.
Associated Business Logic is built in Business Objects.
i.e. ABAP code will be in Business Object. Business Objects consist of
attributes, methods and events. Methods consist of ABAP code. Each and every
standard task is associated with a Business Object and a method.
People / Group of people responsible for taking actions are
defined in organization structure. Person responsible for taking an action is
called actual
agent. It is defined in the workflow activity.
What is a Business Object?
Business object (BO) is basically collection of Attributes,
Methods and Events for a particular business entity. Example of BO: Sale Order,
Vendor, Customer, Material etc.
BOs wrap around backend tables, application code, change document and other technical information and expose them as Attributes, Methods and Events. Usually methods of BOs refer to BAPIs.
BOs wrap around backend tables, application code, change document and other technical information and expose them as Attributes, Methods and Events. Usually methods of BOs refer to BAPIs.
The following diagram explains BO much better:
What are important Transactions and Reports?
What is an Agent and what are
different types of Agent?
An agent is a person or a group of persons who can take an
action during workflow runtime. Action can be approval of some business
document, creation of some document or sending email.
There are basically three types of Agents:
Actual Agent: One who actually takes the action? This is
provided in the workflow Activity.
Possible Agent: All possible persons/entities that can
execute a task during runtime. Defines either in Org Structure or task.
Excluded Agents: Persons who are excluded from taking action
on a task. These are assigned in the workflow definition at the workflow
activity.
System checks Actual Agent defined in workflow runtime with
the Possible Agents defined in the task and the Excluded Agents. Actual Agent
should be a subset of Possible Agents minus the Excluded Agents, else Agent
resolution fails.
What are the capabilities of Workflow
Builder?
What are Events?
Events are actions that occur in the system and that acts
as trigger point for any workflow. Eg. Sales order creation. Is an event.
E.g.; consider a scenario where any sales order after
creation subject to approval from superior. So here a workflow comes into play.
The workflow needs to start whenever a Sales order is created. The business
object BUS2032 is associated to sales order creation. It has event CREATED. So
the trigger point or “START EVENTS “in the workflow is the BUS2032’s event
CREATED.
Then bind the event to the workflow so the data flows from
event to the Workflow. e.g.: Sales order is created. So for the workflow to proceed
it'll need sales order details. With binding the respective values is mapped
into the workflow container.
Then activate the linkage once you are through the workflow
creation. This is important as after this only the workflow will listen for the
event, in the sense that after this only the workflow is triggered on the
event. This is critical also as each active link adds to system load
considerably and too many workflows in the test environment can bring the
system down. So careful. Deactivate once test is over and workflow is no longer
used.
What
are the various methods of creating Events?
The various methods of creating Events are:-
- Function
module - event creation by calling function module
SWE_EVENT_CREATE or SAP_WAPI_CREATE_EVENT.
- Change documents
- Event creation when change documents are written.
- General status management
- Logistics Information System (LIS)
- Event creation upon status changes.
- Business Transaction Events
- Message Control
SWE_EVENT_CREATE or SAP_WAPI_CREATE_EVENT.
- Change documents
- Event creation when change documents are written.
- General status management
- Logistics Information System (LIS)
- Event creation upon status changes.
- Business Transaction Events
- Message Control
How
can an Event be linked with a Workflow?
Consider the start of any workflow. The START EVENTS tab is
taken through the header. The Business Object is specified and binding is
generated to the workflow to receive the values and then the link is
activated.See the pic below for the Sales Order creation as start event for a
workflow.
What
are containers, Binding and Binding Editor?
Containers are nothing but the Variables in the Workflow
that hold the values in the workflow. They can be simple variables or
structures or even objects of any class. So they are best treated as the
variables. Binding as explained above is passing the values from events, methods
and other externals sources to the container. When an event is binded to the
workflow then the data automatically flows from the Event to the Container in
the workflow. Binding editor is there as automatic binding may not always pick
up the right or desired binding or precisely the mapping generated may not be
appropriate or as required due to technical reasons which any techie can guess.
So editor gives an option to the developer to edit or generate manually.
What are important Transactions and Reports?
The area menu 'SWLD' lists all the transactions associated
with Business workflows.
SWDD - Main Workflow Builder.
PFTC - General task maintenance.
SWO1- Business Object Builder.
SBWP- The Business Workplace SWDM - Business Workflow
Explorer
SWELS - Switch Event Trace On/Off
SWETYPV - Display/Maint. Event Type Linkages
SWUS - Test Workflow
SWUI - Start Workflow
SWI6 - Workflow for Objects
SW14 - Workflows for Objects Types
SWDB - Workflow Builder - Create Workflow
SWLV - Maintain Views
TASK/TASK GROUPS
PFTC_INS - Create
PFTC_CHG - Change
PFTC_DIS - Display
PFTC_COP - Copy
PFTC_DEL - Delete
Tcodes
Related To Events
Events Creation
BSVW - Status management
NACE - Message Control
AWUW - Logistics Information System (LIS)
Event
Linkages
SWB_COND - Workflow Start Conditions
Work
item analysis
SWI2_FREQ - Work Items per Task
SWI2_DEAD - Work Items with Monitored Deadlines
SWI2_DURA - Work Items by Processing Duration
Task
analysis
SWI11 - Tasks in Workflows
SWI13 - Task profile
Exception
in binding of Task and the Method?
It is observed that when we bind a Task with any BO Method
then all the fields defined for binding are wiped out after we save the binding
i.e. if we want to see the fields taking part in binding of the TASK &
METHOD or while binding the work flow and the TASK it is observed that the
container elements and task container elements disappear even though binding is
established. This happens because of inconsistent buffer synchronization.
To overcome this issue follow the steps in SWDD.
Menu->Extras->Transport->Synchronize runtime
buffer, or go to TCODE SWU_OBUF of buffer synchronization.
On ABAP: Did you set up a workflow ? Are you familiar with all steps for setting up a workflow ?
When you activate a workflow definition , you automatically generate a runtime version. When the workflow is started (manually or automatically), the relevant runtime version is used for the execution. If the workflow definition is changed later and a new runtime version is generated, these changes do not affect workflows that are already being executed.
The Business Object Repository provides an overview of all object types in the R/3 System. You can use or extend the existing object types as well as create new object types.
It can be used as an example for demonstrating SAP Business Workflow functions, and is particularly suitable for training courses.
The direct superior of the employee is responsible for approving or rejecting the notification of absence. The R/3 System determines the direct superior automatically on the basis of the organizational plan maintained.
If the request is approved the creator is notified by mail:
If the request is not approved, the creator is informed and can decide whether to withdraw the notification of absence or revise it. If the superior has given reasons for the rejection in an attachment, the creator can take these into consideration.
If the creator revises the request, it is submitted to the superior for approval again. The applicant can also add an attachment, which can then be accessed by the superior.
This cycle is repeated until either the superior approves the leave request or the creator withdraws it.
The applicant can find out the current processing status at any time by looking in their workflow outbox.
You need an additional container element in the
workflow container to store the name of the user who will execute this
step. This user name is to be used later in the notification text that is
sent to the requester. Choose the Workflow Container (left side) and then
select the entry <Double-click to create> by double-clicking
in the Workflow Container. The dialog box for entering a container
element is displayed. Make the following entries and save:
Debugging a background Task in SAP Business Workflow
Background Task
Debugging
Background Method
Basic Function Modules in Workflows?
What are the different types of WF Agents?
1. Possible Agents
Users who are authorized to execute the task
Configured during Task definition (Org Unit, Position, User, Work Center, Role, Rule)
If a Task is configured as General Task, then all users become possible users.
2. Responsible Agents
the users to whom the work item needs to be sent.
This is set during Step definition. Note that possible agents are defined during Task definition. (Org Unit, Position, User, Work Center, Role, Rule, Container Element)
Note: The work item recipients is determined by intersection of Possible Agents and Responsible Agents.
3. Actual Agents
Actual user who executed the dialog task
4.Excluded Agents
Users who are not supposed to execute the dialog task (even if they are in possible agents)
A very good Book for learning and Practicing Workflow
What are the agent determination techniques?
Rule Resolution with responsibility: Helpful when a set of static positions are responsible for action.
Rule resolution with Function (FM): Helpful when agents are determined dynamically from business logic.
Rule resolution with OM: Usually used in CRM. Have not used
Rule resolution with Function, but asynchronously: This is through a class and a method. Initially WI is created in status ready without agent. Later agent is assigned. This is suitable for agent determination having complex logic.
Users: Rarely used.
Role: Ex: ABAP_DEVELOPER
OM objects (Position, Org Unit, work center)
Expression: A container element containing the agents.
Containers
Workflow Container:
Task Container:
SWC_GET_CONTAINER
SWC_GET_TABLE
SWC_SET_CONTAINER
SWC_SET_TABLE
Event Container:
Method Container:
Rule Container: For resolving rules
Business Objects
Key Fields:
Attributes:
Database: Automatically gets populated by system code
Virtual: You determine the content and use SWC_SET_CONTAINER to populate
Methods: Can be created using FM, Transaction, Report, Dialog Module, Other
Synchronous: Finish execution before handling the control back to the task.
Asynchronous: Return the control back immediately. Cannot have export parameters. They depend on events to return results back to the calling program.
Dialog: Something to user
Background: Cannot have messages or exceptions
what are the options to implement method of a BO?
FM
BAPI
Tcode
Dialog Module
Report
Other (BO program)
How to extend a BO?
Got SWO1 and enter a BO that you want to extend. Click on ‘New Subtype’ Give all the details.
Go back to SW01, enter the BO, and goto Settings Delegate.
Example:
BUS7051: Notification,
BUS1001: Material,
BUS2012: Purchase Order,
BUS1065: Employee
Various status of BO
Modeled: Not accessible at runtime
Implemented: Not ready to be used, Internal use only
Released: For customer to use
Obsolete: Don’t use anymore
To change attribute values from methods of a BO
SWC_GET_CONTAINER
SWC_SET_CONTAINER
Events:
How to create Events?
HR Tables: SWEHR2/3
ABAP Code user Exit: SWE_EVENT_CREATE
Change Document: SWEC
Status management:
Message Control:
Event Linkage: SWE2
Subtype:
Key field cannot be created. Methods and attributes can be created.
Delegate:
If you want to change the functionality of a method, define a sub type, redefine the method, and delegate the parent business object to child object.
Interface
Interface is a combination of Attributes, Methods and Events, to reduce the redundancy in definition.
IFSAP: Common interface for all BOs. It has following methods
Method: Display
Method: Existence Check
Attribute; ObjectType
Different Workflow Steps activities
Condition:
Multiple Conditions:
Until Loop:
Fork:
Send Mail:
Container Operations:
Event Creator:
Wait Event:
Process Control
Different deadline conditions
Requested Start: When this date is met, only then the work item will start execution, or available for taking action (dialog).
Latest Start: When a date mentioned here is met, it can send an email, or can be modeled to do something action.
Requested End: Same as Latest Start
Latest End: Same as Latest Start
Important Tcodes
Workflow Toolbox: SWUS
Simulate Event: SWU0
Business Object Repository: SW01
Event Trace: SWEL (S)
Workitems per task: SWI2_FREQ
SWUE: Event simulate
SWEL: Event log
SWELS: Set event log ON
SWE2: Linkage between Event and Workflow
SWEHR2: Event linkage in HR
SWU3: Workflow customizing
SWU_OBUF: Synchronize buffers
SWI5: Look into other user’s SBWP
What are the Important background Jobs for workflow?:
SWWDHEX For deadline monitoring
SWWERRE For error Monitoring
SWEQSRV For Event Queue Delivery
Workflow experience:
What are the workflows created by you? Worked upon by you?
Function Module that creates workflow
SAP_WAPI_START_WORKFLOW:
SAP_WAPI_CREATE_EVENT
SAP_WAPI_WORKITEM_RECIPIENTS
SAP_WAPI_GET_WORKITEM_DETAIL
When a infotype action is performed, an event should trigger, and a workflow subsequently. How can I configure it?
Tcode SWEHR2
When a infotype action is performed, an FM should trigger, and a workflow subsequently. How can I configure it?
Tcode SWEHR2
Workflow is not triggering... what can be the reason?
What are the different ways of triggering a workflow?
Triggering Events, which are set up in SWE2 (generic), SWEHR2 (HR)
SAP_WAPI_START_WORKFLOW
Workflow triggered, but it did not come to the user, why?
What are the difference between a Business Object and a Class?
How to achieve dynamic parallel processing?
There are three ways a parallel processing can be implemented
Dynamic parallel processing using a multi-line container element
Fork (3 out of 5) Work queue
In dynamic processing the type of each entry in the table have to be of same type.
Same task will be processed for each line of the multi-line container. It can be a dialog or background task. Deadline monitoring, binding, agent determination will be same for each work item generated To achieve, go to “Miscellaneous” in the activity, and enter the multi-line container element.
How to notify a user immediately in R/3 that he has got an email?
Mark the priority as ‘1’ Express
how can we debug a workflow?
If it is a dialog task, you can set breakpoint in the method called by the task
If it is a method that you want to debug, use SWO1, and create a instance of the object and debug the methods
If it is a background task, and you are in development client, you can do the following. Create an infinite loop in the method you want to debug. Go to SM50 (processes overview) and select the relevant item, and select debug from option.
Huge number of events is getting created in a short duration of time, and thus creating a huge load on the system and making it very slow. Solution?
Enable event queue. It will ensure that triggered events are received in a phased manner. This needs to be done while providing event linkages.
Why ‘Process Control’ is used? What are its features?
‘Process Control’ is used to manipulate another work item of the workflow during runtime.
‘Process Control’ is usually used to model the workflow when deadlines are reached. SAP offers 4 standard behaviors as part of process control.
Cancel Work item: Target WI is logically deleted. Subsequent tasks are not executed. Precondition is that Process control and the target WI have to be in different branches of the same fork.
Set Work item to obsolete: The target WI is set to complete, and processing continues in the branch processing obsolete.
Cancel Workflow: Current workflow is set to ‘Complete’. If this is the sub workflow, then the control goes to super-ordinate workflow.
Complete (terminate) Workflow: Same as above, but the branch of super-ordinate workflow which contains the current sub-workflow will not be continued.
Cancel Workflow including all callers: Same as above, but all callers also will be ‘COMPLETE’d.
What is the integration point with ESS Portal?
Tcode SWFVISU
Portal config file for UWL
what are the types of work items?
Dialog Work item - W
Background work item
Workflow work item
Work queue work item
missed deadline work item: When a deadline is missed a missed deadline workitem with the message appears in inbox
what the different statuses of a work item are?
Waiting
Ready
Reserved
Inprocess
Executed (‘confirm end of processing’ in task definition)
Completed
Logically deleted
Error
Difference between Asynchronous and Synchronous methods in a task
A work item created as part of synchronous in locked until end of the method execution. But in asynchronous, work item is locked only until start of method execution.
At least one terminating event is required for a task using Asynchronous task
What is the use of secondary methods in an Activity?
A modal call
Before work item executing
After work item execution
What is the BO method called for the task which calls UWL WD screens? Why?
EXTSRV --> PROCESS
What are Programmer exits? And why are they used?
What is the use of “Advance with dialog”?
If this indicator is set for an activity, workflow system checks if the processer of current task is also a recipient for next task. If yes, then the next task will be executed immediately.
Meanwhile this is a very good book if you want to learn and practice workflow. The workflow Admin chapter is invaluable if you are working in a support project.
1. Possible Agents
Users who are authorized to execute the task
Configured during Task definition (Org Unit, Position, User, Work Center, Role, Rule)
If a Task is configured as General Task, then all users become possible users.
2. Responsible Agents
the users to whom the work item needs to be sent.
This is set during Step definition. Note that possible agents are defined during Task definition. (Org Unit, Position, User, Work Center, Role, Rule, Container Element)
Note: The work item recipients is determined by intersection of Possible Agents and Responsible Agents.
3. Actual Agents
Actual user who executed the dialog task
4.Excluded Agents
Users who are not supposed to execute the dialog task (even if they are in possible agents)
A very good Book for learning and Practicing Workflow
What are the agent determination techniques?
Rule Resolution with responsibility: Helpful when a set of static positions are responsible for action.
Rule resolution with Function (FM): Helpful when agents are determined dynamically from business logic.
Rule resolution with OM: Usually used in CRM. Have not used
Rule resolution with Function, but asynchronously: This is through a class and a method. Initially WI is created in status ready without agent. Later agent is assigned. This is suitable for agent determination having complex logic.
Users: Rarely used.
Role: Ex: ABAP_DEVELOPER
OM objects (Position, Org Unit, work center)
Expression: A container element containing the agents.
Containers
Workflow Container:
Task Container:
SWC_GET_CONTAINER
SWC_GET_TABLE
SWC_SET_CONTAINER
SWC_SET_TABLE
Event Container:
Method Container:
Rule Container: For resolving rules
Business Objects
Key Fields:
Attributes:
Database: Automatically gets populated by system code
Virtual: You determine the content and use SWC_SET_CONTAINER to populate
Methods: Can be created using FM, Transaction, Report, Dialog Module, Other
Synchronous: Finish execution before handling the control back to the task.
Asynchronous: Return the control back immediately. Cannot have export parameters. They depend on events to return results back to the calling program.
Dialog: Something to user
Background: Cannot have messages or exceptions
what are the options to implement method of a BO?
FM
BAPI
Tcode
Dialog Module
Report
Other (BO program)
How to extend a BO?
Got SWO1 and enter a BO that you want to extend. Click on ‘New Subtype’ Give all the details.
Go back to SW01, enter the BO, and goto Settings Delegate.
Example:
BUS7051: Notification,
BUS1001: Material,
BUS2012: Purchase Order,
BUS1065: Employee
Various status of BO
Modeled: Not accessible at runtime
Implemented: Not ready to be used, Internal use only
Released: For customer to use
Obsolete: Don’t use anymore
To change attribute values from methods of a BO
SWC_GET_CONTAINER
SWC_SET_CONTAINER
Events:
How to create Events?
HR Tables: SWEHR2/3
ABAP Code user Exit: SWE_EVENT_CREATE
Change Document: SWEC
Status management:
Message Control:
Event Linkage: SWE2
Subtype:
Key field cannot be created. Methods and attributes can be created.
Delegate:
If you want to change the functionality of a method, define a sub type, redefine the method, and delegate the parent business object to child object.
Interface
Interface is a combination of Attributes, Methods and Events, to reduce the redundancy in definition.
IFSAP: Common interface for all BOs. It has following methods
Method: Display
Method: Existence Check
Attribute; ObjectType
Different Workflow Steps activities
Condition:
Multiple Conditions:
Until Loop:
Fork:
Send Mail:
Container Operations:
Event Creator:
Wait Event:
Process Control
Different deadline conditions
Requested Start: When this date is met, only then the work item will start execution, or available for taking action (dialog).
Latest Start: When a date mentioned here is met, it can send an email, or can be modeled to do something action.
Requested End: Same as Latest Start
Latest End: Same as Latest Start
Important Tcodes
Workflow Toolbox: SWUS
Simulate Event: SWU0
Business Object Repository: SW01
Event Trace: SWEL (S)
Workitems per task: SWI2_FREQ
SWUE: Event simulate
SWEL: Event log
SWELS: Set event log ON
SWE2: Linkage between Event and Workflow
SWEHR2: Event linkage in HR
SWU3: Workflow customizing
SWU_OBUF: Synchronize buffers
SWI5: Look into other user’s SBWP
What are the Important background Jobs for workflow?:
SWWDHEX For deadline monitoring
SWWERRE For error Monitoring
SWEQSRV For Event Queue Delivery
Workflow experience:
What are the workflows created by you? Worked upon by you?
Function Module that creates workflow
SAP_WAPI_START_WORKFLOW:
SAP_WAPI_CREATE_EVENT
SAP_WAPI_WORKITEM_RECIPIENTS
SAP_WAPI_GET_WORKITEM_DETAIL
When a infotype action is performed, an event should trigger, and a workflow subsequently. How can I configure it?
Tcode SWEHR2
When a infotype action is performed, an FM should trigger, and a workflow subsequently. How can I configure it?
Tcode SWEHR2
Workflow is not triggering... what can be the reason?
What are the different ways of triggering a workflow?
Triggering Events, which are set up in SWE2 (generic), SWEHR2 (HR)
SAP_WAPI_START_WORKFLOW
Workflow triggered, but it did not come to the user, why?
What are the difference between a Business Object and a Class?
How to achieve dynamic parallel processing?
There are three ways a parallel processing can be implemented
Dynamic parallel processing using a multi-line container element
Fork (3 out of 5) Work queue
In dynamic processing the type of each entry in the table have to be of same type.
Same task will be processed for each line of the multi-line container. It can be a dialog or background task. Deadline monitoring, binding, agent determination will be same for each work item generated To achieve, go to “Miscellaneous” in the activity, and enter the multi-line container element.
How to notify a user immediately in R/3 that he has got an email?
Mark the priority as ‘1’ Express
how can we debug a workflow?
If it is a dialog task, you can set breakpoint in the method called by the task
If it is a method that you want to debug, use SWO1, and create a instance of the object and debug the methods
If it is a background task, and you are in development client, you can do the following. Create an infinite loop in the method you want to debug. Go to SM50 (processes overview) and select the relevant item, and select debug from option.
Huge number of events is getting created in a short duration of time, and thus creating a huge load on the system and making it very slow. Solution?
Enable event queue. It will ensure that triggered events are received in a phased manner. This needs to be done while providing event linkages.
Why ‘Process Control’ is used? What are its features?
‘Process Control’ is used to manipulate another work item of the workflow during runtime.
‘Process Control’ is usually used to model the workflow when deadlines are reached. SAP offers 4 standard behaviors as part of process control.
Cancel Work item: Target WI is logically deleted. Subsequent tasks are not executed. Precondition is that Process control and the target WI have to be in different branches of the same fork.
Set Work item to obsolete: The target WI is set to complete, and processing continues in the branch processing obsolete.
Cancel Workflow: Current workflow is set to ‘Complete’. If this is the sub workflow, then the control goes to super-ordinate workflow.
Complete (terminate) Workflow: Same as above, but the branch of super-ordinate workflow which contains the current sub-workflow will not be continued.
Cancel Workflow including all callers: Same as above, but all callers also will be ‘COMPLETE’d.
What is the integration point with ESS Portal?
Tcode SWFVISU
Portal config file for UWL
what are the types of work items?
Dialog Work item - W
Background work item
Workflow work item
Work queue work item
missed deadline work item: When a deadline is missed a missed deadline workitem with the message appears in inbox
what the different statuses of a work item are?
Waiting
Ready
Reserved
Inprocess
Executed (‘confirm end of processing’ in task definition)
Completed
Logically deleted
Error
Difference between Asynchronous and Synchronous methods in a task
A work item created as part of synchronous in locked until end of the method execution. But in asynchronous, work item is locked only until start of method execution.
At least one terminating event is required for a task using Asynchronous task
What is the use of secondary methods in an Activity?
A modal call
Before work item executing
After work item execution
What is the BO method called for the task which calls UWL WD screens? Why?
EXTSRV --> PROCESS
What are Programmer exits? And why are they used?
What is the use of “Advance with dialog”?
If this indicator is set for an activity, workflow system checks if the processer of current task is also a recipient for next task. If yes, then the next task will be executed immediately.
Meanwhile this is a very good book if you want to learn and practice workflow. The workflow Admin chapter is invaluable if you are working in a support project.
On ABAP: Did you set up a workflow ? Are you familiar with all steps for setting up a workflow ?
Yes.
Execute the Txn SWDD (Creating a new Workflow).
In the header of the Workflow, define the Business Object
and Event you refer to for triggering the Wf.
Create the Steps required for your workflow(Activity).
Inside the Activity, Create the task and assign the
Business Object and the related method for that business object.
Activate the Workflow.
Have you used performance tuning? What major steps will
you use for these ?
The Main Transaction Code Involved in Performance Tuning is
SE30-Run Time Analysis and ST05-SQL Tracer.
In the 'select' statement what is "group by"?
Group by clause is used to fetch the data from the table by
the specified field
ex.select count (*) from emp table group by deptno where
deptno = 1.
It is used to find the number of employees present in the
specified department no.
SAP R/3 screens how will you develop a table
control having 3 columns with only one editable?
we can develop it by giving the code in PBO (process before
output) giving table control line = 3. it will give only 3 lines and we can
make 2 lines disable in screen painter options available in table control
Elementary search helps, Collective search help.
Elementary search helps defines a search path where we will
define the table from which the data has to be read and the selection criteria.
Through import and export parameters. Used when we gets the data rom a single
table.
Collective search helps: Combination of elementary search
helps. When we need to fetch data based on multiple selection criteria's. More
than one tables are Selection from multiple tables
Difference between Search Helps and Match Codes
search help: adding f4 functionality is search help(adding
help for any topic)
match code: adding search help for the input field is
called as math code object
Have you created database tables?
YES , IF WE HAVE CUSTOMISED DATA TO STORE IN TABLE , WE
CREATE A TABLE.
Difference between client dependent and client
independent tables?
tables which can be access by all user are client
independent (no mandt field in table)
tables which can be access by some specific user are client
dependent (use mandt field in table)
How to create client independent tables?
the table in which the first field is not mandt is the
client independent tables
mandt is the field with mandt as the data element
automatically client which we login is populated to mandt
Have you created Maintenance dialog or Table Maintenance?
At the time of creating table through, there is a check box
for table maintenance allowed.So if you want to activate the table maintenance,
just mark this box. Once table gets activated, u can change its contents
through SM30 ot Through Table Maintenance.
List the various advantages of SAP
Business Workflow
Workflow provides numerous advantages to SAP users and
consultants:
It allows consultants to create new business processes
without modifying the standard SAP code.
Workflow ensures that the tasks are executed in the correct
sequential order, involving the relevant personnel.
SAP Business Workflow may be run through the internet or
intranet web applications via the Webflow Engine.
Deadline Monitoring functionality is also incorporated
within SAP Workflow.
The timely execution of activities is guaranteed even when
a number of parties (users) are involved.
Workflow reduces both time and expense involved in managing
business activities.
What is a work item? How does it differ from a
simple SAP office mail item?
A work item is a runtime object generated by a step within
a workflow. Whenever user interaction is required, the respective users are
informed via work items. These work items will be received by the user in their
Business Workplace inbox, or other email application such as Microsoft
Outlook&rights;
The work item may be a user decision or a dialog form that
allow you to enter data for starting a process within SAP, or a confirmation of
whether a particular task may be performed. The user then chooses an
appropriate option which determines the subsequent behavior of the workflow in
question. There are a variety of applicable work items. Each work item has a
status reflecting the stage of processing at any given point in time.
A work item comprises of text explaining what action needs
to be taken, whom to refer to and any information pertinent to the business
object involved.
Unlike simple SAP office mails, work items are active
entities, as they determine the subsequent direction of the workflow. SAP
office mails can also be deleted from the inbox without viewing them whereas a
work item has to be executed to have it removed from your inbox.
What is a background work item? Are they displayed in the
Business Workplace?
A background work item (code B) represents tasks that do
not require any user interaction. They are controlled and executed
automatically by the workflow system, and do not appear in the Business
Workplace. However, you may view them using the Work Item Selection Report.
Which method is executed if space is passed for the
method parameter of macro SWC_CALL_METHOD?
The Default method of the object type is executed if a
space is passed as the method parameter value. You can find the default method
by viewing the applicable object using transaction SWO1 and going to menu
option "Goto -> Basic Data" and clicking on the Defaults tab. The
default method is located in the field "Method"
Name the tables used for storing the event linkages?
SWETYPECOU - Type Linkage Table
SWEINSTCOU - Instance Linkage Table..
SAP Workflow FAQ Techniques
What differences are there between a work item and a
notification mail?
a) The work item cannot be used to notify several users. Mails can be routed to several users, just like work items. When a mail is sent, and one recipient reads and deletes the mail, all other recipients will still have access to their own copy in their own inbox. However, when a work item is processed by one of the recipients it will automatically disappear from all the other inboxes. So you can see that a work item is unsuitable for notifying several users. It is also worth noting that a mail can be forwarded in many different ways (fax, internet...) whereas the work item cannot.
a) The work item cannot be used to notify several users. Mails can be routed to several users, just like work items. When a mail is sent, and one recipient reads and deletes the mail, all other recipients will still have access to their own copy in their own inbox. However, when a work item is processed by one of the recipients it will automatically disappear from all the other inboxes. So you can see that a work item is unsuitable for notifying several users. It is also worth noting that a mail can be forwarded in many different ways (fax, internet...) whereas the work item cannot.
b) The work item holds up the workflow
When the workflow sends a mail (usually as a background step) it continues with the process immediately after transmitting the mail. When a work item is generated, the workflow will not continue until the work item has been processed. This slows down the process. Occasionally this is what is intended (using the work item as an approval step without the ability to reject) but
usually you will better off using mails for notifications.
When the workflow sends a mail (usually as a background step) it continues with the process immediately after transmitting the mail. When a work item is generated, the workflow will not continue until the work item has been processed. This slows down the process. Occasionally this is what is intended (using the work item as an approval step without the ability to reject) but
usually you will better off using mails for notifications.
Note: You can send business objects as references with the
mail either as a business object reference attached to the mail or as an URL
(ABAP required).
What is the difference between sending a mail to a recipient
list compared to sending individual mails via a dynamic loop?
Performance. Sending 1 mail to 20 recipients will cost considerably less performance than sending 20 individual mails. If the mail is sent as a SAP Office mail (as opposed to e-mail, fax...) disk space will also be a factor because the SAP office mail will only exist once in the database, with references being created for each of the recipients.
Performance. Sending 1 mail to 20 recipients will cost considerably less performance than sending 20 individual mails. If the mail is sent as a SAP Office mail (as opposed to e-mail, fax...) disk space will also be a factor because the SAP office mail will only exist once in the database, with references being created for each of the recipients.
The only time you need to consider individual mails with a
dynamic loop is when the text of the mail varies from one recipient to another.
How do I send a standard text as an e-mail from workflow?
It is very easy sending standard text , which may include data from the workflow. You simply create a background step which sends the work item description. This may include variables which will be substituted when mail is sent.
It is very easy sending standard text , which may include data from the workflow. You simply create a background step which sends the work item description. This may include variables which will be substituted when mail is sent.
In early releases you have to create your own task based on
the method SELFITEM SendTaskDescription. In later releases a wizard is
available for creating the step and in release 4.6 there is even a step type
which does this all for you automatically.
Whichever path you take, there is very good online documentation describing exactly what has to be done.
Whichever path you take, there is very good online documentation describing exactly what has to be done.
How do I send a complex text from the workflow?
You may create mails using SAPscript. These mails can include conditions which are evaluated in order to determine which text blocks which are used in the mail. Workflow variables can be used in these conditions and workflow variables can be substituted into the body of the e-mail text.
You may create mails using SAPscript. These mails can include conditions which are evaluated in order to determine which text blocks which are used in the mail. Workflow variables can be used in these conditions and workflow variables can be substituted into the body of the e-mail text.
How do I send really complex mails from the workflow?
If you this is not enough for you will probably want to write your own ABAP routines for generating the text and generating the attachments to go with the text.
If you this is not enough for you will probably want to write your own ABAP routines for generating the text and generating the attachments to go with the text.
Use the function group SO01 which contains functions of the
form SO_*_API1 which are ideal for creating your own sophisticated messages.
There are plenty of advantages of how these are used within the SAP system.
How do I send reports?
There are wizards (Release 3.1) which will create workflows for you to send reports to a distribution list. You can specify whether the results should be transmitted or evaluated at the time the recipient wishes to view the report. It is usually better to send the evaluation because this allows the recipient to see the results instantaneously, without having to wait for the
report to execute first.
There are wizards (Release 3.1) which will create workflows for you to send reports to a distribution list. You can specify whether the results should be transmitted or evaluated at the time the recipient wishes to view the report. It is usually better to send the evaluation because this allows the recipient to see the results instantaneously, without having to wait for the
report to execute first.
Deadlines
How can I configure the workflow so that different types of messages are sent out to different people depending on how late the processing is?
Follow these steps:
How can I configure the workflow so that different types of messages are sent out to different people depending on how late the processing is?
Follow these steps:
1. Specify a deadline period for the step.
2. Specify a name for the event. This adds new branch from the step. More...
3. Add a new step to the branch which sends a mail message.
4. Add another step to the branch which sends out the second deadline warning (see mail steps above). Use deadlines in this step to configure an earliest start so that the second message is not sent until a further time has elapsed.
5. Repeat step 5 as often as you like.
2. Specify a name for the event. This adds new branch from the step. More...
3. Add a new step to the branch which sends a mail message.
4. Add another step to the branch which sends out the second deadline warning (see mail steps above). Use deadlines in this step to configure an earliest start so that the second message is not sent until a further time has elapsed.
5. Repeat step 5 as often as you like.
How can I configure the workflow so that when the deadline is
missed the workflow step is simply skipped?
This is tricky to explain but easy to implement once you know how.
Follow these steps (in later releases there is a wizard which takes you through the steps):
1. In the terminating events view of the workflow step activate the "obsolete" event and give it a name. More...
2. Specify a deadline period for the step.
3. Specify a name for the event. This adds new branch from the step. More...
4. Add a new step to the deadline path. This step must be of type "process control".
5. Select the control "Make step obsolete" and use the search help to specify the workflow step that has the deadline. Only steps with obsolete paths defined will be displayed (see step 1).
This is tricky to explain but easy to implement once you know how.
Follow these steps (in later releases there is a wizard which takes you through the steps):
1. In the terminating events view of the workflow step activate the "obsolete" event and give it a name. More...
2. Specify a deadline period for the step.
3. Specify a name for the event. This adds new branch from the step. More...
4. Add a new step to the deadline path. This step must be of type "process control".
5. Select the control "Make step obsolete" and use the search help to specify the workflow step that has the deadline. Only steps with obsolete paths defined will be displayed (see step 1).
How do I trigger a workflow with an e-mail?
You can customize the system to call a BOR method when an external mail (fax, e-mail...) arrives in the system. You BOR method should either trigger the e-meil directly or trigger an event. To customize this user exit use the transaction SCOT.
You can customize the system to call a BOR method when an external mail (fax, e-mail...) arrives in the system. You BOR method should either trigger the e-meil directly or trigger an event. To customize this user exit use the transaction SCOT.
How can I make sure that user's access their tasks via the
workflow and not via the menu or launch pad?
The routing mechanism for work items uses roles and organizational assignments to determine who receives which work item. However the routing does not provide extra authorization checks based on the routing configuration. If you want to ensure that the tasks are executed within the workflow, and not via the standard transaction, service or MiniApp, then you will have to apply your own protection.
The simplest way of doing this is to remove the standard transaction from the user's menu or Workplace role (but include it in the supervisor's role, just in case).
If you want to allow
the user to execute the task from the menu if and only if they have received
the work item then you should replace the standard transaction with your own
custom built transaction. Your own transaction simply calls the standard
transaction but performs its own authorization check first, based on the
routing mechanism used in the workflow. The routing mechanism for work items uses roles and organizational assignments to determine who receives which work item. However the routing does not provide extra authorization checks based on the routing configuration. If you want to ensure that the tasks are executed within the workflow, and not via the standard transaction, service or MiniApp, then you will have to apply your own protection.
The simplest way of doing this is to remove the standard transaction from the user's menu or Workplace role (but include it in the supervisor's role, just in case).
How to Create a Basic SAP Business
Workflow
Business Workplace and work items
Work items are displayed to the user for execution in
their Business Workplace. Work items are instances of a workflow at runtime.
Their are various types of work item. Only certain types are displayed in the
Business Workplace.
Workflow and workflow definition
A workflow
must be defined before it can be executed. This workflow definition s made up
of steps that control the workflow or refer to the tasks to be executed. You
can make additional specifications about agents and deadline monitoring for a
step. These specifications are evaluated at runtime by the work item manager. The workflow is started either
manually or by the system at runtime. For the system to start a workflow, the
workflow definition must contain a triggering event (for example the event
"material created"). When the event occurs, the relevant workflow is
started automatically.When you activate a workflow definition , you automatically generate a runtime version. When the workflow is started (manually or automatically), the relevant runtime version is used for the execution. If the workflow definition is changed later and a new runtime version is generated, these changes do not affect workflows that are already being executed.
Tasks
Tasks describe
elementary business activities. Tasks always refer to a method of an object
type. Possible agents are defined for tasks. Tasks can refer to automatically
executable methods (background tasks) or they can need a user to execute them
(dialog tasks).
Object types and objects
An object type describes the data with which you want to work
in a workflow, for example the object type Material . An object is an individual data record of an object
type. Attributes are defined for an object type, which make up
its data record (for example, material name or material number). Each object
type has methods, in which activities are defined, which can be
executed with the data (for example, create material). The transactions and
functions of the R/3 System can be called in a method as can your own
transactions or other applications. The last important component of an object
type are its events. These describe the status changes that an
object can undergo (for example, material deleted or material changed). A
workflow can be started by an event of this kind being triggered.The Business Object Repository provides an overview of all object types in the R/3 System. You can use or extend the existing object types as well as create new object types.
Demo Example: Processing a
Notification of Absence (BC-BMT-WFM)
Purpose
This workflow
template demonstrates how to process a notification of absence. It can be used as an example for demonstrating SAP Business Workflow functions, and is particularly suitable for training courses.
Process Flow
An employee enters
a notification of absence (leave request) in the R/3 System by
filling out the relevant input template.The direct superior of the employee is responsible for approving or rejecting the notification of absence. The R/3 System determines the direct superior automatically on the basis of the organizational plan maintained.
If the request is approved the creator is notified by mail:
If the request is not approved, the creator is informed and can decide whether to withdraw the notification of absence or revise it. If the superior has given reasons for the rejection in an attachment, the creator can take these into consideration.
If the creator revises the request, it is submitted to the superior for approval again. The applicant can also add an attachment, which can then be accessed by the superior.
This cycle is repeated until either the superior approves the leave request or the creator withdraws it.
The applicant can find out the current processing status at any time by looking in their workflow outbox.
Workflow Modeling
Purpose
This tutorial uses an example in a
series of easy-to-follow units to explain the most important tools in SAP
Business Workflow.
The example used here is based on a
scenario for approving a notification of absence. At the end of this
tutorial, you will have defined and executed a workflow that automatically
submits a notification of absence (leave request) to your superior for
approval, and informs the requester of the result of the approval process.
You will become familiar with the
following areas of SAP Business Workflow throughout the course of this
tutorial:
- Definition tools
- Business Workplace
- Reporting and analysis tools
- Using the Workflow Builder
Process Flow
Work through the individual units in
this tutorial in the specified order.
Important units are followed by
tests that you can use to test what you have learned to date. Please make sure
to complete these tests.
Result
Example - the notification of absence
The scenario in this example begins
with the completion of a leave request by an employee (requester or creator of
the notification of absence).
The completed form is then forwarded
automatically to the head of department (employee’s superior).
- If the head of department approves the request, the
employee receives a notification and the workflow is terminated.
- If the head of department rejects the request, the
employee can decide to revise the request (possibly in accordance with the
head of department’s wishes) or withdraw it. If the employee decides to
revise it, the request form is resubmitted to the head of department after
the revision is made.
- Step-by-Step
·
Run Transaction PPOME
1.
Find your Company (C180 will be used
in this example). Find the Sales and Marketing Organizational Unit. We will assign
SAP Users to the VP of Sales and Marketing and to Sales Rep Central positions.
2.
Right Click on the VP of Sales and
Marketing, and select Assign, from the menu.
3.
Select Holder-User from the menu.
Find and select your User Account.
4.
Repeat steps 2 and 3 for the Sale
Rep Central position (assign the same user so you can receive all messages in
this workflow exercise).
5.
Your screen will look like this:
·
Run transaction SWDD (Workflow
Builder)
1.
Drag and drop the activity Icon in
the Step Type are to the Undefined step in the Graphical Model
2.
In the Control tab, click the Task
field, click and arrow to Create a New Task.
3.
The Standard Task window will
appear. Type the information as shown in the screen below (except use your own
numbers in place of 180).
1.
From the Additional Data menu,
select Agent Assignment Maintain and assign the Sales Rep 180 (central)
position (as shown below).
1.
Save the data. In the Create Object
Directory Entry, click on the Local Object button.
2.
Go back to the Workflow Builder and
click on the Binding (does not exist) button. Then define the following
binding:
1.
Save your workflow. Give it a name
like WS_I_180 and make sure it is a local object.
2.
Let’s create another Activity and
another task for the Managerial step (approves or rejects the request), as
shown below:
1.
Maintain Agent Assignment as shown
below:
1.
Save it (select local object as in
the previous task).
1.
2.
Change the Binding to include the
following:
1.
Build (Generate Runtime Version) and
Test your workflow.
2.
THE END.
Create a workflow having custom Business object
referencing standard Business Object for Purchase Order (BUS2012). In this BO,
create a custom method for displaying PO (PODisplayNew) similar to standard method
„Display‟ and a custom event (POChanged) that should be raised whenever you
save the PO. When the user
approves/rejects the PO, a background task should run updating the custom [„Z‟]
table with status of PO as approved/rejected respectively.
Flowchart
Step-by-step procedure
Create business object Create a custom business object referencing the
standard business object „BUS2012‟ and custom event for changed PO.
a. Copy the standard business object and create a new business object OR
you can create business object by creating standard business object as
supertype and new one as subtype.
Here I have created new BO that is a copy of standard BO „BUS2012‟.
Create Event
a. Create new event under the
„Events‟ node by selecting „Events‟ and clicking on „Create‟ button.
a. Enter the required details for
the event and click the green arrow.
a. Check your event will be
created under „Events‟ node.
a. Change the status of Event as
implemented and also change the status of business object as implemented „Edità Change release status à Object type à To
Implemented‟. Then generate the business object by clicking on red and
white circle „Generate‟ on application toolbar. Now your business object will
be available for use.
Trigger Event
a. To trigger your event when the PO is changed
and saved,
i. Create a workflow template
from transaction „PFTC_INS‟. Enter „Basic Data‟.
Go to „Container‟ tab and enter the elements required for your workflow.
Note that in properties select atleast one parameter.
Finally in the „Triggering Events‟ tab, enter the event details, do the
binding and activate the event line item.
This completes your event creation process in workflow. Now for raising
and triggering the event follow step ii.
Check in „Workflow builder‟ [click on „Workflow
builder‟ button in „Basic Data‟ tab or go to „SWDD‟ transaction and enter the
workflow template id] you will see the event is created.
i. Find out the user exit that
is available for PO in case of „Save‟ event. Please note that only when the PO is saved the event should get
triggered. In this case the exit is
EXIT_SAPMM06E_013 that is invoked prior to “commit work”. Create and raise the
event for POChanged in the above mentioned exit. [Include ZXM06U44]
b. Now whenever a PO is changed and saved, the above custom event will
be triggered.
Create Method
a. Creating custom method to
display the PO.
b. Create
method in the similar way as that of event creation i.e. select „Methods‟ and
click on create. It will ask you „Create with function module as template?‟
then select „No‟ as we want to create a „Dialog‟ and „Synchronous‟ method for
displaying the PO. Change the status of method as implemented.
a. Select the method and click
on „Program‟ button. It will ask you if you want to generate a template
automatically for the missing section. Click on „Yes‟. It will navigate you to
program with begin and end of method block. Write the code for the method in
this block.
a. Once this is done click on
„Generate‟ button. Now this method could be used in the workflow task.
Create Step
Activity Step-Display PO
a. Go to workflow builder and
double click to add a new step. Select the step as „Activity‟ as we just want
to display the PO whenever the event is triggered.
Create a new task in the step and enter the business object details in
it. Save it.
. Do the binding. Once binding
is done you can see green color.
a. Assign the agents as workflow
initiator or any user whose inbox this display PO activity should go.
b. In „Task Properties‟, set the
attribute of „Agent Assignment‟ as „General Task‟ by clicking red button next
to it.
User Decision Step - Provide Approve or Reject Option
User can approve or reject the PO.
a. Create „User decision‟ step
with title „Kindly Approve or Reject the Purchase Order‟. Assign agent who will
approve or reject the PO. In this case, I have entered as workflow initiator.
Enter the „Decision Texts‟ and its „Outcome Names‟. Decision texts will appear
as buttons on the screen where agents can approve or reject the PO while the
outcome names will appear as the step text in the workflow logs.
a. After creation of above step,
you will find 2 options one as approve and other as reject.
Steps to Approve PO
a. Double click to create a step
for approve option. Select this step as „Activity‟ *[Update custom table with approve/reject]. Note that we need to
create a background step that will update the custom „Z‟ table with status as
either approved/rejected. For this we will have to first create a new method „UpdateTable‟ under „Methods‟ node in „ZCUST_PO‟
business object. In order to create task as
background, note that the method should not be a dialog method i.e. uncheck „Dialog‟ in method properties.
a. Create a „Z‟ database table with fields‟ mandt, po number, date, time,
status and description.
b. To get the value of approval or rejection from User Decision
(UD) step, you will have to create
additional step between UD step and approval activity step. This step could
be created by double clicking [or right click and create] *‘PO Approved’ i.e. the outcome name as highlighted below. Select
this step as „ContainerOperation‟ *[zapp_po]. After creation of this step
your workflow will look like as given below:
[P.S.: * indicates check the
below screenshot for step information]
d. To capture the status of PO
create container element status. In properties, check import and export
parameter.
d. Now in the „ContainerOperation‟ step for approval, enter
the following details:
4 Steps to Reject PO
Follow the same steps as of step
5.3. The only difference would be the „Expression‟ value, which will be „R‟
instead of „A‟.
Create Task
a. Now for the main background
step i.e. for updating the table, create a new task in this step with following
details:
Write the above code in business object program. Above we are declaring
a variable „Status‟ to accept approve/reject i.e. A or R value. Next get the
value of „Status‟ [container element declared in task]. This will contain the
value that will be obtained from „ContainerOperation‟ step from the workflow
container element „Status‟ [as we have done binding for task container and
workflow container].
[In the command, “SWC_GET_ELEMENT CONTAINER „STATUS‟ STATUS”, container
is the container for the element, first „status‟ is the element name and second
status is the field/variable that you have declared in the method.]
It could be seen that in the method, we are calling F.M „ZPO
_UPDATE_TABLE‟. It will have the following code in it:
Workflow Completed
Now your workflow is completed. Save it and activate it.
Test Workflow Test the workflow. Go to transaction ME22N or
ME22. Enter the PO number „4500016119‟ and change the quantity and save it. As
soon as the PO is saved, a workitem will appear in your inbox (as we have kept
the agent as workflow initiator).
Business Workspace
a. Go to SBWP to check the
workitem. „Inbox à Workflow‟ path. You will see the task
description on the right hand side.
Debugging a background Task in SAP Business Workflow
Background Task
Quite often while testing a WF (Workflow), we
come across a situation where the WF hangs at some background step but the WF
log and transaction ST22 does not show any error/dump which can help us
identify the problem.
In such cases it becomes
necessary to debug the background method that is used by the WF task in
question.
Following steps must be followed in order to
debug a background method and determine root cause of the problem.
1. Set the BO method as well as
the WF task as Dialog (both were originally required to be set as background
activities) for testing purpose.
2. Set the agent for the task as
your own user ID.
3. Set a breakpoint in the BO
method.
4. Trigger the WF. Now the step
at which the WF had stopped/hanged earlier will appear as a WI (Workitem) in
your inbox.
5. Go to the inbox and execute
the WI. Since a breakpoint was set in the BO method, debugger will start on
execution of the WI and then we can proceed with normal debugging.
6. When we are done with
debugging, BO method and WF task must be once again set to their original
status i.e. background activities.
Since debugging is one of the most basic
approaches while identifying the cause of a problem, the approach mentioned
above would be of great help in case of WF testing.
Basic Function Modules in Workflows?
SWW_WI_POPUP_FOR_COMPLETION
“shows the completed status of a workflow
SWW_ADDR_KEY_CREATE_FROM_USER
“display the address of the user or recipient
SWW_WI_DELETE
“delete work item
SWW_WI_CREATE_VIA_EVENT
“create work item as result of event
SWW_WI_DEADLINE_CHANGE
“change of deadline attribute of work item
SWW_WI_COMP_EVENT_RECEIVE
“complete work item using events
SWW_WI_REJECT
”reject work item
SWW_WI_EVENT_RECEIVE
“retrieve event for a workflow
SWW_WI_DISABLE
“lock work item against execution
SWW_WI_ENABLE
“remove lock against execution of work item
SAP
Workflow: General Transaction Code
Transaction Code
|
Description
|
SW10
|
Delivery Verification
|
SWB3
|
Maint. of Conditional Event Linkage
|
SWB_COND
|
Maint. Condit. Linkage (BC-BMT-WFM)
|
SWB_PROCUREMENT
|
Maint. Condit. Linkage (Procurement)
|
SWDC
|
Workflow Definition: Administration
|
SWDD
|
Workflow Builder
|
SWDD_CONFIG
|
Workflow Configuration
|
SWDM
|
WF: Workflow Explorer
|
SWDN
|
Number Range Maint.: SWD_WDID
|
SWE2
|
Display/Maint. Event Type Linkages
|
SWE3
|
Display Instance Linkages
|
SWE4
|
Change event log status (on/off)
|
SWE5
|
Checks for Event Linkages
|
SWEAD
|
Event Queue Administration
|
SWEC
|
Event Linkage for Change Documents
|
SWECD
|
Call RSWE_INVOKE_CHANGE_DOCU
|
SWECPLGRM
|
Configure Selective Logging
|
SWEC_OLD_VERSION
|
Linkage: Change Doc.->Workflow Event
|
SWED
|
Assignment chng.doc./WF object type
|
SWEF
|
Field Restrictions for Change Docs.
|
SWEHR1
|
Linkage: Object Type to HR Infotype
|
SWEHR2
|
Event - Infotype Operation (SAP)
|
SWEHR3
|
Event-Infotype Operation (Customer)
|
SWEINST
|
Display Event Instance Linkages
|
SWEINSTVC
|
Display Evt. Inst. Links. (W/O Sel.)
|
SWEL
|
Display event log
|
SWELOG
|
Maintain Event Log
|
SWELS
|
Switch Event Trace On/Off
|
SWEM
|
Configure Selective Logging
|
SWEO
|
Switch Event Log On/Off
|
SWEQ
|
Configure Selective Logging
|
SWEQ1
|
Batch Job Event Queue
|
SWEQADM
|
Event Queue Administration
|
SWEQADM_1
|
Queue Administrator Maintenance
|
SWEQBROWSER
|
Event Queue Browser
|
SWEQCAND
|
Maint. Trans. for Queueing Events
|
SWEQCAND0
|
Event Queue: Selected Events
|
SWEQCAND1
|
Event Queue: Excluded Events
|
SWEQCONT
|
Maintain SWEQCONT
|
SWEQDEL
|
Delete Event Queue
|
SWEQENABLE
|
Table Maintenance SWEQENABLE
|
SWEQENABLE2
|
Enable Event Queue
|
SWEQSHAREDBUF
|
Call rsweq_shared_buffer
|
SWEQUEUE
|
Maintain SWEQUEUE
|
SWEQVIEW
|
Maintain Join Event Queue, Container
|
SWETYPV
|
Display/Maint. Event Type Linkages
|
SWE_CD_TST
|
Test Environ. for Change Documents
|
SWE_SET_DELEGATION
|
Create Delegation in BOR
|
SWF3
|
WF: Workflow Wizard Repository
|
SWF4
|
WF Wizard Repository (Development)
|
SWI1
|
Selection report for workflows
|
SWI11
|
Where-Used List for Tasks
|
SWI13
|
Task Profile
|
SWI14
|
Workflows for Object Type
|
SWI2_ADM1
|
Work items without agents
|
SWI2_ADM2
|
Work Items with Deleted Users
|
SWI2_DEAD
|
Work Items With Monitored Deadlines
|
SWI2_DIAG
|
Diagnosis of Workflows with Errors
|
SWI2_DURA
|
Work Items By Processing Duration
|
SWI2_FREQ
|
Work Items Per Task
|
SWI3
|
Workflow Outbox
|
SWI30
|
Unlock Workflows
|
SWI4
|
Task Analysis
|
SWI5
|
Workload Analysis
|
SWI6
|
Workflows for Object
|
SWIA
|
Selection rep. for work items(admin)
|
SWID
|
Diagnosis of Workflows With Errors
|
SWL1
|
Settings for dynamic columns
|
SWLC
|
Check Tasks for Agents
|
SWLD
|
Workbench for Workflow 4.0
|
SWLD_INPLACE1
|
Demo Embedded Inbox
|
SWLD_INPLACE2
|
Demo Embedded Inbox (Professional)
|
SWLO
|
Display work items for objects
|
SWLP
|
Copy a Plan Version
|
SWLV
|
Maintain Work Item Views
|
SWNWIEX
|
WF Notif: Edit Work Item
|
SWO1
|
Business Object Builder
|
SWO2
|
BOR Browser
|
SWO3
|
Business Object Builder
|
SWO4
|
Business Object Repository
|
SWO6
|
Customizing Object Types
|
SWO_ASYNC
|
Asynchronous Method Call in BOR
|
SWPA
|
WFM: Runtime System Customizing
|
SWPC
|
WFM: Continue Workflow
|
SWPR
|
WFM: Restart Workflow
|
SWRK
|
Administrtation using work areas
|
SWRP
|
Dummy for IAC Workflow Status
|
SWR_WEBSERVER
|
Customizing Web Server
|
SWT0
|
Configure workflow trace
|
SWU0
|
Event Simulation
|
SWU1
|
User RFC Monitor
|
SWU10
|
Delete Trace Files
|
SWU2
|
Event RFC Monitor
|
SWU3
|
Consistency check: Customizing
|
SWU4
|
Consistency Test for Standard Task
|
SWU5
|
Consistency Test for Customer Task
|
SWU6
|
Consistency Test for Workflow Task
|
SWU7
|
Consistency Test for Workflow Templ.
|
SWU8
|
Workflow Trace: On/Off
|
SWU9
|
Display Workflow Trace
|
SWUA
|
Start Verification Workflow
|
SWUB
|
Workflow RFC destination maintenance
|
SWUC
|
Customizing decision task
|
SWUC_01
|
Document Template: Customizing
|
SWUD
|
Diagnostic Tools
|
SWUE
|
Initiate Event
|
SWUF
|
Administration of Runtime System
|
SWUG
|
Generate Workflow Start Transaction
|
SWUH
|
Test method
|
SWUI
|
Start Workflow
|
SWUI_DEMO
|
Start Demo Workflows
|
SWUI_SINGLE
|
Start Workflow (Parameter)
|
SWUI_VERIFY
|
Start Test Workflows
|
SWUJ
|
Test role
|
SWUK
|
Mapping form type - mail address
|
SWUL
|
Customizing: Process Administrator
|
SWUM
|
Create/Edit Document Template WF
|
SWUN
|
Number Range Maintenance: FORMABSENC
|
SWUOCHECK
|
Test Report for Workflow Documents
|
SWUO_DEL
|
Deletion Report for Workflow Docs
|
SWUP
|
Switch SAPforms Trace On/Off
|
SWUQ
|
SAPforms: Form Wizard
|
SWUR
|
Send mails for work items
|
SWUS
|
Shell for Starting Workflows
|
SWUT
|
Namespace for Form Transactions
|
SWUU
|
SAPforms: Diagnosis
|
SWUV
|
Send R3F Messages Once
|
SWUW
|
Number Range Maint.: SWW_WIID
|
SWUX
|
SAPforms Administration
|
SWUY
|
WF: Workflow-Message Linkage
|
SWUZ
|
WF: Generate Tasks from CATTs
|
SWU_EWBTE
|
Wizard for Event Linkage (BTE)
|
SWU_EWCD
|
Wizard for Event Linkage (Chg. Doc.)
|
SWU_EWLIS
|
Wizard for Event Linkage (LIS)
|
SWU_OBUF
|
Runtime Buffer PD Org
|
SWWA
|
Start Monitoring Report RSWWDHIN
|
SWWB
|
Restart of background job SWWDHEX
|
SWWD
|
Activate error monitoring WIs
|
SWWH
|
WIM: Delete Work Item History
|
SWWL
|
WIM: Delete Work Item
|
SWW_ARCHIV
|
Display Workflows from Archive
|
SWW_SARA
|
Archive Work Items
|
SWXF
|
Form Uses: Initial Screen
|
SWXML
|
XML Document Selection
|
SW_WW10
|
IAC Product Catalog for SAP Store
|
SWDP
|
Graphical Workflow Log
|
SWEQBROWSER
|
Event Queue Browser
|
SWF_TRC
|
Workflow Trace - Display
|
SWF_TRC_ALL
|
Workflow trace - Display All Components
|
Definition
of SAP Business Workflow
SAP Business Workflow is a tool
included with SAP Net Weaver® that can be used to define new processes and
automate processes using existing transactions and functions within SAP. SAP
Business Workflow:
Automates and monitors business
processes
Provides appropriate business
knowledge of how to perform business processes
Enables active flow of information
Bringing the right information at the
right time to the right people
Distributing work according to
business rules
Supplying exception handling and
deadline monitoring
Provides
metrics on business processes
Benchmarking,
continuous improvement, and KPI alerting
Examples of When to Use SAP Business Workflow
Process is human-centric
Workflow is people-oriented and
enables team collaboration
Example: Hiring a new employee
includes the employee, manager, payroll, IT, HR benefits and/or insurance teams
Process is repeatable
Process is iterative, may happen
occasionally to hundreds of times a day
Process happens in the same way,
following business rules and corporate policy
Example: Approvals for financial
documents must follow specific rules.
Examples
of When to Use SAP Business
Workflow (cont.)
Process needs improvement and/or
accountability
You need to do something faster,
cheaper, or with higher quality
Example: A service repair
notification needs to be addressed within 24 hours
Cost of not automating the process is
higher than implementing an automated process
Example: Cost to recall a car because
engineering change request delivered a wrong result, causing a defect
No comments:
Post a Comment