Sei sulla pagina 1di 7

[1] Question: Which actions are necessary to be able to execute a workflow?

[2] Question: Users do not receive work items in the inbox.


How can I isolate the problem?
[3] Question: How do I find out if a workflow has stopped?
[4] Question: How do I delete work items I no longer need from the system?

[1] Question: Which actions are necessary to be able to execute a workflow?

Answer: Basically, in addition to the specific Customizing actions, you always need three actions for
each workflow:

• The basic Customizing workflow in transaction SWU3 must be complete (note 547419).

• The agent assignment for each step must have been carried out. This includes entering
the possible agents with the individual tasks and the Customizing for the roles (as of 6.10:
Rules) for selecting the selected agents.

• The type linkage must be activated (for example, via transaction PFTC or SWE2) so that
the workflow is started when the trigger event is activated.

[2] Question: Users do not receive work items in the inbox.


How can I isolate the problem?
Answer: First, check in the work item overview (SWI1) if the work item was actually generated.

• If yes: Who is listed there as a selected agent? Are there error messages in the workflow
log?

• If no: Check in the event log (transaction SWEL) if the relevant trigger event was
activated (before you start the workflow, you must activate the event log using transaction
SWELS).

o If yes: Are there error messages in the event log concerning the start of the
workflow?

If yes: For more detailed information about the error, double-click on it.
If no: Check in transaction SM58 if errors were reported there.

o If no: How is the event to be triggered (change documents, status management,


message control, hard-coded)? Note that the event trigger belongs to the area of
responsibility of the relevant application.

[3] Question: How do I find out if a workflow has stopped?


Answer: The Workflow Administrator receives an email in his inbox about every incorrect workflow, with
the respective error description. He is also informed about when the system deactivates an incorrect
event linkage.
The Workflow Administrator is maintained across all systems through the basic Customizing workflow or
through transaction SWDC. However, in the Workflow Builder you can individually maintain an
administrator for each workflow in the basic data.

[4] Question: How do I delete work items I no longer need from the system?
Answer: Note that you cannot always delete work items such as e-mails from the inbox. Items only
disappear there if they were processed or if the administrator logically or actually deleted them. If you no
longer need work items, you can either delete them completely from the system using the reports from
note 49545 or, alternatively, you can archive them in the production system using the WORKITEM
archiving object, for example.

The following notes are continuously updated so that they remain up to date. It's worth checking for
updates now and then.

322526 Debugging workflows


217229 Accessing the Consultants forum for SAP Business Workflow/WebFlow
152871 Release Upgrade considerations for workflow
134322 New Workflow Academy - Course TAWF10
131795 Automatic e-mail notifications
125400 Modifying a productive Workflow
72923 Workflow interfaces
72923 Business Workflow Performance

Sending e-mails from the workflow.


There is a wizard in the workflow editor, which will help you send straightforward e-mails from the
workflow. The wizard generates a step based on the business method SELFITEM Send Task
Description. You cannot modify the business object SELFITEM and delegate so if you want to do
something more sophisticated you should build your own method in another object based on the
function modules SO_xxx_API1. These function modules are the APIs for sending mail and are fully
documented. Use the where-used list to see examples

Hints on keeping the HR model synchronized between systems.


Patience!
Troubleshooting when the workflow does not start correctly.

Case 1: When the workflow does not start.


If the workflow does not start this is either because it is not being triggered properly or the workflow
definition is not complete.
First determine how the workflow should be started. Directly? /Via a customizing table? /Via an event?
Transaction SWUD offers intelligent diagnosis help to establish if the flow was started, if the triggering
event was fired, if the flow is syntactically correct, if users are assigned to all the tasks.

Case 2: When the workflow starts twice.


The most probable cause of a workflow being started twice is that it is triggered by two separate
mechanisms simultaneously.
For example if the flow is being triggered by an event, check that this event is only firing once. For
example, you might find that it has fired once due the customizing for change documents AND once due
to the customizing of status changes. Transaction SWUD will allow you to determine how many times the
event is firing. If it is only firing once, check that the workflow is not additionally being started directly by a
program or customizing tables. Check that the workflow is not customized to trigger on two separate
events.

The workflow definition is the set of rules that determine the path that the process takes. For example,
how a purchase requisition is processed, from the initial request to the creation of the purchase order

A Workflow Instance, which is often simply referred to as the workflow, is a single workflow run. For
example, the processing of a single purchase requisition for computers.

The Tasks are the steps in the process, which have to be performed either by people or automatically by
the software. For example, to check for the availability of the spare computers in the company.

A Work item is the task instance that is performed as a single workflow step. For example, check that
there are no spare computers available in the company.

Agents are the people who process the tasks (via the work items). For example, requisitioner and a
member of the purchasing department.
Container is the place where all the data used in the workflow is collected.

Binding is the set of rules that define which data is passed to which part of the process.

Creating a step where a supervisor manually assigns an operator to another workflow step.
Use the business object WF_TASK. There are several possible methods to use. Refer to the
documentation of the methods to determine which is suitable for your task. If the task is customized as a
general task the supervisor can suggest user names directly (using wild cards), otherwise the supervisor
selects from a list of possible agents.

