Professional Documents
Culture Documents
BC610
R/3 System
Release 46B
27.09.2000
0
BC610 Workflow Development
BC610
Workflow Development
ã SAP AG 1999
ã SAP AG 1999
n Trademarks:
n Microsoft ®, Windows ®, NT ®, PowerPoint ®, WinWord ®, Excel ®, Project ®, SQL-Server ®,
Multimedia Viewer ®, Video for Windows ®, Internet Explorer ®, NetShow ®, and HTML Help ®
are registered trademarks of Microsoft Corporation.
n Lotus ScreenCam ® is a registered trademark of Lotus Development Corporation.
n Vivo ® and VivoActive ® are registered trademarks of RealNetworks, Inc.
n ARIS Toolset ® is a registered Trademark of IDS Prof. Scheer GmbH, Saarbrücken
n Adobe ® and Acrobat ® are registered trademarks of Adobe Systems Inc.
n TouchSend Index ® is a registered trademark of TouchSend Corporation.
n Visio ® is a registered trademark of Visio Corporation.
n IBM ®, OS/2 ®, DB2/6000 ® and AIX ® are a registered trademark of IBM Corporation.
n Indeo ® is a registered trademark of Intel Corporation.
n Netscape Navigator ®, and Netscape Communicator ® are registered trademarks of Netscape
Communications, Inc.
n OSF/Motif ® is a registered trademark of Open Software Foundation.
n ORACLE ® is a registered trademark of ORACLE Corporation, California, USA.
n INFORMIX ®-OnLine for SAP is a registered trademark of Informix Software Incorporated.
n UNIX ® and X/Open ® are registered trademarks of SCO Santa Cruz Operation.
n ADABAS ® is a registered trademark of Software AG
n The following are trademarks or registered trademarks of SAP AG; ABAP™, InterSAP, RIVA, R/2,
R/3, R/3 Retail, SAP (Word), SAPaccess, SAPfile, SAPfind, SAPmail, SAPoffice, SAPscript,
SAPtime, SAPtronic, SAP-EDI, SAP EarlyWatch, SAP ArchiveLink, SAP Business Workflow, and
(C) SAP AG BC610 0-2
ALE/WEB. The SAP logo and all other SAP products, services, logos, or brand names included
herein are also trademarks or registered trademarks of SAP AG.
n Other products, services, logos, or brand names included herein are trademarks or registered
trademarks of their respective owners.
Level 2 Level 3
BC600 2 days BC601 5 days BC610 3 days
SAP Business SAP Business Workflow
Workflow - SAP Business
Workflow - Introduction Workflow - Programming
Build and Use
BC615 3 days
SAP ArchiveLink
Archiving
ã SAP AG 1999
l Essential:
BC400 - Introduction to the ABAP Workbench
BC430 - ABAP Dictionary
BC600 - SAP Business Workflow - Introduction
BC601 - SAP Business Workflow - Build and Use
Good or very good knowledge of ABAP
l Recommended:
Basic knowledge of object-oriented programming
Basic knowledge of transaction concepts
ã SAP AG 1999
ã SAP AG 1999
l Course Goals
l Course Objective(s)
l Course Content
l Course Overview Diagram
ã SAP AG 1999
ã SAP AG 1999
l Program events
l Create check and receiver type function modules
ã SAP AG 1999
ã SAP AG 1999
Preface
Exercises
Solutions
Appendix
ã SAP AG 1999
ã SAP AG 1999
ã SAP AG 1999
Contents:
l Tasks of a workflow system
l SAP Business Workflow Architecture
l Programming in SAP Business Workflow
ã SAP AG 1999
ã SAP AG 1999
ã SAP AG 1999
l Process definition
"What happens in what order?"
Workflow builder, task definition
l Organization modeling
"Who does what?"
Organization model, role definition
l Application encapsulation
"Which objects are required?"
Business Object Builder, Business Object Repository
ã SAP AG 1999
ã SAP AG 1999
n End user support - "Work is delivered to the people responsible at the correct time ..."
n Process control - "Work is delivered in the correct sequence at the correct time ..."
ã SAP AG 1999
ã SAP AG 1999
ã SAP AG 1999
ã SAP AG 1999
Contents:
l Motivation and basic concepts
l Object definition
l Object implementation
ã SAP AG 1999
ã SAP AG 1999
ã SAP AG 1999
Business Object
Repository
ReportXX
Events
ã SAP AG 1999
Step definition
Conditional Fork
branch
Loop
Container operation
Wait for
event
Event
creator
ã SAP AG 1999
l Inheritance
Functional extension - "is a type of"
l Composition
Key extension - "is part of"
l Association
Foreign key relationship - "in relation to"
ã SAP AG 1999
Interfaces
Virtual attributes
Key Field references
fields
Object references
Attributes ABAP Code
Synchronous Transaction
Methods
Asynchronous Function module
Events Report
ã SAP AG 1999
l Data encapsulation
l Inheritance
l Polymorphism
ã SAP AG 1999
n Object definitions and implementations can only be manipulated via the Business Object Builder.
n Data encapsulation - definition: Abstraction for the modeler, irrespective of the concrete SAP tables,
transactions, etc.
n Data encapsulation - runtime: A standard interface for calling application functionality is available to
the workflow runtime system, irrespective of the actual implementation.
n Inheritance: Object properties such as attributes, methods and events are passed on to subtypes.
Properties inherited can be redefined in the subtype.
n Polymorphism: Depending on the object type, the object manager always selects the relevant
implementation for the property requested. This property is implemented technically using the "late
binding" principle.
n Dynamic call interface for calls from the workflow runtime system.
ã SAP AG 1999
n The implementation of an interface using an object type means the assurance of a particular
behavior.
n The definition of an interface can contain a specified default implementation that is used if the
including object type does not perform any implementation of its own.
n An object type that implements an interface must implement all the attributes and methods belonging
to the interface (unless there is a default implementation).
n At present, the Business Object Builder does not check whether all the components belonging to the
interface are actually implemented.
n Interfaces can also enter into inheritance relationships.
n Interfaces replace multiple inheritance. They offer the same options as multiple inheritance, but are
easier to handle (for example, no conflicts when method names are the same).
Documents
FI MM SD
IFSTATUS IFIDOCOUT
BUS2029
ã SAP AG 1999
ã SAP AG 1999
n The English ABAP Dictionary names are proposed automatically as the names of the key fields.
n Key fields must be character-based.
n The concatenated key fields can contain a maximum of 70 characters.
ã SAP AG 1999
n Database attributes are read from the associated application table and buffered in the object. Source
code is generated beforehand by the Business Object Builder for this purpose.
n Virtual attributes are calculated on calling.
n There are different macros for single-line and multiple-line attributes.
ã SAP AG 1999
n For performance reasons, virtual attributes are always preferable to reading background steps,
because the evaluation can take place directly in the workflow manager removing the need to create
a background step.
n The Business Object Builder cannot generate a source code for virtual attributes. The algorithm
required for calculation of the attribute value must therefore always be explicitly programmed.
n Typical examples:
§ language-dependent texts
§ time-dependent values
§ net/gross values
§ object references
ã SAP AG 1999
n Example:
List of purchase requisitions for a material (BUS1001.PurchaseRequisition).
l Synchronous method
n Result returned directly to calling program
n Return of exceptions possible
l Asynchronous method
n Result can only be returned via an event
n Only restricted exceptions possible
n Method itself does not wait for a possible terminating event
ã SAP AG 1999
Method
Export
Import Result
Exceptions
Caller
Time
ã SAP AG 1999
Import
Caller
Time
ã SAP AG 1999
ã SAP AG 1999
Step
(method)
ã SAP AG 1999
In the workflow definition… The exception is defined for the object method…
…as a temporary exception: …as an application
or system error:
… a subsequent step is The status of the step changes
modeled for this exception to “completed” and the
subsequent step is executed
… no subsequent step is The step is not yet completed The status of the step
modeled for this exception and remains 'in process'.and associated
workflow changes to
“error”.
Step
(method)
ã SAP AG 1999
n Background steps also offer the option of modeling a repeat counter for a temporary error.
If this repeat counter is modeled and an error occurs, the step is repeated automatically as often as
defined, before either assuming "error" or "completed" status (with subsequent execution of the
subsequent step modeled).
ã SAP AG 1999
n The buffering of the virtual attributes must be programmed explicitly in the implementation of the
attribute.
n The return of the value of a virtual attribute to the caller corresponds, in principle, to a result value of
a method.
ã SAP AG 1999
l Modeled
Not accessible at runtime.
l Implemented
Only in tests or internal use, possibly unstable.
l Released
Released for use by the customer. Only upward-
compatible enhancements possible.
l Obsolete
The functionality has been replaced. The old
functionality is still supported for two releases.
ã SAP AG 1999
n The "modeled" status is the only status in which execution is not possible. Customers should,
however, only use components with the "released" status.
n The release information should be noted when a component's status changes to "obsolete".
l Object name
Descriptive name for objects of this type
l Default method
Display for presenting an object instance
l Default attribute
Identifying attribute of an object instance
ã SAP AG 1999
n The object name is used as the element name in the container definition, for example.
n The default method is used, for example, when you double-click objects in a list of object links.
n The default attribute is used, for example, to display objects in lists.
ã SAP AG 1999
n Each object type has a program that implements the object type.
n The macro instructions required for programming are incorporated via the include <object>.
n The Business Object Builder always works with object references. These references are used to read
and manipulate the actual application data. An object reference of this kind must be created in the
calling program with the macro SWC_CREATE_OBJECT before a method is called or an attribute
determined.
n Each object program contains the variable SELF which, in turn, contains a reference to the object
instance with which the program was called.
n The object-key-sales document variable (generally: object-key-<name of key>) is declared in
conjunction with the BEGIN_DATA OBJECT macro.
n The declaration between BEGIN_DATA and END_DATA is generated entirely from the definition
data.
Attribute DocumentDate x
Attribute DocumentDate
Object type VBAK
Release 30A
Status Released
get_table_property vbak.
ã SAP AG 1999
n Source code is generated in the implementation program to read the date from the application table.
n The source code between GET_TABLE_PROPERTY and END_PROPERTY is generated entirely
from the definition data. The form select_table_<table name> is also generated automatically for the
actual database access.
n The macro EXIT_OBJECT_NOT_FOUND returns the exception "Object not found". This exception
corresponds to the T100 message OL826.
Attribute SoldToParty x
Attribute OrderingParty
Object type VBAK
Release 30A get_table_property vbak.
Status Released
data subrc like sy-subrc.
Texts
* Fill TABLES VBAK to enable Object Manager
Name Ordering party * Access to Table Properties
Description Ordering party perform select_table_vbak using subrc.
Source if subrc ne 0.
exit_object_not_found.
Virtual endif.
Database field
end_property.
ã SAP AG 1999
Attribute SalesGroup x
Attribute SalesGroup
Object type Z_Bus2032
Release 40A
Status Modeled
Texts
ã SAP AG 1999
n The data declaration is generated from the definition data and is used as a runtime buffer.
n The implementation between GET_PROPERTY and END_PROPERTY must be created manually,
since there is no other definition information. The object reference to be returned, in particular, must
be created explicitly via the macro SWC_CREATE_OBJECT.
n Both the Business Object Builder runtime buffer "object-salesgroup" and the associated container
element "SalesGroup" must be completed for data transfer.
Attribute Items x
Attribute Items begin_data object.
Object type VBAK
begin of key,
...
Release 30A
end of key,
Status Released
items type swc_object occurs 0.
end_data object.
Texts
Name
get_property items changing container.
Items
Description Sales document items
* Declare data
tables vbap.
Source data item type swc_object.
data: begin of vbap_key,
l Virtual vbeln like vbap-vbeln,
Database field posnr like vbap-posnr,
end of vbap_key.
data vbap_tab like vbap occurs 0 with header line.
Attribute properties
Multiple-line * Select data
Mandatory
select * from vbap into table vbap_tab
where vbeln = object-key-salesdocument.
Instance-independent
vbap_key-vbeln = object-key-salesdocument.
Data type referen. * Create object reference
Dictionary loop at vbap_tab.
Reference table vbap_key-posnr = vbap_tab-posnr.
Reference field
swc_create_object item 'VBAP' vbap_key.
append item to object-items.
Search help
endloop.
l Object type VBAP Sales item * Assign object reference to container element
Inverse attribute swc_set_table container 'Items' object-items.
end_property.
ã SAP AG 1999
n The data declaration is generated from the definition data and is used as a runtime buffer.
n The implementation between GET_PROPERTY and END_PROPERTY must be created manually,
since there is no other definition information. The object reference to be returned, in particular, must
be created explicitly via the macro SWC_CREATE_OBJECT.
n Both the Business Object Builder runtime buffer "object-salesgroup" and the associated container
element "SalesGroup" must be completed for data transfer.
n The actual implementation of the attribute also contains a query as to whether the runtime buffer is
completed.
Method Display x
Method Display
Object type Z_Bus2032
Release 40A
Status Implemented
Method Display x
Method Display
Name Object type Z_Bus2032
Description Release 40A
General Status
ResultABAP
type Implemented begin_method display changing container.
ã SAP AG 1999
Method DeliveryBlockReset x
Method DeliveryBlockReset
Object type Z_Bus2032
Release 40A
Status Implemented
Method Edit x
Method DeliveryBlockReset
Name Object type Z_Bus2032
Description Release 40A begin_method deliveryblockreset changing container.
General Status
ResultABAP
type Implemented
select single * from vbak
where vbeln = object-key-salesdocument.
Name ResetDelBlock
Description
if vbak-lifsk <> space.
Dialog Reset delivery block
* invoke method only if delivery lock is set
Synchron
General Result type ABAP set parameter id 'AUN'
Result para
field object-key-salesdocument.
call transaction 'VA02' and skip first screen.
Instance-ind Function module endif.
API function
VA02 Transaction end_method.
Dialog module
Report
Miscellaneous
Name VA02
ã SAP AG 1999
Exceptions
No. Object type Temp. App. Syst. AppArea Message Message text
1000 BUS1001 MA 279 & blocked by another user
7000 BUS1001 M3 195 No selectable views
ã SAP AG 1999
Overview
Dictionary
Reference table TVAK
Reference field AUART
Search help
Object type
ã SAP AG 1999
n The parameter transfer source code is generated entirely from the definition data.
n Single-line input parameters are generally read via the macro SWC_GET_ELEMENT, and output
parameters written via the macro SWC_SET_ELEMENT.
The macros SWC_GET_TABLE and SWC_SET_TABLE are used for multiple-line parameters.
Method
Method Approve
Approve x
Method Approve begin_method approve changing container.
Object type FORMABSENC
data: proc_state like swxformabs-procstate.
Release 30A
Status Released
call function 'SWX_FORMABS_APPROVE'
exporting
formnumber = object-key-number
Name Approve importing
Description Approve form proc_state = proc_state
exceptions
form_not_found = 01
General Result type ABAP
aborted = 02.
case sy-subrc.
Dictionary
Dictionary when 00.
swc_set_element container result proc_state.
Reference table SWXFORMABS
when 01.
Reference field PROCSTATE exit_return 1301 space space space space.
Search help when 02.
¡
¡ Object
Object type
type exit_cancelled.
endcase.
Multiple-line
Multiple-line end_method.
ã SAP AG 1999
n The result parameter must be set explicitly under the name "result" using the macro
SWC_SET_ELEMENT. The constant "result" is predefined and need not be defined explicitly.
Attribute SalesGroup x
Attribute SalesGroup
Object type Z_Bus2032
Release 40A
Status Modeled
Texts
ã SAP AG 1999
n The include <cntn01> must always be incorporated in the calling program. This include is also
incorporated in the implementation program via the include <object>.
n Before attribute access, an object reference must be created by calling the macro
SWC_CREATE_OBJECT. Error handling measures must be incorporated if the object reference
cannot be created.
n Attribute access for single-line attributes uses the macro SWC_GET_PROPERTY, and for multiple-
line attributes the macro SWC_GET_TABLE_PROPERTY - irrespective of whether a virtual or a
database attribute is read.
n Attributes cannot be set via macros. Object values can only be changed via methods.
n The include <cntn01> must always be incorporated in the calling program. This include is also
incorporated in the implementation program via the include <object>.
n Before attribute access, an object reference must be created by calling the macro
SWC_CREATE_OBJECT. Error handling measures must be incorporated if the object reference
cannot be created.
n The import parameters of the method must also be completed before the method call.
n The actual method call is implemented with the macro SWC_CALL_METHOD.
n The export parameters can be read after the call.
ã SAP AG 1999
n The macro number must always be included if you are working in a program with objects. The
macro is included automatically in the Business Object Builders implementation programs via
<object>.
n Only macros from <cntn01> may be used to manipulate objects and containers.
l Object reference
n Declaration
DATA: <obj_ref> TYPE SWC_OBJECT
n Creation
SWC_CREATE_OBJECT <obj_ref> <obj_type> <obj_key>
ã SAP AG 1999
l Attribute access
n SWC_GET_[TABLE_]PROPERTY <obj_ref> <attribute> <value>
l Method call
n SWC_CALL_METHOD <obj_ref> <method> <container>
ã SAP AG 1999
n An object reference must be created before an object macro is called (for example, for attribute
access or method call).
n These macros are not usually used in object implementation, but are required in the program that the
object uses.
n If the <method> is SPACE for SWC_CALL_METHOD, the default method is executed.
l Triggering exceptions
n EXIT_RETURN <exception_no> <var1> ... <var4>
n EXIT_OBJECT_NOT_FOUND
n EXIT_CANCELLED
ã SAP AG 1999
ã SAP AG 1999
n When a work item is executed, the objects in the associated container are automatically refreshed.
ã SAP AG 1999
BUS1001
Edit
Display
TS9001 TS9002 TS9003
Inheritance ZBUS1001. ZBUS1001. ZBUS1001.
Edit Display Release ZBUS1001
Edit
Display
Release
BUS1001
BUS1001
Edit
Display
TS0001 TS0002 TS9004
Delegation BUS1001. BUS1001. BUS1001.
Edit Display Release ZBUS1001
Edit
Display
Release
ã SAP AG 1999
n Problem:
How can customers use their own object extensions with the tasks, events, etc. supplied by SAP
§ Without having to change the application program where events are triggered,
§ Without having to redefine existing tasks.
n Solution:
Define subtype and delegation.
Delegation "covers" the original supertype.
Continue to use the supertype.
n Gray/Top: Behavior without inheritance
Red/Middle: Behavior with inheritance
Blue/Bottom:Behavior with delegation - the object type BUS1001 is regarded as having the
properties of Z_BUS1001 (that is, additional events, attributes and methods).
n In the Business Object Builder itself, you can only see from the basic data for a supertype whether a
delegation has been defined.
ã SAP AG 1999
1-1-3 Change the status of your object type to ‘released’. You can ignore the
message ”The method ExistenceCheck is not redefined”.
Note: If you have not completed this step, you cannot use your
object type in a task or role.
When implementing a workflow you will notice that not all customer-
specific business processes can be modeled using a business object
supplied by SAP. In these cases, you must create a new object type.
Note: The names of the object type and the program must be in the
customer namespace.
Note: The object type, object name and program name must not
contain any blank characters.
2-1-2 You must define a key field for your new object type. In a second session,
look at the key of table T001W, the lines of which each represent a plant.
Define the key of your business object based on the key of this underlying
application table.
2-1-3 Create a new attribute Name based on the field NAME1 of table T001W.
Generate the implementation for your definition with the Business Object
Builder.
2-1-4 Redefine the method Display. Do not define the method with reference to a
transaction or a function module. First, look at the implementation proposal
generated by the Business Object Builder. Then complete the
(C) SAP AG BC610 3-46
implementation of this method by copying the missing lines from the
method Display of the object type BUS0008 supplied by SAP.
When implementing a workflow you will notice that the object types
supplied by SAP do not meet your requirements fully. In these cases, you
must extend an existing object type by creating a customer-specific
subtype for it.
Supertype Z##MARA
Object type ZMARA##A
Object name MARA_##_Version_A
Name MARA ## Version A
Short description Material group ## Version A
Program ZMARA##A
Application S
Note: The names of the object type and the program must be in the
customer namespace.
Note: The object type, object name and program name must not
contain any blank characters.
3-2 Extend your new object type so that it meets additional requirements.
Note: After each definition step, also check the source code in the
implementation program of the object type.
Note: The transaction MM02 writes your changes to the database via
an update task.
Note: Use the field MATNR in table QMEL to find the quality
notifications. The object type BUS2078 supplied by SAP
implements the quality notifications.
Solution:
Object type Z00MARA
When implementing a workflow you will notice that not all customer-
specific business processes can be modeled using a business object
supplied by SAP. In these cases, you must create a new object type.
Solution:
Object type ZPLANT00
GET_TABLE_PROPERTY T001W.
DATA SUBRC LIKE SY-SUBRC.
* Fill TABLES T001W to enable Object Manager Access to Table Properties
PERFORM SELECT_TABLE_T001W USING SUBRC.
IF SUBRC NE 0.
EXIT_OBJECT_NOT_FOUND.
ENDIF.
END_PROPERTY.
When implementing a workflow you will often notice that the object
types supplied by SAP do not meet your requirements fully. In these
cases, you must extend an existing object type by creating a customer-
specific subtype for it.
Solution:
Object type Z00MARA
TABLES: T137T.
TABLES: QMEL.
TABLES: MARA.
TABLES: T006.
Contents
l Single-step tasks
l Multistep tasks
ã SAP AG 1999
ã SAP AG 1999
ã SAP AG 1999
ã SAP AG 1999
n The default role is evaluated if the task is used either outside a workflow or in a step definition
without agent assignment.
n The following texts can be defined:
§ Work item text (worklist in the Business Workplace)
§ Task description
§ Text for completion
§ Text for latest end
§ Text for latest start
§ Text for requested end
ã SAP AG 1999
Method
Export
Import Result
Exceptions
WIM
Time
ã SAP AG 1999
Dialog Update
Method
Termination
Import of the
event
WIM
EM
Enter linkage for Delete linkage for
terminating event terminating event
Time
ã SAP AG 1999
n The task is started via the work item manager (WIM). When the associated work item is created, the
WIM writes the linkages for the terminating events.
n The method is started within the task. The WIM caters for the input parameters of the method.
n The WIM waits for the end of the synchronous part of the method execution (this part takes place
within a dialog process) and can then execute actions that are independent of the terminating event.
n Once the asynchronous part of the method execution is terminated (usually within an updating
process), the WIM receives a terminating event of the task, deletes all linkages and then continues.
• Reference to
Workflow definition • Activity (task reference)
• Condition
• Definition of triggering • Multiple condition
events • Event creator
• Definition of the • Wait for event
interface (Import and • Process control
export parameters as • Container operation
elements of the • User decision
workflow container)
• Assignment of initial • Loop (until)
values • Loop (while)
• Agent assignment • Fork
for starting from the • Document from
WF development template
environment
ã SAP AG 1999
Workflow
Container
1
Start via event
2
Container operation
3
Condition
4
Wait step
5
Activity
6
Deadline monitoring
ã SAP AG 1999
n The workflow container is basically used to determine the import and export parameters of the entire
workflow and to exchange data between the individual steps.
n (1) Data from the triggering event is transferred to the workflow container as input parameters.
n (2) In a container operation as well, data is both read from (right-hand side of the allocation) and
written to (left-hand side of the allocation) the workflow container.
n (3) Data is read from the workflow container in a branch control condition.
n (4) In a wait step, data is both read from (for example, to set up the instance linkage for the event to
be received) and written to (for example, data received with the event) the workflow container.
n (5) In an activity as well, data is both read from (for example, the input parameters of the task to be
executed) and written to (for example, the output parameters of this task) the workflow container.
In addition, data is read from the workflow container to resolve the role used in the step for agent
determination.
n (6) Data is read from the workflow container for deadline monitoring (for example, the latest end).
2
Triggering
event 1
3
Role
4 5
Sync. Sync.
Task Method
7 6
8
Role
9 10 11
Async. Async. Terminating
Task Method event
13
12
ã SAP AG 1999
n (1) (11) Event creator fills event container using container macros; no binding.
n (2) Binding between triggering event and workflow containers. This binding is essential.
n (3) (8) Binding between workflow container and role container for setting the role input parameters.
This binding is essential. (This only applies if the role was entered in the step definition. In the case
of a default role in the task definition, the parameters are supplied from the work item container.)
n (4) (7) (9) (13) Binding between workflow container and task container (work item container) for
setting the input and reading the output parameters of the task. For this binding, it is irrelevant
whether the underlying task is synchronous or asynchronous. The workflow builder generates a
proposal for this binding in the step definition.
n (5) (6) (10) Binding between task and method containers. For synchronous tasks, there is a binding
for both the import and export parameters (5) and (6); for asynchronous tasks, only for import
parameters (10). If this binding is not defined in the respective task, the task container is copied to
the method container at runtime.
n (12) Binding between event and task containers. This binding is necessary if the event contains data
that was not previously contained in the task container (for example, with events from create
methods).
ã SAP AG 1999
n Required with binding for BAPI methods, for example, since BAPIs generally work with structures
while container definitions cannot contain any structures (e.g. binding between workflow and single-
step task).
n Function module entries in the binding editor via the "alternative binding" context menu.
Step 21
TS20000203 ABAP Dictionary
WS20000102 KNA1.CreateFromData Structure
Workflow Container Task container BAPIKNA101
...
Function
Function module
module
VSSF_DATAFLOW_WS20000084
VSSF_DATAFLOW_WS20000084
ã SAP AG 1999
n Example in step 21 of the multistep task WS20000102 (creating a customer via web form): The
workflow container only contains scalar values, which must be grouped together for BAPI method
KNA1.CreateFromData for structure BAPIKNA101.
This is mapped in function module VSSF_DATAFLOW_WS20000084. The scalar values from the
workflow container here are written to the appropriate structure fields of the PiAddress variables
using the container macros SWC_GET_ELEMENT and SWC_SET_ELEMEMT.
l Interface
function prog_binding
importing dataflow like swabindef-dataflow
tablescalled_container structure swcont
calling_container structure swcont
Binding
‘E’ = Export
‘I’ = Import
calling_container called_container
ã SAP AG 1999
n The DATAFLOW variable can only accept the values 'E' (export, in other words binding from the
Calling_Container to the Called_Container) and 'I' (import, in other words binding from the
Called_Container to the Calling_Container).
n The FM must not trigger exceptions.
n The FM must not trigger commits or rollbacks.
ã SAP AG 1999
ã SAP AG 1999
Unit: Tasks
Topic: Single-Step Tasks
You have either found or created all the object types that you
want to use in your business process with the associated attributes
and methods in the Business Object Builder. Now you want to
create single-step tasks based on the object methods that you can
use later in your workflow definition.
1-2-3 Test the task in two steps. Start the task in the first step as usual, but do not
change the field ‘basic material’. Instead, initiate the transaction again. Now
view the instance linkages from the work item display.
1-2-4 In the second step, change the field ‘basic material’ and search again for the
instance linkages.
You have either found or created the single-step tasks that represent the
steps in your business process. Now you want to incorporate these single-
step tasks into a workflow definition.
2-1-5 This step is to have deadline monitoring. Activate deadline monitoring for
the latest end. This is to be triggered if processing of the step is not finished
after 5 minutes. Define the workflow initiator as the message recipient if the
latest end is missed.
2-2-3 Define another input parameter LatestEndDate for your workflow. This
parameter is used to determine the latest end for the ”Edit” step.
2-2-4 Define another input parameter MaterialView for your workflow. This
parameter is used to control the view in the display step of the process.
Define view "K" as the default for this parameter.
2-2-5 Define DeadlineTest as another triggering event for your new workflow.
Define the binding between the event parameters and the input parameters
of the workflow. Activate the event linkage.
2-2-6 The latest end for the ”Edit” step should be on the date determined via
LatestEndDate, five minutes after the current time. Ensure in your
workflow definition that this parameter cannot contain a deadline in the
past.
2-2-7 In the display step, replace the original task Z##MatDisp with the task
Z##MatDispV Supply the step parameter for controlling the display view
with the value of the MaterialView parameter from the workflow container.
2-2-8 Check, save, activate and test your new workflow both by starting it from
the development environment and by triggering the new triggering event
explicitly.
2-3 Optional extensions: Alternative binding
2-3-1 Create a function module Z##_BIND_WF_TO_DISPLAY_STEP for an
alternative binding between the workflow container and the task container
of the display step.
Note: You only require one binding from the workflow to the task
container of task Z##MatDispV.
2-3-2 Enter your new function module as an alternative binding for the display
step in your workflow definition Z##MSIPROC2.
Unit: Tasks
Topic: Single-Step Tasks
Solution:
TS30900005 – Z00MatDisp
Solution:
TS3090006 – Z00MatEdit
1-3 Create a new standard task for displaying a material master from a particular view.
Solution:
TS98000008 – Z00MatDispV
You have either found or created the single-step tasks that represent the
steps in your business process. Now you want to incorporate these single-
step tasks into a workflow definition.
FUNCTION Z00_BIND_WF_TO_DISPLAY_STEP.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(DATAFLOW) LIKE SWABINDEF-DATAFLOW
*" TABLES
*" CALLED_CONTAINER STRUCTURE SWCONT
*" CALLING_CONTAINER STRUCTURE SWCONT
*"----------------------------------------------------------------------
DATA: MAT_OBJECT TYPE SWC_OBJECT.
DATA: MAT_VIEW LIKE T132T-STATM.
IF DATAFLOW EQ 'E'.
" only consider export dataflow from wf to wi container
" read data from workflow (= calling) container
SWC_GET_ELEMENT CALLING_CONTAINER 'MaterialMaster' MAT_OBJECT.
SWC_GET_ELEMENT CALLING_CONTAINER 'MaterialView' MAT_VIEW.
" write data to work item (= called) container
SWC_SET_ELEMENT CALLED_CONTAINER WI_LEADING_OBJECT
MAT_OBJECT.
SWC_SET_ELEMENT CALLED_CONTAINER 'MaterialView' MAT_VIEW.
ENDIF.
ENDFUNCTION.
Contents:
l Determining agents via role function modules
ã SAP AG 1999
ã SAP AG 1999
ã SAP AG 1999
ã SAP AG 1999
n Roles are used to restrict or define more closely the number of recipients according to business
considerations.
n Benefits:
dynamic restriction of the number of possible agents
actual organizational plan does not need to be known
agents determined according to current conditions (role resolution at runtime)
n The definition of a role contains
the specification of the rules for role resolution (–> function module), and
the specification of the runtime-dependent role parameters required for role resolution.
n Role definition, use of roles and role resolution using the role "Superior of…." as an example.
n The roles "Manager" and "sap_org_unit" are supplied by SAP.
ã SAP AG 1999
n The role container must be filled with a binding. If the role is used in a step, data can be transferred
from the workflow container. If the role is used as the default role of the task, data can be transferred
from the task container.
n The function module must have the interface outlined above.
include <CNTN01>.
loop at dli_entries.
where member_typ eq space.
actor_tab-otype = 'US'.
actor_tab-objid = dli_entries-member-nam.
append actor_tab.
endloop.
endfunction.
ã SAP AG 1999
l First level:
Task profile
l Second level:
Determination of the agent responsible or
default role of task
l Third level:
Removal of excluded agents
ã SAP AG 1999
n The next level above may only contain one further restriction of the level below. Therefore, if the
first level is missing because the task profile was not maintained, agents cannot be found in the
subsequent levels.
n Unlike Emails, the work items derived from the tasks are not delivered as copies. Instead, precisely
one work item exists for all recipients who only have one view of it.
n The explicit definition of possible agents in the task definition can be replaced by the classification
as a "general task". In this case, all users known in the system can process the task.
n If a role is specified both in the step definition and in the task definition, the role in the step
definition overrides the default role from the task definition.
n Users that are not a possible agents of the task can never see the WI, even if they are agents
responsible because of a role resolution.
n The default role of a task is also evaluated if the agent determination via a role in the step definition
ends without a result, and the flag "cancel if role resolution has no result" is not set for this role.
ã SAP AG 1999
Unit: Roles
Topic: Role Definition and Implementation
1-1-2 Now define the role using the new function module. Define the parameters
for this role according to the implementation of your function module.
Note: The role parameters are defined via the role container.
Note: The workflow initiator can be defined with reference either to
field WFSYST-INITIATOR or to RHOBJECTS-OBJECT.
1-1-3 Use the newly created role for the agent assignment of the “display” step in
your workflow Z##MSIPROC2.
Unit: Roles
Topic: Role Definition and Implementation
Solution:
AC30900129 – Z00MatDispAc
Function module Z00_MM_MGR_OR_USER_GET
Organizational structure
O 00003100 Plant Chicago
----- S 50014947 Project Leader Engineering
----- P 00010810 Kimberley Hughes
----- US WF-BC-MGR Kimberley Hughes
----- S 50011158 Electrical Engineer
----- P 00010812 Caroline Douglas
----- US WF-BC-CLERK Caroline Douglas
FUNCTION Z00_MM_MGR_OR_USER_GET.
*"----------------------------------------------------------------------
*"*"Local interface:
*" TABLES
*" ACTOR_TAB STRUCTURE SWHACTOR
CASE MATERIAL_TYPE.
WHEN 'ROH'. " get manager of wf_initiator from role
SWC_SET_ELEMENT AC_CONTAINER 'ORG_OBJECT' WF_INITIATOR.
CALL FUNCTION 'SWX_GET_MANAGER'
TABLES
ACTOR_TAB = ACTOR_TAB
AC_CONTAINER = AC_CONTAINER
EXCEPTIONS
NOBODY_FOUND = 1.
IF SY-SUBRC NE 0.
RAISE NOBODY_FOUND.
ENDIF.
WHEN OTHERS.
ACTOR_TAB = WF_INITIATOR.
APPEND ACTOR_TAB.
ENDCASE.
ENDFUNCTION.
Contents:
l Event Manager
l Triggering events explicitly
l Receiving events
ã SAP AG 1999
ã SAP AG 1999
ã SAP AG 1999
l Shift of complexity
l Greater flexibility
l Easier to extend and integrate
l Greater transparency
ã SAP AG 1999
n The complexity and management of general information are shifted from the applications to a central
component. The information on possible linkages is no longer in the applications.
n Linkages can be easily activated and deactivated at runtime.
n New linkages can be easily integrated without changing the source code of the application. External
components can also be connected.
n The transparency of the entire system is enhanced by disclosing general information.
n Examples of applications include:
Starting workflows from the application (flexible linkage)
Terminating steps with updating (integration)
Waiting for concurrent actions (integration, transparency)
ã SAP AG 1999
n Linkages are entered according to the principle of "publish and subscribe", meaning that the creator
publishes the event without considering possible receivers. The number of receivers makes no
difference for the creator.
Interested receivers have to "subscribe" with the event manager (EM).
n Linkages are evaluated by the EM according to the ECA paradigm. The event is triggered (E), the
linkage tables are checked and, if necessary, check function modules are called (C), and finally the
receivers found are notified (A).
In accordance with the object-oriented approach for the creators, a hierarchical evaluation of the
linkage is implemented.
n By means of the check and receiver type determination function modules, an option exists for a
dynamic evaluation of the linkage.
n Triggered events are evaluated immediately, meaning the receiver is called immediately. The events
are not stored temporarily.
n The event is only triggered by an SAP Commit (ABAP keyword COMMIT WORK); an implicit
database commit is not sufficient. Triggering does not take place after a ROLLBACK WORK.
n Event linkages from the workflow that have errors are deactivated automatically when an error is
discovered. In addition, a mail is sent to the system administrator for workflow.
ã SAP AG 1999
n Without an explicit commit work, the events "do not take place" (transactional property).
n A new login is carried out for the event receivers with each destination (RFC property).
n The transactional RFC (tRFC) log can be read via transaction SM58.
FB swe_event_create Evaluation of
linkage tables
Call receiver
type FM
Call
check FM
Commit Work
Call
receiver FM
n The receiver type FM and check FM run in the creator's context in order to avoid superfluous tRFCs.
ã SAP AG 1999
n An entry in the type linkage table is always required if a receiver is to be notified. Maintenance takes
place either explicitly or internally via FMs. The latter is always the case if task-related linkages are
entered (for example, for triggering or terminating events of tasks). When making entries within the
task definition, the linkage has to be activated explicitly.
The table entries can be transported, but the transport is usually carried out without the 'Enabled'
flag. Therefore the linkages usually have to be activated explicitly in the target system.
n If the 'Enabled' flag is explicitly to be transported, this is possible via the general transport
connection of the generated view maintenance.
n All linkages are client-specific.
n Type linkages for triggering events are entered by the workflow definition system when the linkage
is activated in the task definition, if no check or receiver type function modules are used. If at least
one such function module is required, the linkage must always be entered manually (as part of
Customizing for the respective workflow).
n Type linkages for terminating events are entered automatically by the workflow runtime system
when the associated work item is created, if no check or receiver type function modules are used. If
at least one such function module is required, the linkage must always be entered manually (as part
of Customizing for the respective workflow).
ã SAP AG 1999
n The instance linkage table is only evaluated if the associated type linkage is active and not global.
Maintenance only takes place via function modules, the corresponding WF-related entries (for
example, for terminating events of a step) are entered and deleted automatically by the WF runtime
system.
The table entries are never transported.
n All linkages are client-specific.
ã SAP AG 1999
ã SAP AG 1999
n All triggered events are entered, irrespective of whether and how many receivers were found. A
separate entry is made for each receiver.
Errors in the check and receiver type function modules are also logged.
n Internally, the trace is regarded as an additional receiver which is always triggered. It is independent
of the commit behavior of other (explicit) receivers.
n Updating and writing the trace is time consuming because a separate tRFC is triggered. For this
reason, the trace should be deactivated in live systems (see note 46358).
n You can restrict the writing of the trace to selected object types or events.
ã SAP AG 1999
n Events must be defined in the Business Object Builder for the relevant object type. Not all defined
events must be triggered, but all triggered events must be defined.
n Implicit triggering via change documents does not require any ABAP coding. Customizing activities
for the triggering application are necessary instead.
Explicit triggering via function modules requires the source code of the application to be changed or
extended.
Important: the function module SWE_EVENT_CREATE can trigger exceptions. If these are not
caught by the triggering application, a runtime error occurs.
n The triggering modules do not execute COMMIT WORKs themselves. It is the task of the triggering
application to issue a COMMIT WORK at the right time.
n Events with user-defined parameters must always be triggered explicitly if these parameters are to be
set.
n SWE_EVENT_CREATE - event triggered immediately. SWE_EVENT_CREATE_IN_UPD_TASK
- as SWE_EVENT_CREATE, but defined as updating function module.
SWE_EVENT_CREATE_FOR_UPD_TASK - as SWE_EVENT_CREATE, but is required if the
object that triggers the event is not generated via the application until the update.
n Explicit triggering via function modules usually takes place in customer systems by the customer
programming an existing user exit.
ã SAP AG 1999
n Important:
If the event is triggered in a user exit, a COMMIT WORK usually must not be programmed here,
since this would destroy the commit logic of the application.
include <CNTN01>.
ã SAP AG 1999
include <CNTN01>.
data: object_key like sweinstcou-objkey.
swc_container evt_container.
object_key = '000012345678'.
* Trigger the event
call function 'SWE_EVENT_CREATE'
exporting
objtype = 'Z_BUS1001'
objkey = object_key
event = 'created'
tables
event_container = evt_container
exceptions
others = 01.
ã SAP AG 1999
n The event is triggered for the subobject type as well as for all supertypes for which the event is
defined.
l Interface
function receiver_fm
importing objtype like swetypecou-objtype
objkey like sweinstcou-objkey
eventlike swetypecou-event
rectype like swetypecou-rectype
tables event_container structure swcont
l Process in separate context
ã SAP AG 1999
n If possible, the function module should not trigger any exceptions, since these are only recorded
directly in the tRFC log. If this occurs, workflow receiver function modules send an error message to
the system administrator for workflow.
n Example of a function module: SWW_WI_START_VIA_EVENT
n In the case of propagated events, the default parameter _EVT_OBJTYPE contains the triggering
object type (that is, the subtype), while the interface parameter OBJTYPE contains the propagated
object type (that is, the supertype).
This also applies to the check and receiver type function modules.
n _EVT_OBJECT always contains the triggering object type!
ã SAP AG 1999
function check_object_type_idocappl.
l Read event parameters *************************************************
* importing objtype like swetypecou-objtype
from event container *
*
objkey
event
like
like
sweinstcou-objkey
swetypecou-event
* rectype like swetypecou-rectype
l Check condition * tables event_container structure
* exceptions check_failed
swcont
*************************************************
ã SAP AG 1999
ã SAP AG 1999
function cvwf_event_rec_dokst_get.
********************************************************
* importing objtype like swetypecou-objtype
l Read event parameters *
*
objkey
event
like sweinstcou-objkey
like swetypecou-event
* generic_rectype like swetypecou-rectype
from event container * exporting rectype like swetypecou-rectype
* tables event_container structure swcont
* exceptions no_rectype
l Determine the receiver ********************************************************
include <CNTN01>.
type on the basis of data: l_dokst like draw-dokst.
application-specific data: begin of drawkey,
dokar like draw-dokar,
doknr like draw-doknr,
settings dokvr like draw-dokvr,
doktl like draw-doktl,
l Trigger an exception or
end of drawkey.
* Implementation of receiver type fm
end function module * Read document status from event container
swc_get_element event_container
'DOCUMENTSTATUS' l_dokst.
drawkey = objkey.
ã SAP AG 1999
n If the event is triggered before the object data is written to the database, the object attributes are not
available yet for querying, since the database is accessed when the attributes are evaluated by the
Business Object Builder.
This may occur, for example, if the event is triggered implicitly when generating the object (that is,
via change documents, status management, etc.) and the object is not generated until later in
updating.
ã SAP AG 1999
1-1 Recall the effect of the entries in the type linkage table.
1-1-1 Ensure that your two workflows are correctly linked to the event
OldMaterialChanged of your object type.
1-1-2 Simulate the event OldMaterialChanged. Check the output of the simulation
tool.
1-1-3 Check the event trace for entries for the event DeadlineTest for your object
type that you had triggered in an earlier task.
1-1 Recall the effect of the entries in the type linkage table.
1-1-1 Ensure that your two workflows are correctly linked to the event
OldMaterialChanged of your object type.
Solution:
Z00EVTCR
REPORT Z00EVTCR.
PARAMETERS:
OBJTYPE LIKE SWETYPECOU-OBJTYPE DEFAULT 'Z00MARA',
MATERIAL LIKE MARA-MATNR,
EVENT LIKE SWETYPECOU-EVENT DEFAULT
'DEADLINETEST',
END_DATE LIKE SYST-DATUM DEFAULT SPACE.
OBJKEY = MATERIAL.
(C) SAP AG BC610 6-26
* write parameter into event container
IF EVENT EQ 'DEADLINETEST' AND END_DATE EQ SPACE.
END_DATE = SY-DATUM + 1.
ENDIF.
SWC_SET_ELEMENT EVENT_CONTAINER 'LatestEndDate' END_DATE.
IF SY-SUBRC NE 0.
WRITE : / 'Object type', OBJTYPE, 'unknown'.
ELSE.
IF EVENTID NE 0.
WRITE : / 'At least one receiver found'.
COMMIT WORK.
ELSE.
WRITE : / 'No receivers found'.
ENDIF.
ENDIF.
Solution:
Z00_CHECK_MATERIAL_CHANGEDBY
FUNCTION Z00_CHECK_MATERIAL_CHANGEDBY
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(OBJTYPE) LIKE SWETYPECOU-OBJTYPE
CONSTANTS:
MY_SAMPLE_MATERIAL_ROH LIKE MARA-MATNR VALUE '200-110',
MY_SAMPLE_MATERIAL_FERT LIKE MARA-MATNR VALUE '200-101',
MY_SAMPLE_MATERIAL_HALBLIKE MARA-MATNR VALUE '200-100',
MY_OWN_USER LIKE SY-UNAME VALUE
'WF-BC-CLERK'.
DATA:
MY_SAMPLE_MATERIALS LIKE MARA-MATNR OCCURS 3 WITH HEADER LINE.
DATA: OBJECT TYPE SWC_OBJECT.
DATA: CHANGER LIKE MARA-AENAM,
USER_ACT LIKE SWHACTOR,
USER LIKE SY-UNAME.
2-3 Optional extensions: Create a receiver type function module to decide depending
on runtime data which of your two workflow definitions is to be started.
Solution:
Z00_RECTYPE_DETERMINE_MATTYPE
FUNCTION Z00_RECTYPE_DETERMINE_MATTYPE.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(OBJTYPE) LIKE SWETYPECOU-OBJTYPE
*" VALUE(OBJKEY) LIKE SWEINSTCOU-OBJKEY
*" VALUE(EVENT) LIKE SWETYPECOU-EVENT
*" VALUE(GENERIC_RECTYPE) LIKE SWETYPECOU-RECTYPE
*" EXPORTING
*" VALUE(RECTYPE) LIKE SWEINSTCOU-RECTYPE
*" TABLES
Contents:
ã SAP AG 1999
ã SAP AG 1999
ã SAP AG 1999
Definition
Task Workflow
BOR System
definition definition
create
Object Work item Workflow Runtime
manager manager manager System
Application Event
manager
ã SAP AG 1999
Definition
Task Workflow
BOR System
definition definition
execute create
Object Work item Workflow Runtime
manager manager manager System
Application Event
manager
ã SAP AG 1999
Definition
Task Workflow
BOR System
definition definition
execute create
Object Work item Workflow Runtime
manager manager manager System
invoke
Application Event
manager
ã SAP AG 1999
Definition
Task Workflow
BOR System
definition definition
execute create
Object Work item Workflow Runtime
manager manager manager System
invoke
Application Event
result manager
ã SAP AG 1999
Definition
Task Workflow
BOR System
definition definition
execute create
Object Work item Workflow Runtime
manager manager manager System
invoke result
Application Event
result manager
ã SAP AG 1999
Definition
Task Workflow
BOR System
definition definition
execute create
Object Work item Workflow Runtime
manager manager result manager System
invoke result
Application Event
result manager
ã SAP AG 1999
Definition
Task Workflow
BOR System
definition definition
execute create
Object Work item Workflow Runtime
manager manager manager System
invoke
Application Event
manager
ã SAP AG 1999
Definition
Task Workflow
BOR System
definition definition
execute create
Object Work item Workflow Runtime
manager manager manager System
invoke result
Application Event
manager
ã SAP AG 1999
Definition
Task Workflow
BOR System
definition definition
execute create
Object Work item Workflow Runtime
manager result manager manager System
invoke result
Application Event
manager
ã SAP AG 1999
Definition
Task Workflow
BOR System
definition definition
execute create
Object Work item Workflow Runtime
manager result manager result manager System
invoke result
Application Event
manager
ã SAP AG 1999
Definition
Task Workflow
BOR System
definition definition
execute create
Object Work item Workflow Runtime
manager result manager result manager System
Application Event
result manager
ã SAP AG 1999
n The workflow manager (WFM) reads the workflow definition and the step definition and creates one
work item (WI) per step using the work item manager (WIM). The WFM is then finished.
n The WIM manages the WI and triggers the application via the object manager (OM).
n If the underlying method is synchronous, the result and the export parameters of the method are
returned to the WIM via the OM.
If the underlying method is asynchronous, the result of the method is returned to the WIM via an
event that is triggered in the event manager (EM). This event must be defined as a "terminating
event" for the step.
n After receiving the return parameters, the WIM checks the return code and, if successful, returns the
data to the WFM.
n This loop continues until the end of the workflow is reached.
n Event creator, conditions, process control and container operations are executed locally in the WFM
without a work item being created.
ã SAP AG 1999
ã SAP AG 1999
ã SAP AG 1999
ã SAP AG 1999
n A work queue work item is a "logical unit" of objects and tasks that are to be executed together. Both
objects and tasks can be different.
n A background work item is used to execute tasks that do not require dialog. They are automatically
executed by the WF system and do not appear in the Business Workplace.
n A container anchor work item serves as logical link joining several associated objects. It corresponds
to the assignment table from WF21. It does not possess its own semantics and never appears in the
Business Workplace.
n A deadline monitoring work item is created by default when the WF system detects that a deadline
has been missed.
n A wait step work item receives events generated externally or by other WIs. A wait step has no
processing logic and does not appear in the Business Workplace.
n A workflow work item represents a workflow to be processed, the definition of which is then
processed via the WFM.
n A dialog work item represents a step in a WF that is to be executed by a user.
ã SAP AG 1999
n The WI language determines the language of the short text and the status texts. The language of the
long text is determined by the user's logon language.
n When a workflow is started via an event, the language of the event is passed on to the workflow.
n Under "Personal workflow settings" in the Business Workplace, the user can set whether his or her
work items in the Business Workplace always appear in the logon language. In this case, all WI texts
are put into the user's current logon language when the Business Workplace is compiled. This setting
reduces performance considerably, however.
l WAITING - waiting
l READY - ready
l SELECTED - reserved
l STARTED - in process
l COMMITTED - executed
l ERROR - error
l COMPLETED - completed
l CANCELLED - logically deleted
ã SAP AG 1999
n A WI has the status WAITING if its requested start has not yet been reached. With this status it
cannot be seen by any user.
n A WI with status READY appears in the Business Workplace of the recipients. WIs running in the
background with this status are executed immediately.
n The status SELECTED only applies to dialog and work queue work items. It means that the WI has
been reserved by one of the recipients and therefore disappears from the Business Workplace of the
others.
n When the underlying method has been started but not yet completed, the WI has the status
STARTED. The WI remains in the Business Workplace of the current agent.
n If the underlying method has been executed successfully but the WI has to be set to 'done' manually,
it has the status COMMITTED.
n If, during execution of the method, a return code not modeled in the related workflow was returned
or irreparable damage occurred in the WIM, the WI is assigned the status ERROR.
n If processing of the WI has been completed successfully, it is assigned the status COMPLETED.
n If the WI is no longer required within the flow logic of the workflow, it is assigned the status
CANCELLED.
Cancelled Error
Selected Committed
ã SAP AG 1999
n Not all work item types can assume all statuses (for example, SELECTED only for dialog and work
queue work items, COMMITTED only for dialog work items).
n The start statuses are WAITING or READY.
n The end statuses are CANCELLED or COMPLETED.
n The change from one status into another always happens implicitly on the basis of an executed
activity (for example, "reserve" in the Business Workplace).
Canceled Error
Selected Committed
ã SAP AG 1999
Canceled Error
Selected Committed
ã SAP AG 1999
ã SAP AG 1999
n Important: the function modules in the function group SWWA are not officially released externally,
meaning that their interface may change. However, all efforts are being made to keep enhancements
upwardly compatible.
Only the function module WORKITEM_ARCHIVE_OBJECT for archiving a work item is officially
released.
n When a work item is started or created, the caller must first fill the task container with the input
parameters of the task according to the task definition.
The caller must also incorporate error handling measures if the WI cannot be created or started.
n Before a work item is executed, the caller must check whether all the prerequisites for execution
have been fulfilled (for example, is the current user permitted to execute the WI).
n All administration function modules (SWW_WI_ADMIN_*), for example, are in the SWWA
function group.
n All function modules of the SAP WAPI interface can also be used (SAP_WAPI_*). These are in
function groups SWRC and SWRR.
ã SAP AG 1999
n SAP WAPI is an SAP-specific API based on the interface definitions of the Workflow Management
Coalition.
n The SAP WAPI function modules call again the function modules internally from SWWA. The
functionality is the same, but the interface is different.
n If possible, the function modules from SWRI should be used instead of direct table access (e.g. to
tables SWWWIDEADL and SWWWIRET) for work item selection within analysis and reporting.
ã SAP AG 1999
n The entire header data is located in the table SWWWIHEAD. The view SWWVPUBLIC contains
the elements that are available for general selection and do not represent internal administrative data
of the WIM.
n Changes to the structure of the SWWVPUBLIC view are only upward compatible. The structures of
the remaining tables and others are not guaranteed. If data of a known work item is to be read, the
function modules SWW_WI_HEADER_READ, SWW_WI_DEADLINES_READ and
SWW_WI_RETURN_READ from the SWWA function group should be used (or as of 4.5A,
SWW_WIS_*_READ, if the data from several work items is to be imported).
n If the container of a known work item is to be read, the function module
SWW_WI_CONTAINER_READ in the function group SWWA should always be used.
n Non-objects in the work item container include scalar values (char, integer) and structures.
n Changes to work items must never be made by direct table changes, but always via the function
modules in the function group SWWA.
ã SAP AG 1999
n The BOR only recognizes RHs (for example, as a result of macro SWC_CREATE_OBJECT, as
input for method calls, and so on). An RH is only valid during the runtime of the creating program
and expires immediately afterwards.
n This is not sufficient for the workflow, since there may be program changes or several days between
the individual steps. For this reason, there must also be a persistent presentation. This presentation is
visible, for example, when you look at the work item container.
n All BOR macros expect an RH; all workflow FMs expect PORs.
n The workflow ensures correct conversion automatically. An explicit conversion is always necessary
when you write your own FMs that are called on the interface between the workflow system and the
BOR (for example, check FMs in the event manager).
The explicit conversion takes place using the macros SWC_CONTAINER_TO_RUNTIME and
SWC_CONTAINER_TO_PERSISENT from the include <cntn01>.
30/31/40A 40B
Event Manager
ReceiverTypeFM Runtime handle
CheckFM
Persistent
RFC
object reference
WF
BOR/Application Runtime handle
Persistent
WF object reference
Persistent
WF object reference
ã SAP AG 1999
n User-controlled conversion is always necessary when the caller requires a different type of
presentation than the current one.
n With every user-controlled conversion, the caller must ensure that a "re-conversion" takes place
afterwards, since the original presentation is expected again in the subsequent context.
n When a workflow is started directly via the API, the RHs created in the program using the BOR
macros must also be converted to PORs before SWW_WI_CREATE (or SWW_WI_START) is
called.
ã SAP AG 1999
ã SAP AG 1999
ã SAP AG 1999
n The programming is carried out via macros from the <widisp> include. This include must be
included in the module pool.
n The online documentation contains complete documentation on the macro.
ã SAP AG 1999
n The SAP_WAPI_* function modules implement the WfMC Interface 2 and are in the SWRC
function group.
n SAP_WAPI_GET_OBJECTS returns the leading object as a POR. A transformation to an RH must,
therefore, take place before the BOR macro is called by calling
SWC_OBJECT_FROM_PERSISTENT.
n To use the BOR macro, the include <cntn01> must be incorporated.
ã SAP AG 1999
n The online documentation contains the complete list of IDs for transferring the OK codes.
Access to step-specific
object attributes
ã SAP AG 1999
ã SAP AG 1999
n All deadlines are monitored using the background job SWWDHEX with job class A. The job calls
the report RSWWDHEX.
n You can choose between deadline monitoring on an individual or on a periodic basis. Individual
monitoring is active by default.
n With individual monitoring, the background job is rescheduled for the next deadline to be monitored
and is updated if a new deadline is entered for a WI that is sooner than any others. The background
job therefore, only runs if it is really needed.
Important: if the background job aborts for any reason, it must be rescheduled by starting the above
report.
n This procedure is not economical for monitoring a large number of deadlines. In this case, you
should switch to periodic deadline monitoring (for example, every three minutes).
n You can switch between the two monitoring types at any time via SWWA or using the report
RSWWDHIN.
ã SAP AG 1999
n Inheritance only applies on creation of the subordinate work item. Subsequent changes to data in the
superordinate workflow are not passed on to existing dependent work items.
n Every change in the data in the dependent work item is checked against the superordinate workflow.
It is not possible to postpone beyond the inherited deadlines.
l Many deadlines
Switch from single case based to permanent
l Several instances of SWWDHEX
Delete all instances via job overview
Reschedule
l No instances of SWWDHEX
Check selection for job overview
Reschedule
ã SAP AG 1999
1
1 Correction
WI ERROR WI Error Restart
4
2 3
3 2
FI ERROR FI Error Restart
ã SAP AG 1999
n Error situation
1) The status of the work item changes to ERROR.
2) The error is propagated to the superordinate workflow.
3) The status of the superordinate workflow also changes to ERROR.
n Error correction
1) The work item is corrected (for example, by correcting the work item container).
2) A "restart after error" is executed on the superordinate workflow.
3) The superordinate workflow propagates the restart to the work item.
4) A "restart after error" is executed on the work item implicitly.
n When an error occurs, it is propagated "bottom up" to all superordinate workflows.
n To correct the error, the WI is first repaired locally.
n Then the workflow is restarted from the top down and all work items belonging to the workflow are
also restarted. The restart must always be performed at the highest level workflow, and never from
the WI with the error.
n Work items with errors should not be restarted with SM58 (prior to 4.0A), since steps already
executed may be executed a second time.
n All correction actions on work items should be performed with great caution to avoid side effects.
ã SAP AG 1999
SWWERRE SWWDHEX
ã SAP AG 1999
n Neither job allows real-time control since background jobs that are running are not interrupted.
ã SAP AG 1999
n Initially, only temporary log entries are written to a buffer so that the commit logic of the caller is
not destroyed.
n A log entry is written for all activities that can be triggered by a user (including) via the user
interface, if successful (FM SWW_WI_LOG_WRITE_SUCCESS).
n A log entry is always written if an error occurs so that the call hierarchy can be traced to the point of
error (FM SWW_WI_LOG_WRITE_EXCEPTION).
n The function module SWW_WI_LOG_FLUSH must be called before the database commit, so that
the temporary log entries can be written from the buffer to the database.
n If work items are created via the WIM API (or, more generally, the work items are controlled via the
WIM API) and the commit is controlled by the creator (that is, the parameter DO_COMMIT was set
to SPACE), the creator must call the function module SWW_WI_LOG_FLUSH before commit
work. In all other cases, the call is performed by the workflow runtime system.
ã SAP AG 1999
n All administrator FMs are checked with regard to authorization. They are used to process a WI in
exceptions.
Note: the necessary authorizations are contained in the authorization profile S_WF_WF_ADMIN.
n When a waiting WI is initiated, its status is changed from WAITING to READY. This function can
be executed if deadline monitoring is not running due to overloading of the background queue or an
error in the background system.
n The status of the WI is changed from SELECTED or STARTED to READY again. This function can
be used in order to make a WI that is blocked by an absentee visible for other recipients.
n When restarting after an error, the status of the WI is changed from ERROR to STARTED, the
underlying method may be executed automatically.
n Logical deletion changes the status of the WI to CANCELLED.
n The system administrator for WF can explicitly change the status of a WI to COMPLETED, but is
responsible for filling the container of the WI with the expected return parameters of the method
beforehand.
ã SAP AG 1999
n tRFC is a Basis component (CALL FUNCTION ... IN BACKGROUND TASK). The FM called is
triggered after the next SAP Commit (see unit on events).
n The logical destination WORKFLOW_LOCAL<Clnt> is maintained for the WF runtime system
within Customizing via the transaction SWUB. The user entered there must have all authorizations
and should therefore, for security reasons, be a background user.
Important: If the password of this user is changed within user administration, this change must also
be made in SWUB.
Important: The logical destination WORKFLOW_LOCAL<Clnt> cannot be maintained via the
transaction SM59.
n The tRFCs issued are logged until they are executed. If execution is successful, these entries are
deleted. If an error occurs during execution, this is also recorded in the log.
Only up to 3.1G: The log can be viewed via SM58. It is accessed with the name of the user who
called the tRFC. For the WF system, it is normally the user who is entered in the destination
WORKFLOW_LOCAL_<Clnt>.
n There is another access possibility from the workflow development environment via "RFC monitor".
ã SAP AG 1999
n After the work item has been selected, the users can change and/or process the work item if they are
assigned to the underlying task via the task profile and the work item is not already reserved by
another recipient.
n If the work item is not task-based (for example, wait steps, work queues, and so on), the user can
change and/or process it if it is not already reserved by another recipient.
ã SAP AG 1999
n Access either via Utilities in the workflow development environment or directly via the transaction
SWUD.
n All the tools and procedures that will be described in detail can be executed via this tool.
n Problems triggering events can also be investigated via this tool.
ã SAP AG 1999
n The workflow log is always written and cannot be switched off. It follows the database commit and
writes to the database.
n The workflow trace must be switched on explicitly. It is not dependent on the database commit and
writes to the file system of the application server.
n The workflow trace is helpful with regard to problems in background work items or binding.
ã SAP AG 1999
n The consistency check for Customizing must be carried out before you first work with SAP Business
Workflow.
n Note: Linkages with errors are deactivated automatically and a mail is sent to the system
administrator for workflow.
ã SAP AG 1999
ã SAP AG 1999
n A breakpoint should be set in the method implementation before the "test execution".
n If the instance linkage table is filled correctly, the terminating event can also be triggered via the
workflow development environment for test purposes.
ã SAP AG 1999
ã SAP AG 1999
n Reports RSWWWIDE and RSWWHIDE are only for internal purposes. The work items are deleted
from the database without further query or authority checks. They can be started via the
Administration menu in the workflow development environment.
These reports should always be called with the "display only" flag set first to check them. The actual
deletion should be executed via a background job.
n Workflow work items automatically delete their dependent work items as well.
n In a live system, the work items must be archived before they can be deleted (transaction SARA).
The contents of the archive file can then be deleted later.
n Archived work items can be read, but not restored for security reasons. The read program must be
written individually by the customer. An example program is supplied by SAP (RSWWARCR).
n Other archiving objects can also archive work items using the archive class WORKITEM. Work
items cannot, however, be deleted in this manner for reasons of data consistency.
n Container anchor work items should be deleted via the report RSWWCIDE.
ã SAP AG 1999
n RSWWARCR can be used as a template for user-defined programs. The user source code begins
after calling the function module SWW_WI_LIST_ARCHIVED_READ, which imports the whole
archive to internal tables. The tables contain all processes in a depth-first storage format.
n RSWWARCP is a special case of a self-written read program. It searches for the associated process
for a particular application object and restructures the workflow log for this process (as far as
possible).
n The archive data cannot be reloaded to the original WI tables, since the runtime system reuses the
WI numbers (i.e. data could be overwritten when reloaded).
ã SAP AG 1999
n WI data must never be deleted directly in tables, only via the function module SWW_WI_DELETE.
n Large amounts of data should always be deleted in the background.
n Report RSWIWADO can be used to determine if archiving or deletion are necessary.
n If only the workflow log is to be deleted, report RSWWHIDE can be used.
ã SAP AG 1999
n Packaging is particularly relevant if large quantities of data are imported into the system (for
example, with a batch input).
n A check function module can be implemented instead of a "check step" in the workflow when the
workflow is started via an event, for example.
n The WIM API can be used instead of an event if a workflow is started from a user-defined report that
is scheduled as a background job.
n A destination can be specified for each event receiver in the type linkage table. Specific events can
then be received on a specific application server (to keep the other application servers free, for
example).
ã SAP AG 1999
n General tasks should not be used if at all possible. If they are, a restrictive agent assignment should
be performed in the step definition.
n The following lead to subsequent selection if they are adopted in the standard configuration:
Object _WI_OBJECT_ID
Group _WI_GROUP_ID
Task text WI_RHTEXT (if work item display in logon language)
To do by (date) WI_LED
To do by (time) WI_LET
n The buffering of organizational data can be controlled via the table T77S0.
Please refer to note 98407.
ã SAP AG 1999
ã SAP AG 1999
You want to start a workflow not via an event, but directly via the API
of the work item manager (for example for performance reasons).
You want to display process-specific data for the end user before the
work item is executed.
2-1 Optional extensions: Define a subscreen for a user-defined work item display.
2-1-1 Create a screen 0100 in your function group that displays the following
data from the material master:
+ Material number
+ Last person to change the material
+ Material type
+ Lab/office of the material.
The user is also to be able to display the material stock at the click of a
button
2-1-2 Change the display step in your process Z##MSIPROC1 in such a way
that a user-specific work item is displayed using the subscreen that you
implemented previously.
Note: If you have not implemented your own screen, you can use the
screen SAPLZ610 0100.
Note: To make the user-defined screen visible when it is displayed,
you must choose the “User view without ActiveX” for the “Work
item display” under “User-defined workflow settings”.
3-1-2 Using the report RSWWWIDE, delete all the work items you created on
the first day of the workshop.
Note: First execute the report with the flag “Display list only” set.
Only if the list contains exclusively your work items, remove the
flag for the second run of the report and actually delete the work
items.
Important: Once you have deleted the work items, they are lost
irretrievably.
Solution:
Z00START
REPORT Z00START .
You want to display process-specific data for the end user even before the
work item is executed.
2-1 Optional extensions: Define a subscreen for a user-defined work item display.
2-1-1 Create a screen 0100 in your function group.
Solution:
SAPLZ610 0100
Solution:
WS96000011 – Z00MSIPROC1
*- from the material object we can get the data we want to show
CLEAR G_OBJECT. CLEAR MARA.
MOVE G_MATERIAL-OBJECT_ID TO G_OBJECT.
SELECT SINGLE * FROM MARA
WHERE MATNR = G_OBJECT-OBJKEY.
* we do not use a possible attribute access here, because the attribute
* 'BasicMaterialNumber' does not exist and 'Laboratorty' is defined
* as an object based attribute, so we'd need to implement another
* attribute access for object type T024L
* clear g_runtime.
* swc_object_from_persistent g_object g_runtime.
* swc_get_property g_runtime 'Material' mara-matnr.
* swc_get_property g_runtime 'ChangedBy' mara-aenam.
* swc_get_property g_runtime 'MaterialType' mara-mtart.
* swc_get_property g_runtime 'OldMaterial' mara-bismt.
* swc_get_property g_runtime 'BasicMaterialNumber' mara-wrkst.
* swc_get_property g_runtime 'Laboratory' mara-labor.
ENDMODULE. " INIT_0100 OUTPUT
SWL_WIDISP_GET_OKCODE OKAY.
CASE OKAY.
*- we implement just one function of our own...
WHEN 'DISM'. " this is the only OK code, ignore anything else
*- we want to show the material, which is related to the work item
* therefore, we use a released interface to get the workitem's object.
IF G_MATERIAL IS INITIAL.
CALL FUNCTION 'SAP_WAPI_GET_OBJECTS'
EXPORTING
WORKITEM_ID = G_WI_ID
IMPORTING
LEADING_OBJEC = G_MATERIAL.
* return_code =
* TABLES
* OBJECTS =
* MESSAGE_LINES =
* MESSAGE_STRUCT =.
ENDIF.
*- we show the material stock using ta mmbe
CLEAR G_OBJECT.
MOVE G_MATERIAL-OBJECT_ID TO G_OBJECT.
SET PARAMETER ID 'MAT' FIELD G_OBJECT-OBJKEY.
CALL TRANSACTION 'MMBE' AND SKIP FIRST SCREEN.
*- now it's more secure to clear the okcode to the frame dynpro,
* because it must not be handled again overthere...
SWL_WIDISP_CLEAR_OKCODE.
ENDCASE.
3-1-1 Create a report Z##TODAY that lists all workflow instances started today
by a specific user.
Solution:
Z00TODAY
View Z00VHEACON
* determine intitiator
INITIATOR-OTYPE = 'US'.
INITIATOR-OBJID = USER.
* search list of candidate wis
IF USER NE SPACE. " search for flows of this user
WRITE: / 'Number of flows started today by user ', USER, ':'.
SELECT * FROM Z00VHEACON INTO TABLE CAND_WIS
WHERE WI_CD EQ SY-DATUM AND
WI_CHCKWI EQ SPACE AND " top level flows only
VALUE EQ INITIATOR.
ELSE. " search for flows independent of user
WRITE: / 'Number of flows started today by all users :'.
SELECT * FROM Z00VHEACON INTO TABLE CAND_WIS
WHERE WI_CD EQ SY-DATUM AND
WI_CHCKWI EQ SPACE. " top level flows only
ENDIF.
Solution:
Z00WEEKL
Contents:
l Architecture
l Customer-specific analyses
ã SAP AG 1999
ã SAP AG 1999
Information Structures
LIS
Update rules
Characs. Time base Key figures Field catalogs Characs. Time base Key figures
LIS
Background job SAP report event User exit
"AA"
ã SAP AG 1999
n The communication structure and LIS event form the LIS inbound interface for external data.
n Data retrieval is carried out via batch job RMCADATA that triggers the LIS event and also fills the
communication structure. This background job must be scheduled explicitly. In scheduling, ensure
that no data is transferred twice when setting the evaluation period.
n The LIS generates a function group for the LIS event. The event is actually triggered by calling a
particular function module in this function group and transferring the internal tables previously
filled.
n The communication structures (for generic data), data retrieval program and function group are
supplied by SAP.
n A user exit is provided to allow customers to fill their own fields in the communication structure.
n Field catalogs, information structures and update rules are defined in LIS Customizing (see online
documentation or documentation on the course LO930: Logistics Information System)
n The Workflow Information System can be accessed via Reporting in the workflow development
environment or directly via the transaction MCA1.
Information Structures
LIS
Update rules
Characs. Time base Key figures Field catalogs Characs. Time base Key figures
LIS
Background job SAP report event User exit
"AA"
ã SAP AG 1999
ã SAP AG 1999
ã SAP AG 1999
ã SAP AG 1999
n The include incorporated in the function module EXIT_SAPLMCWF_001 must be changed. ALL
selections for ALL extensions must be programmed in this include.
n See WI_CODING_TEMPLATE in the function group MCWF for a user-programmed selection
example. The loop implemented here can be used as a template for user-defined database selections.
n The function modules SWI_READ_CONTAINER_ELEMENT (read a container element) and
SWI_READ_CONTAINER_ATTRIBUTE (read an attribute of an object in the container) can be
used for user-defined selections.
n Activate the user exit via the transaction CMOD. The extension WISEXIT supplied by SAP must be
entered here for the customer-defined project.
ã SAP AG 1999
n Characteristics are information that is suitable for grouping or classification purposes (for example,
plant, material, storage location).
n Key figures are significant (and measurable) business values (for example, quantities, amounts,
costs).
n Time values are used to assign the characteristics periodically. The key figure values are aggregated
periodically for each characteristic.
n The above categorization is set out by the LIS. Additional categorizations can also be defined (for
example, according to application).
n Field catalogs are client-specific.
n Example: field catalog FWFB
ã SAP AG 1999
n Both selected data and total values are stored. As a result, both characteristics and key figures can be
defined. The key figures contain aggregate values that can be analyzed individually for every
characteristic.
n The fewer characteristic columns in the info structures, the higher the degree of 'grouping' of the key
figures.
Example: (number, agent) is 'grouped' to a greater degree than (number, agent, process).
n The associated tables must only ever be edited via the LIS, and never directly with the ABAP
Dictionary.
n Example: S304 - evaluation of the number of notifications of absence and the total absence time per
employee.
ã SAP AG 1999
ã SAP AG 1999
1-1 Create your own analysis to analyze how many instances of the process
Z##MSIPROC1 were executed for each material type. Output the number and the
cumulative total time of the processes, that is, use these two values as key figures.
1-1-1 Execute the individual steps for implementing a user-defined analysis as
described in the course material.
1-1-2 After implementing the communication structure, the field catalog, the
information structure, the update rules and the user exit, you must transfer the
data from the workflow tables to the LIS tables by executing the report
RMCADATA manually.
1-1-3 Check the results of your user-defined analysis.
1-1 Create your own analysis to analyze how many instances of the process
Z##MSIPROC1 were executed for each material type. Output the number and the
cumulative total time of the processes, that is, use these two values as key figures.
1-1-1 Execute the individual steps for implementing a user-defined analysis as
described in the course material.
Solution:
§ Communication structure
Z00MCWF_TRANS in MCWF_TRANS
§ User exit
EXIT_SAPLMCWF_001
§ Field catalog
Z610
§ Info structure
S610
§ Update rules
S610 (info structure), 100 (update group)
Path:
§ WIS in general
Tools > SAP Business Workflow > Development > Reporting > Workflow
Information System (WIS)
§ For the communication structure
Tools > SAP Business Workflow > Development > Reporting > Workflow
Information System (WIS) > Environment > Enhancements > Append
structure
§ For the user exit
Tools > SAP Business Workflow > Development > Reporting > Workflow
Information System (WIS) > Environment > Enhancements > Selection
program
§ For the communication structure
Tools > SAP Business Workflow > Development > Reporting > Workflow
Information System (WIS) > Environment > Enhancements > Append
structure
§ For the info structure
Tools > SAP Business Workflow > Development > Reporting > Workflow
Information System (WIS) > Environment > Info structures > Create
§ For the update rules
Tools > SAP Business Workflow > Development > Reporting > Workflow
Information System (WIS) > Environment > Updating > Create
Path:
Tools > SAP Business Workflow > Development > Reporting > Workflow
Information System (WIS) > Environment > Administration > Transfer data
1-1-3 Check the results of your user-defined analysis.
Solution:
Application 20, info structure S610
Path:
Tools > SAP Business Workflow > Development > Reporting > Workflow
Information System (WIS) > Standard analyses > User-Defined Analysis
*----------------------------------------------------------------------*
* INCLUDE ZXMCAU01 *
*----------------------------------------------------------------------*
DATA: MTART LIKE MARA-MTART.
LOOP AT XMCWF_TRANS. " xmcwf_trans is defined in fm interface
IF XMCWF_TRANS-WI_RH_TASK = 'WS96000011'.
" look for all instances of process Z00MSIPROC1
" this is the only flow dealing with materials of type FERT
CALL FUNCTION 'SWI_READ_CONTAINER_ATTRIBUTE'
EXPORTING
WI_ID = XMCWF_TRANS-WI_ID
ELEMENT = 'MATERIALMASTER' " must be capital letter
TAB_INDEX = 000000 " single line attribute
ATTRIBUTE = 'MATERIALTYPE' " must be capital letter
IMPORTING
VALUE = MTART
EXCEPTIONS
READ_FAILED = 1.
IF SY-SUBRC = 0.
XMCWF_TRANS-MTART = MTART.
MODIFY XMCWF_TRANS.
ENDIF.
ENDIF.
ENDLOOP.
ã SAP AG 1999
ã SAP AG 1999
O - Z_Dep_DesignOffice1
T7791
SO T024L/KB1
OrgObjTyp ObjTyp ... S - Z_Job2 -- USHill
S - Z_Job1 -- USMiller
T024L 0 ...
O - Z_Dep_DesignOffice2 PD ORG
... ... SO T024L/KB2
S - Z_Job3 -- USJones
S - Z_Job4 -- USSmith
Potential assignment
to organizational units Assignment to a concrete organizational
unit
ã SAP AG 1999
n 1) Definition of the object type to be used subsequently as an SAP organizational object (in this case,
T024L) to determine the agent assignment.
n 2) Definition of an attribute that is mapped on this object type for the object type used in the
workflow in which agent assignment is required (in this case, the laboratory attribute for the object
type BUS1001, because the underlying workflow operates with the object type BUS1001 or one of
its subtypes).
n 3) Definition of the BOR object type from 1) as an SAP organizational object in PD Org and
determination of the potential links in the organization model via entry in table T7791 (in this case,
T024L is only to be linked with organizational object type O, that is organizational units).
n 4) Link an instance of the SAP organizational object with an organizational unit from the
organization model (here link laboratory KB1 with organizational unit Z_Dep_DesignOffice1 and
laboratory KB2 with C_Dep_DesignOffice2)
ã SAP AG 1999
n Binding in step definition between workflow container and (implicit) role container: the attribute
containing the SAP organizational object (in this case, BUS1001.Laboratory) must be written to the
role container.
O - Z_Dep_DesignOffice1
T7791
SO T024L/KB1
OrgObjTyp ObjTyp ... S - Z_Job2 -- USHill
S - Z_Job1 -- USMiller
T024L 0 ...
O - Z_Dep_DesignOffice2 PD Org
... ... SO T024L/KB2
S - Z_Job3 -- USJones
S - Z_Job4 -- USSmith
Potential assignment
to organizational units Assignment to a concrete organizational unit
ã SAP AG 1999
n 1) Role evaluation determines the organizational units (in this case Z_Dep_DesignOffice1) that are
linked with the instance of the SAP organizational object (in this case, KB1).
n 2) All object instances linked with this organizational unit are returned as the role evaluation result
(in this case, Z_Job1 and Z_Job2).
ã SAP AG 1999
n Table T7791 is maintained via SM30. The organizational units that can be linked can be specified
here.
n The organizational plan is maintained from the workflow development environment.
...
Call function f2 Function f2.
in background task ...
destination XXX
exporting ...
... LUW2 LUW2’
Commit work. “ end second LUW End function.
ã SAP AG 1999
n The event creator has an LUW for each event and each event has one receiver
=> Each event receiver also has its own LUW.
ã SAP AG 1999
ã SAP AG 1999
n Several events come from one LUW. The receivers, however, are started with the addition 'AS
SEPARATE UNIT'
=> Each event receiver has its own LUW
=> Rollback work or raise exception only locally in current receiver.
l 3.0F
n All receiver FMs run independently of each other
n Error handling as in 3.0D
l 3.0D
n Workflow receiver FMs no longer trigger exceptions
n Error handling: Deactivate linkage and send a mail to the system
administrator for workflow
l 3.0C
n All workflow receiver FMs trigger exceptions
n No special error handling
ã SAP AG 1999
ã SAP AG 1999
n The object instances can be of the same or of different object types. Semantically, the list is regarded
as one set (that is, duplicates are permitted).
n A task can be specified for every object instance. If a task is not specified, the default task is used.
Only dialog or synchronous background tasks are permitted.
n The agents of the tuples are derived from either the agent list or, if this list is empty, the
organizational assignment of the respective task.
n The status is handled separately for each individual tuple and for the work queue as a whole.
n Since the work queue is a work item of a specific type, it has all of the properties of a work item,
such as:
Deadline monitoring
Excluded agents
Terminating events
Visibility in the Business Workplace
ã SAP AG 1999
n The alternatives for each possible scenario must be examined. The above criteria do not necessarily
all have to be fulfilled to use work queues.
n There are certain advantages with background tasks for a set of objects, since the methods belonging
to the tasks can be executed directly (that is, without creating a background work item).
n Background task on a set of objects to be executed together
n Actions on the work queue as a whole and on each individual object
n Error handling required
n Example: Work queues with mass processing in Asset Accounting
ã SAP AG 1999
n Since the work queue, as such, is not assigned to a task, agents must be assigned explicitly when it is
created (via the table AGENTS in the function module SWZ_AI_CREATE).
n The work queue then appears (as a dialog work item) in the Business Workplace of the recipients.
n The Business Workplace features additional menu options for processing work queues, such as
"Release" or "Display object list". The full functionality for work queues, however, is only available
as an API or as methods of the object type ARCHLISTWI.
ã SAP AG 1999
n The basic functionality for work queues is encapsulated in the object type ARCHLISTWI.
Application or customer-specific extensions must be implemented in a subtype (for example,
AM_AI).
n Each instance of a work queue can only be used either inside or outside a workflow.
n Processing a work queue inside a workflow allows any process definitions (for example, multi-level
release of work queue), or sophisticated error handling (for example, handling the tuples with errors
in a new work queue).
n Using work queues within a workflow is advisable.
MSI BPR
Motor Sports International (MSI) has successfully implemented SAP R/3. SAP Business Workflow
helped fulfil the goals set by the company for optimizing business processes (Business Processing
Reengineering, or BPR).
The following study investigates the process used by MSI to achieve these objectives, with the help of
the SAP Business Workflow tools. The study does not only outline the precise MSI Workflow
implementation solution but also explains the business process in detail and suggests actions that you
may perform.
This case study is unlike any other Workflow process that would actually appear in your company: it
aims to motivate you to do the course and provide you with support for implementing Workflow
successfully.
The problem at MSI: the existing system at MSI could not notify the designer of relevant changes to
material master records. This communication gap led to a delay in adjusting the production line and also
resulted in large quantities of obsolete and unwanted warehouse stock.
The solution at MSI: with the help of SAP Business Workflow, BPR enabled MSI to make considerable
savings in the warehouse stock reduction procedure.
As soon as the workflow system has been notified that the designer has finished his or her work, it
sends a final notification that the process is finished and that the material just changed can now be sent
back to production. The workflow determines who receives this notification (Note: in practice, this
would usually be implemented via role resolution). The first workflow (for material type 'FERT')
forwards the notification to the user that changed the material at the start. The second workflow (all
other material types) forwards the notification to the designer's manager for inspection purposes.
Analyze: The management team at MSI expects a specific daily report on all newly started workflows.
As well as the total number, the list also contains the workflow initiator for each workflow instance.
The system administrator wants to maintain the database with minimal effort; a monthly archiving
procedure must therefore be planned. To support planning, the workflow administrator requires a
weekly report on the workflows that have been started but not yet completed.