You are on page 1of 24

SAP Business Workflow

What is Workflow?
Workflow is an automation tool wherein we can map the existing business process and automate it
end to end.
Benefits:
1) User initiating the process need not bother about next level approvers involved in the
process. Workflow will take care of finding the right approver and sending the
workitem/Mail for his action/information
2) Deadline monitoring is a workflow feature which helps to attach a timeline for approver to
take action. Cases where no action is taken after deadline expiry can be handled by
escalating the workitem superior or notify someone that deadline has expired. This aids for
better & faster business progress
3) Workflow ensures that the right work is brought in the right sequence at the right time to
the right people
4) SAP Business Workflow can also be used to respond to errors and exceptions - it can start
when predefined events occur(SWUY Tcode)
Automatic Workflow Customizing:
Tcode: SWU3
Purpose: Before jumpstarting with Workflow development we need to ensure that workflow
customizing settings are in place. These settings are prerequisite for proper triggering & execution of
workflow.

Fig: SWU3 Tcode

Mostly this customizing activity is done by Basis team. Reason being that SAP user id used for
this activity should have SAP_ALL & SAP_NEW authorization.

Fig: Maintain Runtime Environment

Configure RFC Destination:


The workflow runtime system always executes its tRFC (transactional RFC) calls on the logical
destination WORKFLOW_LOCAL_xxx (xxx stands for the three-digit number of the client). The
workflow runtime system only operates within one client. The naming for the logical destination
guarantees that these names are unique across the system.
Executing this activity will create the logical RFC destination WORKFLOW_LOCAL_xxx if it does
not yet exist. The user WF-BATCH is assigned to this destination.
WF-BATCH:
WF-BATCH is a background system user which should have SAP_ALL authorization. All
background activities related to workflow are executed using this user id. Perform automatic
customizing will create this user id if it does not exist in system.

Fig: Maintain Workflow System Administrator

We can maintain Workflow admin either as a Role/Org Unit/ Job/Position/Workcenter/User


as seen above. Whoever is maintained as WF Admin will get a notification mail in their
business workplace (SBWP Tcode) whenever a workflow runs into an error. Based on this
notification mail relevant troubleshooting can be done. An example error notification mail
sent to WF Admin will look as below,

From above mail we can understand that for workflow WS92000001 triggering event
TRIGGERWF of business object ZBUS2012 is not maintained. Troubleshooting for this case
will be to enable the Linkage Activated checkbox in SWE2 Tcode. This checkbox enabling
means that workflow is correctly linked to the event & will look as below,

Fig: Event Linkage activation in SWE2 Tcod

Maintain Active Plan Version:


Only one of the plan versions created in the system can be active. This plan version (with its
contents) is seen by the workflow system as the only valid plan version. 01 is set as the
active plan version.
Classify Decision Task as General:
TS00008267 Standard SAP Task for User Decision step in workflow. This task has to be
made as General task since it does not have any possible agents as standard.
Note: While maintaining agents for tasks in workflow either we need to make it as General
Task or assign possible agents for the task. General Task means that all users in the SAP
System are allowed as possible agents of these tasks. The agent restriction must be
performed by selecting Responsible Agents in the step definition.

Document Generation/Form Integration:


SAP Tasks (TS70008298, TS71007944, TS71007945, TS71007946 and TS71007954) are used
for Document from Template step & Tasks (TS70008112, TS70008113, TS70008114 and
TS70008115) are used for Form step in workflow. These tasks are made as General Task.
Maintain Time Units:
Units of measurement and time that are used by the SAP System can be maintained here.
Schedule Background Job for Missed Deadlines:
Background Job SWWDHEX is executed regularly as per the time interval maintained in this
activity to check whether new deadlines have been missed since the last time it ran.
Schedule Background Job for Work Items with Errors
There are 3 possible error types in Workflow namely Temporary error, Application error and
System error.
Temporary Error:
Error that occurs when certain system resources are not available. For e.g. Personnel no to
be processed by approver is already being processed by another user.
Application Error:
Error that occurs when an error exists in the called application. For e.g. There is no
authorization to edit the object.
System Error:
Error that occurs if there are inconsistencies between the business object type definition
and the method call. For e.g. Mandatory method parameters for the method call have not
been set.
Background Job SWWERRE is executed regularly as per time interval maintained in this
activity to,
1) Notify workflow system administrator in the event of application errors and system
errors
2) Restart background workitems with temporary errors
Schedule Background Job for Condition Evaluation:
Conditions for work item start and work item end is checked via a background job.
Background job SWWCOND is scheduled with the standard parameters in this activity.

Schedule Background Job for Event Queue:


Events used to trigger workflow are managed via Event queues. The background job for the
event queue is scheduled with the standard parameters in this activity.
Schedule background job for clearing report:
Background job SWWCLEAR is used to deletes all job logs of the following background job:
SWWCOND Work item rule monitoring
SWWDHEX Work item deadline monitoring
SWWERRE Work item error monitoring
After scheduling, the background is executed once a day at 00:00 hours.
Maintain Prefix Numbers:
An example WF template id will look as WS92100001. WS is the prefix which refers to
Workflow template id. Remaining 8 digits are made up of 2 parts. First 3 digits should be
maintained manually in this activity. Remaining 5 digits are generated automatically by SAP
which is a running no. We can define one prefix number per system (DEV/QAS/PRD) and
client (100/200 etc...).
Check Number Ranges:
This check routine determines whether there is a number range for workflow tasks and
customer tasks.
If the status of this check has the status error, we can correct the error as follows:
1. Use the report RSCLTCOP to copy all the content of the T77* tables from the client 000
into the relevant client.
2. Carry out the Customizing for personnel planning and workflow again.
Check Entries from HR Control Tables:
This check routine determines whether the Organizational Management control tables are
complete which is necessary for the workflow system to be functional.
Report RHTTCP77 is executed for the same. If there are errors in the output of report
RHTTCP77 regarding the transport objects PDST or PDWS, it means that the relevant entries
are not maintained in table SOBJ. Report RHSOBJCH can be used to rectify these errors. Note
that with these errors the workflow is executable in the current system, but crucial
information is not transported in the event of transports into other systems.
Maintain Additional Settings and Services:

Maintain Web Server:


If we want to execute workflows that use WebFlow functions (separate step type Web
Activity is available in workflow), we have to define a Web Server for the SAP System. This
step has to be maintained manually and cannot be executed automatically using Perform
automatic customizing.
Maintain Standard Domain for Internet Mail:
Questions can be created with respect to work items within the workflow system. These
questions can be answered using an e-mail to the relevant work item. The answers are
added to the work item's attachments automatically. A standard domain for the current
system is required for this function. This step has to be maintained manually and cannot be
executed automatically using Perform automatic customizing.
Activate Send to Objects and HR Objects:
If the workflow system is to send work items and mails to business objects and
organizational objects (positions, organizational units, etc.) in the Business Workplace, the
relevant functions must be activated.
Maintain Demo and Verification Environment:
Verification workflow in SWU3 Tcode and all demo workflows are declared as general.
Classify Tasks as General:

Tasks in task groups related to above scenarios like Test Workflows etc are made as General
Task.

Once Perform Automatic Customizing button is clicked, SAP system will maintain the
customizing activities automatically.

If a particular activity has been executed successfully the icon colour changes from RED to
GREEN. Later user can go to each activity & reset the default value to a different value. For
e.g. 3 minutes is default value for the background job for missed deadlines as below,

Based on our requirement we can manually change this value. Note that its MANDATORY
to ensure that Maintain Runtime Environment activity & Maintain Definition Environment
are GREEN in colour for proper functioning of Workflows.

To perform automatic customizing for Maintain Additional Settings and Services, single click
on it and then click on perform automatic customizing button. Excluding manual activities
Maintain Web Server & Maintain Standard Domain for Internet Mail other activities will
be maintained automatically. In case of Classify Tasks as General all 7 sub-activities under
this activity will be maintained automatically.

Verify automatic customization settings:


To verify the customization settings click on Start verification workflow icon as highlighted
below,

This will start a verification workflow which will finally send a mail to our inbox (SBWP
Tcode) to inform whether customizations are correct or not.

Workflow Builder
Tcode: SWDD

Area1:
Workflow template no will be displayed against Workflow field. Workflow template id starts with
prefix WS. It is followed by 8 digits which is madeof 2 parts. First part consists of 3 digit number
maintained in SWU3 Tcode under Maintain Prefix number Activity. Remaining 5 digits are running no
automatically generated by SAP. For e.g. Workflow template no for prefix no 920 can look like
WS92000001.
Version refers to the current active workflow version. Only 1 WF (Workflow)version can be active at
1 point of time. To generate a new WF version click Generate Version from menu as below,

From the version dropdown seen below we can select the version which we want.

Status: Refers to current status of the Workflow. When a new WF is created, status will be New,Not
Saved. Once WF is saved the status changes to Revised, Saved. After activation the status becomes
Active, Saved.
Import & Export Workflows:
When a workflow is exported, an XML file that contains all the content according to BPML
Specification 0.4 is written. BPML (Business Process Modelling Language) is a meta language with
which the structure of a workflow can be described. To export a workflow as an XML file, choose
Workflow -> Import/Export -> Export to XML File from the WF Builder menu.

There are many disadvantages of this export/import option since the entire workflow is not
exported/imported.
When exporting a workflow, the following parts cannot be exported according to BPML 0.4:

Triggering events

WHILE loops

Tasks that are referred to in steps