Different mechanisms for accessing work items.


In an early stage of the project you should consider the issue of how users are going to be notified off and
access work items. Usually this decision will not influence the definition of the workflows but there may
well be organizational issues involved, which you should consider early on. ASAP contains a table of
alternative methods. The most common being:
mySAP.com Workplace
SAP Business Workplace (previously the universal inbox)
Microsoft Outlook
Lotus Notes
e-mail
Web Inbox
The e-mail notification can be done automatically without modifying your workflow at all. For tighter
integration into other mail programs you can add form functionality for the workflow steps that will most
gain from this.

When to use asynchronous tasks?


Asynchronous tasks are often misunderstood so here's a short note about them. You'll find a fuller
description in the online documentation. Asynchronous tasks only terminate when a terminating event is
received. This makes them especially suitable for tasks where you want to be absolutely sure that the
user has done what was intended. The event is usually triggered within the method itself when the
terminating condition is met.
These cases cry out for being implemented as asynchronous tasks:
The user MUST make a change in the business object (e.g. status change)
Post-processing of the method takes place in the update task and it is essential that the workflow does
not continue until this post-processing has fully completed (e.g. creation of a business object)
Some users often perform this task directly from the menu without accessing the workflow system so
feedback via the event is essential to ensure that the workflow continues automatically.

Ensuring that your workflow is robust.


Check that your workflow definition will not stall or get confused when a user performs several tasks in
one step. Try not to dictate the order of processing with your workflow definition unless this is a
necessary part of the business process flow. Allow the users to work the way they want but make sure
that they are kept within the realms of the business process framework. Check that the workflow
synchronizes properly with other events. For example, if a purchase requisition is withdrawn the workflow
should terminate immediately and send notifications to all users involved in the process so far. Use
deadlines to ensure that the process runs through on time and that a supervisor is informed when a delay
occurs. Often the cause is simply due to illness or vacation and the task can be performed by someone
else.

Documentation issues.
Workflow is dynamic. You can change the business process without sending everyone to be retrained so
bear this in mind with your documentation. Your documentation should be written to ensure that any
changes that are made could be done easily and without upsetting any aspects of the process.