The task ID is exported as a SAP-specific extension. To receive an executable workflow after the
import of the XML file to an SAP system, the task must be contained in this SAP system.

Wait steps and event creators

If a workflow contains such step types, these are replaced by empty steps during the import and the
user receives a message that these steps have to be post-processed.

Complex conditions

Complex data types (for example, structures, object type references)

To receive an executable workflow after the import of the XML file to an SAP system, the exporting
structures and object types must be contained in this SAP system.

Modelled deadline monitoring

Activities with more than one outcome

Rules and elements of the organization management that are used as responsible agents

To receive an executable workflow after the import of the XML file to an SAP system, the rules and
elements of organization management that are referenced must be contained in this SAP system.
Once exported user will prompted to specify the location where the XML file has to be downloaded.
An XML file with name as test will look as below,

For importing the file choose Workflow -> Import/Export -> Import from XML File from the WF
Builder menu.
Area2: Any Workflow will have 2 steps Workflow Started and Workflow Completed by default. It
marks the Start and end point of a workflow. All business logic should be defined in the Undefined
Double-Click for new step region. There are several WF step types available. To insert a new step
right click on Undefined Double-Click for new step icon. A popup appears as below,

Upon selecting Create another popup listing possible WF step types appears,

Select the required step to insert it in workflow.


Area 3:
This region contains a resizable GREEN colour rectangle which is used to highlight particular step(s)
in workflow.
Area 4:
Insertable Step Types:
It contains the list of possible WF steps types that can be inserted.

Workflow Container:

All the variables which are used in workflow are created here as workflow container elements. The
lifetime of a variable is throughout the complete WF instance.

Double click on
A popup appears as below,

Enter name of the variable(also called as Workflow container element), a short name & description.
There are 3 ways to declare a WF container element. We can directly enter the datatype (for
e.g.INT1) or enter structure (SWHACTOR)/data element (AENAM) or domain name (USNAM) in ABAP
Dictionary Data Type. In ABAP Dictionary Reference, a table name (for e.g. PA0001) can be entered
in Structure field and field name can be entered in field (PERNR). We can also maintain the variable
of type business object/class name by mentioning the BO name/class name in Object Type.

In properties tab Import, Export fields are maintained. If the variable is getting its value from outside
workflow say for e.g. from BO (Business object SWO1 Tcode) or Standard/custom (for e.g.
WebDynpro ABAP or Java) application Import should be enabled. If the variable value has to be sent
outside workflow say for e.g. to BO method then export checkbox has to be enabled. If the variable
is going to be used only within workflow then both checkboxes can be left unchecked. Mandatory as
the name suggests should be enabled for mandatory variables. Enabling Multiline checkbox allows
us to pass more than 1 value (similar to internal table in reports).

Initial values for variables can be maintained in Initial Value tab. Once initial values are maintained
GREEN colour icon appears as below,

My workflows and Tasks:

It displays the list of last processed workflows.


Area 5:
Once we click CHECK icon

Or press Ctrl+F2, information, warning & error messages are displayed in this area.

Above popup shows an information message that No start events are maintained for Workflow.
Business Workplace:
Tcode: SBWP
Mails & Workitems sent to users from Workflow can be accessed in Business Workflow. Its a user
specific SAP inbox.

Users will receive mails & workitems in Inbox.

Difference between Mail and Workitem:


1) When same mail is sent to more than 1 user, each user will get a separate copy of
the mail. In case of workitem the same copy is sent to all users
2) Each user can open the mails whenever required. Its not possible to attach deadline
for a mail to be opened before a particular time. Workitems can be sent with
deadlines
3) Mails will be removed from user inbox only upon manual deletion. Workitems can
be removed only if the user takes an action on it
4) Mails are used to notify users. Workitem carry work on which users have to take
some action for e.g. Approve leave request, Release a Purchase order. Once leave
request is approved an email can be sent to employee notifying that his request has
been approved
5) Assume a workitem is sent to 3 users. When first person acts on the workitem it will
be automatically removed from the inbox of other 2 users. In case of mails all 3
users can open their mails at their own time from their inbox
6) Users can reserve the workitem by single clicking on the workitem and choosing
reserve icon. This will remove the workitem from inbox of other users and workitem
will be available only for the person who reserved it. Users can single click on the
workitem and choose replace icon. This will make the workitem available to all users
to whom it was sent. Since individual copies are sent in case of Mails
Reserve/Replace is not possible
7) Workitems are foreground steps meaning that user interaction (for e.g. approve the
request by clicking Approve button) is mandatory. Workflow generally waits for the
current workitem step to be completed before moving to the next step(Note: This
behaviour can be altered via Fork step). Since mails are notification steps Workflow
sends them in background and proceeds to the next step

To navigate to Workflow Log (SWI1 Tcode) single click on the workitem and click on
Workflow log highlighted above.

You might also like