Documentation for the operational user can be made available online with a URL included in the work
item description. This documentation should contain help-line numbers, what to do if you receive a work
item intended for someone else (you've left the department), FAQs, whether the user may create ad hoc
attachments (the other users must be aware of the possibility if you want to make use of this
functionality)...
Documentation for administrators should include how to perform periodic health-checks, how to add a
new user to the process (and how to remove someone), what to do when a user is absent for a short
period of time, contingency plans, list of counterparts in different parts of the process if the process is
cross-application.

Technical documentation must include a complete catalogue of all workflows, tasks, business objects and
roles used in the process. There is ample room within the system for documentation about the individual
components but of particular importance the events. These must be documented in the system,
explaining how they are triggered (E.g. program xxx, status changes). The workflow documentation
should explain how the workflow is triggered (E.g. event, program). Subflows should be labeled as such.
Synchronization issues should be documented carefully so that changes can be made without
jeopardizing the process.

Basically I want to call a workflow from a Back Ground program. Can you tell me how to call a workflow
from a background program?

You can use the following function modules to trigger the workflow templates, in background.

SWE_EVENT_CREATE can be used to trigger an event statically, (If triggering events are defined for
your workflow template. Also check whether the event linkage is active or not)

SAP_WAPI_START_WORKFLOW can be used to trigger the workflow template directly.

This is the sample code, used in one of my objects, for calling the function module
SWE_EVENT_CREATE.

REPORT ZTESTING1.
TABLES: ZOPM_OBJKEY.
DATA:
* OBJECT KEY
OBJECTKEY TYPE SYSUUID_C,
OBJKEY LIKE SWW_CONTOB-OBJKEY.
* DEFINING THE EVENT CONTAINER
DATA BEGIN OF EVENT_CONTAINER OCCURS 0.
INCLUDE STRUCTURE SWCONT.
DATA END OF EVENT_CONTAINER
* WORKITEM LIST
DATA:
T_WID LIKE SWOTOBJID OCCURS 0 WITH HEADER LINE.
CLEAR EVENT_CONTAINER.
REFRESH EVENT_CONTAINER.
CALL FUNCTION 'SYSTEM_GET_UNIQUE_ID'
EXPORTING
DCE_COMPATIBLE = 1
IMPORTING
UNIQUE_ID = OBJECTKEY.

OBJKEY = OBJECTKEY.
CLEAR OBJECTKEY.
CALL FUNCTION 'SWC_ELEMENT_SET'
EXPORTING
ELEMENT = 'CONTEXT'
FIELD = 'UAD'
TABLES
CONTAINER = EVENT_CONTAINER
EXCEPTIONS OTHERS = 1.

CALL FUNCTION 'SWC_ELEMENT_SET'


EXPORTING
ELEMENT = 'SUBJECT'
FIELD = '3333'
TABLES
CONTAINER = EVENT_CONTAINER
EXCEPTIONS OTHERS = 1.

CALL FUNCTION 'SWE_EVENT_CREATE'


EXPORTING
OBJTYPE = 'ZPSKUMAR'
OBJKEY = OBJKEY
EVENT = 'GENERIC'
* CREATOR = ' '
* TAKE_WORKITEM_REQUESTER = ' '
* START_WITH_DELAY = ' '
* START_RECFB_SYNCHRON = ' '
* NO_COMMIT_FOR_QUEUE = ' '
* DEBUG_FLAG = ' '
* NO_LOGGING = ' '
* IDENT =
* IMPORTING
* EVENT_ID =
TABLES
EVENT_CONTAINER = EVENT_CONTAINER
EXCEPTIONS

OBJTYPE_NOT_FOUND = 1
OTHERS = 2.

IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-
MSGV3 SY-MSGV4.
ENDIF.

Useful Transactions in SAP Workflow

Transaction Code Description


OOAW Evaluation paths
PFAC_CHG Change roles
PFAC_DEL Delete roles
PFAC_DIS Display roles
PFAC_INS Create roles
PFOM Maintain assignment to SAP organizational objects
PFOS Display assignment to SAP organizational objects
PFSO Organizational environment of a user
PFTC_CHG Change tasks
PFTC_COP Copy tasks
PFTC_DEL Delete tasks
PFTC_DIS Display tasks
PFTC_INS Create tasks
PPOCW Create organizational plan
PPOMW Maintain organizational plan
PPOSW Display organizational plan
SWDA Workflow Builder (Calls the Workflow Builder in alphanumeric
mode)
SWDD Workflow Builder
SWDS Workflow Builder (Selection)
SWDD_CONFIG Workflow configuration
SBWP The Business Workplace
SWDC_DEFINITION Workflow Builder administration data
SWDC_RUNTIME Workflow runtime administration data
SWNCONFIG Extended notifications for business workflow
SWDM Business Workflow Explorer
SWEINST Evaluation and maintenance of instance linkages
SWEINSTVC Evaluation and maintenance of instance linkages
SWE2 Evaluation and maintenance of type linkages
SWE3 Evaluation and maintenance of instance linkages
SWE4 Switch event trace on/off
SWEL Display event trace
RSWELOGD Delete event trace
SWEC Link change documents to events
SWED Assign change document objects to object types
SWEQADM_1 Event queue administration
SWEQBROWSER Administration of event queue browser
SWETYPV Evaluation and maintenance of type linkages
SWI1 Selection report for work items
SWI2_FREQ Work items per task
SWI2_DEAD Work items with monitored deadlines
SWI2_DURA Work items by processing duration
SWI11 Tasks in workflows
SWI13 Task profile
SWI5 Workload analysis
SWL1 Settings for dynamic columns
SWLV Maintain work item views
SWFVISU Parameters for Work Item Visualization in the UWL
SWO1 Business Object Builder
SWO6 Customizing object types
SWR_WEBSERVER Customizing Web server
SWU_CONT_PERSISTENCE Administration of container persistence
SWU_EWCD Wizard for event creation using change documents
SWU_EWLIS Wizard for event creation using the Logistics Information
System
SWU_BTE Wizard for event creation using Business Transaction Events
SWU0 Event simulation
SWU2 RFC monitor
SWU3 Automatic Workflow Customizing
SWU4 Consistency check for standard tasks
SWU5 Consistency check for customer tasks
SWU6 Consistency check for workflow tasks
SWU7 Consistency check for workflow templates
SWU8 Switch workflow trace on/off
SWU9 Display workflow trace
SWU10 Delete workflow trace
SWUD Diagnostic tools
SWUE Trigger event
SWUI Start workflows/tasks
SWUS Testing workflows/tasks
SWXML Display XML documents
SWUY Wizard for linking messages to workflows
SWWCOND_INSERT Schedule background job for work item deadline monitoring
SWWCLEAR_INSERT Schedule background job for clearing tasks
RSWWCOND Execute single background job for work item deadline
monitoring
RSWWCLEAR Execute work item clearing work once
WF_HANDCUST Web Flow service handler maintenance
WF_EXTSRV Maintain Web Service Repository
WFWS Import WSDL
Have you synchronized your Organizational Structure (Tcode SWU_OBUF)?

Perhaps have a look at these OSS notes as they might help: 939489

Workflow: Container elements missing after an upgrade 1068627

Composite note about workflow upgrade 1058159

Elements are missing in the workflow container 843769

Behavior of SAP_WAPI_START_WORKFLOW 821919

WF: Manager not found for object type user 737423

Multiple workitems created in CATS approval workflow 675575

SAP_WAPI_START_WORKFLOW ignores task elements

In parallel, if you haven't read the Workflow book, a good website to get troubleshooting help is
http://www.workflowbook.com and their tutorials.
http://www.workflowbook.com/TransactionIndex.pdf

Potrebbero piacerti anche