Sei sulla pagina 1di 0

Spider Systems Pvt. Ltd. Slide No.

1
Oracle Workflow An Introduction
Spider Systems Pvt. Ltd. Slide No. 2
Objectives
Concept of Workflow
Importance in Business Process
Features
Components of Oracle Workflow
Workflow Terminology
Using Oracle Workflow Builder
Designing Workflow Process
Using Quick Start Wizard
Spider Systems Pvt. Ltd. Slide No. 3
Whats a Workflow?
Business processes revolve around routing information to
various users through a set of constantly changing rules.
The flow of information is governed by various conditions
and checking for outcome of the previous steps.
An established process of routing will be subject to
continuous monitoring and routing
Each organization follows a different set of business
practices.
Spider Systems Pvt. Ltd. Slide No. 4
Routing the information
WF gets the right information to the right people
WF lets you provide each person with all the information
they need to take any action.
WF can route supporting information to each decision
maker in a business process.
Spider Systems Pvt. Ltd.
Designing Business Processes for Change
Business processes will change
No artificial constraints on the business process
Enabling dynamic processes sympathetic to change
Change business processes without changing code
(reduced cost of ownership)
Requires visual overview of business processes
You can only fix what you can see
Visual documentation of the business process
Spider Systems Pvt. Ltd.
Workflow is Essential
Workflow enables continuous process improvement
Complete process representation
Crosses organizational, company boundaries
Build in management metrics, performance goals
Adaptable workflow processes
Provides alternatives
Allow for refinement
Analyze time and costs of entire processes with
multidimensional analysis
Reducing costs and time
Spider Systems Pvt. Ltd. Slide No. 7
Define your Business Processes
WF allows you to define and modify the business
processes using a drag-and-drop process designer.
Routes documents from one user to another in an approval
hierarchy.
Advanced processes like looping, parallel flows, response
tracking, branching into sub-processes based on
responses are also possible.
Since it is integrated with Oracle Database, it can make full
use of PL/SQL to express any business rule.
Spider Systems Pvt. Ltd. Slide No. 8
E-Mail Integration
E-Mail notifications can be sent using WF to any email
address.
E-Mail notifications not only provide the user with messages
needing their intervention but also tracks the respond that
the person gives to the email and act accordingly.
E-Mail notifications can even send attachments to the user
and provide him with an URL or Documents which to view.
Spider Systems Pvt. Ltd. Slide No. 9
Whats Oracle Workflow?
A graphical tool that allows you to CREATE, TRACK and
MODIFY business processes
Embedded in the Oracle Database Server, it can monitor the
workflow activity statuses.
Spider Systems Pvt. Ltd. Slide No. 10
What can Oracle Workflow do?
Routes information to various users based on certain rules.
Tracks the responses from the users and takes actions
accordingly.
Enables people to receive E-Mail notifications
Allows incorporation of custom packages and procedures
E-Mail integration of choice.
Internet enabled workflow allows you to view Workflow
notifications through any Internet browser.
One can also monitor the processes through a browser.
Spider Systems Pvt. Ltd. Slide No. 11
Why use Oracle Workflow?
Create a clear business process definition
Automate the business routings
Monitor the processes
Allow users to define their own business processes to suit
their organizational needs
Readily change the business process definitions in case of a
change in business processes.
Spider Systems Pvt. Ltd. Slide No. 12
Components of Oracle Workflow
Workflow Builder
Workflow Engine
Workflow Definitions Loader
Notification Systems
Workflow Monitor
Workflow Architecture
Roles Users
Directory Services
Notification Services
Send
Respond
Forward
Cancel
Query
Oracle Workflow Enabled Application
Oracle Server
Engine
Execution
Definition
Administration
Monitoring
Query
Workflow
Builder
Workflow
Loader
Workflow
Definition
Files
Workflow
Development
Client
Oracle
Application
Server
or
WebDB
Notification
Mailer
Application
Server
Web
Notification
Worklist
Web
Process
Monitor
Web
Analysis
Tools
End-User
Client
Mail
Applications
Spider Systems Pvt. Ltd. Slide No. 14
Whats a Workflow Builder?
Work Flow builder is a Graphical interface to create and
modify a business process with simple drag and drop
operations.
It has two components -
Navigator Window
Process Window
A workflow builder would be used by a person to design
and modify a workflow. It is more of a designers tool rather
than an end-users tool.
Spider Systems Pvt. Ltd. Slide No. 15
What can a Workflow Builder do?
Using the Workflow Builder, one can create and modify all
workflow objects, including activities, item types, and
messages.
At any time you can add, remove, or change workflow
activities, or set up new pre-requisite relationships among
activities.
A navigation tree structure allows summary view as also
allows expanding activities within the workflow as needed
to greater levels of detail.
Oracle Workflow Builder can be used from a desktop PC or
from a disconnected laptop PC.
Spider Systems Pvt. Ltd.
Oracle Workflow Builder
Development tool for Oracle Workflow
Used to graphically define and customize the workflow
definitions
Requires a PC running Windows 95, 98, 2000 or
Windows NT
Workflow definitions: you can save them to a
database or a flat file
There are two parts to the Workflow Builder:
Object Navigator
Process Diagram
Spider Systems Pvt. Ltd. Slide No. 17
How does Workflow Builder appear?
Spider Systems Pvt. Ltd. Slide No. 18
Workflow Builder Navigator Window
Spider Systems Pvt. Ltd. Slide No. 19
Workflow Builder Process Window
Spider Systems Pvt. Ltd.
Supported Process Constructs
Looping
Results-based branching
Parallel flows
Rendezvous
Spider Systems Pvt. Ltd.
Supported Process Constructs
Voting
Timeouts
Escalation
Automatic
forwarding
Subprocesses
(unlimited hierarchy)
Spider Systems Pvt. Ltd. Slide No. 22
Whats a Workflow Engine?
The Workflow Engine embedded in the Oracle8 server monitors
workflow states and coordinates the routing of activities for a
process.
Changes in workflow state, such as the completion of workflow
activities, are signaled to the engine via a PL/SQL API or a Java
API.
Based on flexiblydefined workflow rules, the engine determines
which activities are eligible to run, and then runs them.
The Workflow Engine supports sophisticated workflow rules,
including looping, branching,parallel flows, and sub-flows.
Spider Systems Pvt. Ltd.
Workflow Engine
Is embedded in the Oracle8i server
Uses the process definition created with Oracle Workflow
Builder to coordinate the routing of activities for the
process
Monitors the state of each activity in a workflow process
Signals any changes in the workflow state to the engine
using calls to PL/SQL or Java APIs
Guarantees consistency between the application and the
workflow state because of Oracle8i transactional integrity
Spider Systems Pvt. Ltd.
Workflow Definitions Loader
Workflow
Builder
Oracle 8 or higher
Workflow
Engine
Workflow
Loader
Proc
ess
Defin
itions
Workflow
Loader
Process
Definition
Spider Systems Pvt. Ltd. Slide No. 25
Workflow Definitions Loader
The Workflow Definitions Loader is a utility program that moves
workflow definitions between database and corresponding flat
file representations.
Can be used to move workflow definitions
From a development to a production database
To apply upgrades to existing definitions.
Workflow Definitions Loader is also integrated into Oracle
Workflow Builder
It allows opening and saving workflow definitions in both a
database and file.
Spider Systems Pvt. Ltd.
Notification System
e.g. UNIX Sendmail
or MAPI compliant
Mail System
Application
Notification
Mailer
Oracle
Applications
Screens
Workflow
Worklist
Workflow
Engine
Notification
System
Directory
Services
Oracle 8 or higher
Spider Systems Pvt. Ltd. Slide No. 27
Notification Systems (1 of 2)
Oracle Workflow lets you include users in your workflows to
handle activities that cannot be automated, such as
approvals for requisitions or sales orders.
Electronic notifications are routed to a role, which can be an
individual user or a group of users. Any user associated with
that role can act on the notification.
Each notification includes a message that contains all the
information a user needs to make a decision.
Spider Systems Pvt. Ltd. Slide No. 28
Notification Systems (2 of 2)
The information may be embedded in the message body or
attached as a separate document.
Oracle Workflow interprets each notification activity
response to decide how to move on to the next workflow
activity.
Web users can access a Notification Web page to see their
outstanding work items, then navigate to additional pages to
see more details or provide a response.
Viewing Notifications
Viewing a Notification
Spider Systems Pvt. Ltd.
Directory Services
WF_USERS
Contains information on the user names, display names
for the users, their notification preference and their e-mail
addresses
WF_USER_ROLES
Contains information on the association of the users to
the roles
WF_ROLES
Contains information on the roles of which users can be
members
Spider Systems Pvt. Ltd. Slide No. 32
Whats a Workflow Monitor?
The Workflow Monitor displays an annotated view of the
process diagram for a particular instance of a workflow
process.
Users can get a graphical depiction of their work item status.
It also displays a separate status summary for the work item,
the process, and each activity in the process.
Viewing Workflow Diagrams
Spider Systems Pvt. Ltd. Slide No. 34
What does a Workflow comprise of? (1 of 2)
Processes (Item Types)
A set of rules which determine how the business methodology is
to be routed.
Activities
These are the actions performed during the business process
Attributes
These are the various input or output variables that are needed by
the business process
Spider Systems Pvt. Ltd.
Process Components
Item Type
Process
Functions Notifications
Subprocesses
...
...
...
Lookup
Types,
Attributes,
PL/SQL
Messages,
Lookup
Types,
Attributes,
PL/SQL
Functions,
Notifications,
Lookup Types
... ...
Oracle Workflow Builder
Spider Systems Pvt. Ltd. Slide No. 37
What does a Workflow comprise of? (2 of 2)
Notifications
A notice sent to a particular user(s) to perform some action or just
for information
Messages
Each notification carries a message with it which is the actual text
of the notification
Functions
These are various PL/SQL procedures to be performed when a
particular activity is initiated by the Workflow.
Spider Systems Pvt. Ltd. Slide No. 38
General Workflow Terminology (1 of 7)
Process
A set of activities that need to be performed to accomplish a
business goal.
Process Definition
A workflow process as defined in Oracle Workflow Builder
Spider Systems Pvt. Ltd. Slide No. 39
General Workflow Terminology (2 of 7)
Item
A specific process or transaction managed by WF process.
Item Type
A grouping of all items of a category that share the same set of
attributes
For e.g.: PO Requisition is an Item Type used to group all PO
requisitions created.
Spider Systems Pvt. Ltd. Slide No. 40
General Workflow Terminology (3 of 7)
Access Level
A numeric value ranging from 0 1000 defining at which level the
user operates and whether user can modify the workflow definition
Protection Level
A numeric value ranging from 0 1000 that represents who the
workflow definition is protected from for modification
Access levels and Protection levels work in collaboration to
decide who can modify what in an Oracle Workflow.
Spider Systems Pvt. Ltd. Slide No. 41
General Workflow Terminology (4 of 7)
Activity
A unit of work performed during a business process
Attribute
A variable whose value can be initialized, referred or set during a
process run
Attributes can be associated with Activities, Item Types and
Messages
Node
An instance of an activity in a process diagram.
Spider Systems Pvt. Ltd. Slide No. 42
General Workflow Terminology (5 of 7)
Lookup Code
An internal name of a value defined in lookup type
Lookup type
A predefined list of values used to interact with users or define
the results of an activity
Result Type
The name of the lookup type that contains an activitys possible
result values.
Spider Systems Pvt. Ltd. Slide No. 43
General Workflow Terminology (6 of 7)
Notification
An instance of a message delivered to a user
Performer
A user/role assigned to perform a particular (human) activity.
Generally, assigned to a notification
Role
One or more users grouped by a common responsibility or
position
Message
Information to be sent containing subject, body and some
message attributes
Spider Systems Pvt. Ltd. Slide No. 44
General Workflow Terminology (7 of 7)
Function
A PL/SQL Procedure that can perform automated tasks which
define the business rules
Timeout
The amount of time during which a notification activity must be
performed before the WF engine transitions to an alternate
activity (if defined) or error process.
Transition
The relationship between completion of one activity and
initialization of another activity. (Arrows)
Spider Systems Pvt. Ltd. Slide No. 45
Steps to build a Workflow
Plan your business process
Create the components of your workflow in the navigator
window.
You can use the WFSTD item type for predefined
components like lookup types and functions.
Create the process diagram by dragging the components into
the process window.
Save and Launch your work flow
Spider Systems Pvt. Ltd. Slide No. 46
Methods in designing a Workflow
TopDown Design
If you prefer to approach your design from a high level, you can
first sketching out the process diagram with activities, then go
back later to create the supporting objects for each activity
BottomUp Design
If you prefer to take a more programmatic approach to your
design, you can first define each of the supporting objects of your
process before attempting to create a higher level process
diagram.
Spider Systems Pvt. Ltd. Slide No. 47
Designing a simple Workflow (1 of 2)
Start Oracle Workflow Builder
Workflow Builder Icon will exist in Oracle for Windows group
Create a new workspace for your new process definition.
Click on File->New to create a new workspace (Data Store)
Create a new item type.
This classifies the work item to be managed by your process.
Define item type attributes
Spider Systems Pvt. Ltd. Slide No. 48
Designing a simple Workflow (2 of 2)
Create new lookup types and assign lookup codes to them
Create new messages.
Create a new process activity, notification activity or function
activity.
Diagram the process.
Save your work by choosing Save or Save As from the File
menu.
If you use any PL/SQL procedures in function activities, code
that procedure into the database.
Spider Systems Pvt. Ltd. Slide No. 49
Re-cap
Understood the concepts of a Workflow
Realized its advantage in automating and monitoring
Business Processes and the flexibility that it provides.
Features of Oracle Workflow 2.5
Components of Oracle Workflow
Components of a Workflow
General Workflow terminology w.r.t various components
discussed above.
Designing a Workflow, Quick-Start Wizard
Spider Systems Pvt. Ltd. Slide No. 50
Allowing Access to an Object
In the Access tab page, the Range of Editable Access Levels
indicator bar provides a relative indication of the range of access
levels that can edit the object.
The shaded area represents the access levels that can edit the
object, while the vertical bar represents your current access level.
The indicator bar can be shaded solid green, or shaded with any
combination of solid green and crosshatch grey
Three different types of levels define the Security of a Workflow Item
Type.
Access Level
Protection Level
Customization Level.
Spider Systems Pvt. Ltd. Slide No. 51
Allow Modification to Customized Objects
Allow modifications of customized objects check box in
the About Oracle Workflow Builder :
Checked : The range of editable access levels can appear
as a combination of solid green and crosshatch grey
areas.
The levels depicted by grey crosshatches represent levels
that usually cannot modify customized objects, but can
now do so because Oracle Workflow Builder is operating
in upload mode.
Upload mode means that Oracle Workflow Builder can
save your edits, overwriting any protected objects that you
have access to modify as well as any previously
customized objects.
Spider Systems Pvt. Ltd. Slide No. 52
Allow Modifications Check Box
UncheckedThe range of editable access levels appears as a
solid green area.
This indicates that when you save your work, Oracle
Workflow Builder is operating in upgrade mode, only saving
edits to protected objects that you have access to change
and leaving objects that have been previously customized
untouched.
Note: An object appears with a small red lock over its icon in
the navigator tree to indicate that it is a readonly if you are
operating at an access level that does not have permission to
edit an object, that is, your access level is in a white area of
the Range of Editable Access Levels indicator bar.
Spider Systems Pvt. Ltd. Slide No. 53
Seed Data
Seed data refers to either of the following:
Workflow object definitions that can and should be customized to
meet a certain consumer needs.
Workflow object definitions protected against customization because
they represent standards that may also be upgraded in the future by
the provider.
Spider Systems Pvt. Ltd. Slide No. 54
Who works with seed data?
Seed Data Provider
Organization that creates the seed data for others
Object definitions protected against customization
Seed Data Consumer
Organization that uses the seed data in the application
Workflow objects that can and must be customized.
Spider Systems Pvt. Ltd. Slide No. 55
Default Protection Levels
The following range of levels are presumed by Oracle
Workflow:
0-9 Oracle Workflow
10-19 Oracle Application Object Library
20-99 Oracle Applications development
100-999 Customer organization.
You can determine how you want this range to be interpreted. For
example, 100 can represent headquarters, while 101 can represent a
regional office, and so on.
1000 Public
Spider Systems Pvt. Ltd. Slide No. 56
Workflow Access Protection
Spider Systems Pvt. Ltd. Slide No. 57
Access Level
Each user of Oracle Workflow operates the system at a
certain access level according to the range of levels listed
before.
A user of Oracle Workflow is a person who loads workflow
process definitions from a file into a database.
One should always operate Oracle Workflow Builder at the
same consistent access level because the level you work at
affects the protection level of the seed data you create.
You can view your access level in Oracle Workflow Builder, by
clicking on the "About Workflow" from the Help menu.
Spider Systems Pvt. Ltd. Slide No. 58
Protection Level
Whenever you create a workflow object in Oracle Workflow
Builder, you have the option of protecting the object at a
certain level.
An objects protection level controls whether other users
can modify the object based on their access levels.
To change the protection level of an object, display the
Access tab of the objects property page.
The protection level that you set for an object is dependent
on your current access level.
Spider Systems Pvt. Ltd. Slide No. 59
Options in Access Level
In the Options region, use the Preserve Customizations and
Lock at this Access Level check boxes to define the access
levels that can modify this object.
Spider Systems Pvt. Ltd. Slide No. 60
Options in Access Level
The options that you check in this region directly affect the
values that appear in the Levels region. This table assumes
that the user setting the options has an access level of 100.
Spider Systems Pvt. Ltd. Slide No. 61
The link
Object may be updated by any access level.
Objects can be updated by only the creators access
level.

Objects may be updated by users with access level
equal or lower than creators access level.

Objects may be updated by users with access level


equal or higher than creators access level.

Access Level Applied to Objects Lock at


this
Access
Level
Preserve
Customizati
ons
Spider Systems Pvt. Ltd. Slide No. 62
Customization Level
The customization level indicates that the object can only be
further modified by someone operating at an access level
equal to or higher than the customization level.
This ensures that a customizable object that has been
customized never gets overwritten during a seed data
upgrade because the upgrade always occurs with the
Workflow Definitions Loader operating at an access level
below the customized objects customization level.
Spider Systems Pvt. Ltd. Slide No. 63
Workflow objects: Functions Using
PL/SQL
Spider Systems Pvt. Ltd. Slide No. 64
Using PL/SQL
Any Notification activity or Function activity can have a
stored procedure or packaged procedure being called to
perform certain database activity.
All PL/SQL stored procedures that are called by function or
notification activities should follow the standard API format
so that the Workflow Engine can properly execute the
activity.
Spider Systems Pvt. Ltd. Slide No. 65
DOs and DONTs in PL/SQL
The Workflow Engine traps errors produced by function
activities by setting a savepoint before each function
activity.
If an activity produces an unhandled exception, the engine
performs a rollback to the savepoint, and sets the activity to
the ERROR status.
Do not use TCLs in procedures in a function activity.
The Workflow Engine never issues a commit as it is the
responsibility of the calling application to commit.
Spider Systems Pvt. Ltd. Slide No. 66
Creating Function
Steps to create Function
Prepare PL/SQL Package Procedure using standards as per WF
format.
Specify the function with package procedure created
Use Results to decide the next direction for flow.
Spider Systems Pvt. Ltd. Slide No. 67
Specifying it in an Activity.
Spider Systems Pvt. Ltd. Slide No. 68
Parameters for a PL/SQL
When the Workflow Engine calls a stored procedure for a
function activity, it passes four parameters to the procedure
and may expect a result when the procedure completes.
Itemtype (IN) : Internal name of the item
Itemkey (IN) : A string to uniquely identify the item type instance
Actid (IN) : ID of the activity from where this
procedure is called.
Funcmode (IN) : Execution mode of the activity
Resultout (OUT) : Result Type of the activity
Spider Systems Pvt. Ltd. Slide No. 69
FUNCMODE and RESULTOUT
FUNCMODE
For functions, it can be RUN or CANCEL
For notifications, it can be RESPOND, FORWARD, TRANSFER or
TIMEOUT
RESULTOUT
COMPLETE:<result>: Activity successful.
WAITING : Pending for some other activity
DEFERRED:<date> : Activity deferred till <date>
NOTIFIED:<notif_id>:<assgn_user>: Activity notified to
<assgn_user> with a <notif_id>. Externally, must be completed
using WF_ENGINE.CompleteActivity.
ERROR:<err_code> :Activity encounters an error <err_code>
Spider Systems Pvt. Ltd. Slide No. 70
PL/SQL Coding Standards (1 of 5)
Procedure <procedure name>
( itemtype in varchar2,
itemkey in varchar2,
actid in number,
funcmode in varchar2,
resultout out varchar2 )
is
<local declarations>;
Spider Systems Pvt. Ltd. Slide No. 71
PL/SQL Coding Standards (2 of 5)
Begin
if ( funcmode = RUN ) then
<your RUN executable statements>
resultout := COMPLETE:<result>;
return;
end if;
if ( funcmode = CANCEL ) then
<your CANCEL executable statements>
resultout := COMPLETE;
return;
end if;
Spider Systems Pvt. Ltd. Slide No. 72
PL/SQL Coding Standards (3 of 5)
if ( funcmode = RESPOND ) then
<your RESPOND executable statements>
resultout := COMPLETE;
return;
end if;
if ( funcmode = FORWARD ) then
<your FORWARD executable statements>
resultout := COMPLETE;
return;
end if;
Spider Systems Pvt. Ltd. Slide No. 73
PL/SQL Coding Standards (4 of 5)
if ( funcmode = TIMEOUT ) then
<your TIMEOUT executable statements>
resultout := COMPLETE;
return;
end if;
if ( funcmode = TRANSFER ) then
<your TRANSFER executable statements>
resultout := COMPLETE;
return;
end if;
Spider Systems Pvt. Ltd. Slide No. 74
PL/SQL Coding Standards (5 of 5)
Exception
When others then
WF_CORE.CONTEXT (<package name>,
<procedure name>, <itemtype>,
<itemkey>, to_char(<actid>),
<funcmode>);
raise;
End <procedure name>;
Spider Systems Pvt. Ltd. Slide No. 75
PL/SQL Coding Standards (1 of 5)
Procedure <procedure name>
( itemtype in varchar2,
itemkey in varchar2,
actid in number,
funcmode in varchar2,
resultout out varchar2 )
is
<local declarations>;
Spider Systems Pvt. Ltd. Slide No. 76
Creating Function
Spider Systems Pvt. Ltd. Slide No. 77
Spider Systems Pvt. Ltd. Slide No. 78
procedure c00_get_cust_status (itemtype in
varchar2,
itemkey in
varchar2,
actid in
number,
funcmode in
varchar2,
resultout out
varchar2) is
V_cust_code varchar2(20) ;
Spider Systems Pvt. Ltd. Slide No. 79
/* Below is some part of full logic */
v_cust_code := wf_engine.getItemAttrText (
itemtype => itemtype,
itemkey => itemkey,
aname => 'CUST_CODE');
Spider Systems Pvt. Ltd. Slide No. 80
select cust_status into v_cust_status
from c00_customer
where cust_code = v_cust_code ;
wf_engine.setitemattrtext (itemtype =>
itemtype,
itemkey =>
itemkey,
aname =>
'CUST_STATUS',
avalue =>
v_Cust_status);
Spider Systems Pvt. Ltd. Slide No. 81
if v_Cust_status = 'Y' then
resultout := wf_engine.eng_completed || ':' || 'Y';
else
resultout := wf_engine.eng_completed || ':' || 'N';
end if ;
Spider Systems Pvt. Ltd. Slide No. 82
STANDARD Activities
Oracle Workflow provides some generic activities one can use in
designing processes.
The activities are associated with the Standard item type but can be
used within any process one defines.
The Standard item type is automatically installed on your Oracle
Workflow server.
You can also access the Standard item type from the file wfstd.wft
located on your PC in the \<ORACLE_HOME>\Wf\data\<language>\
subdirectory.
All these activities call pre-defined procedures in the
WF_STANDARD package.
Spider Systems Pvt. Ltd. Slide No. 83
AND/OR Activities
In cases where multiple parallel branches transition to a
single node, you can decide whether that node should
transition forward when
Any of those parallel branches complete (OR)
Uses the WF_STANDARD.AndJoin procedure
When all of the parallel branches complete. (AND)
Uses the WF_STANDARD.OrJoin procedure
Spider Systems Pvt. Ltd. Slide No. 84
COMPARISON Activity
The comparison activities provide a standard way to
compare two numbers, dates, or text strings.
Compare Date compares a date-type item with a constant
date
Compare Number compares a number-type item with a
constant number
Compare Text compares two text-type item types.
All of these use the procedure :
WF_STANDARD.Compare.
Spider Systems Pvt. Ltd. Slide No. 85
WAIT Activity
The Wait activity pauses the process for the time you specify.
One can wait until -
A specific date
A given day of the month
A given day of the week
A period of time after this activity is encountered
This activity calls the PL/SQL procedure named
WF_STANDARD.WAIT.
Spider Systems Pvt. Ltd. Slide No. 86
Attributes of a WAIT Activity
Spider Systems Pvt. Ltd. Slide No. 87
Attribute values of a WAIT Activity
Spider Systems Pvt. Ltd. Slide No. 88
Launching a WF through PL/SQL
Workflow APIs needed to launch a Workflow through PL/SQL
are
WF_ENGINE.CreateProcess
WF_ENGINE.SetItemAttr<type>
WF_ENGINE.StartProcess
Spider Systems Pvt. Ltd. Slide No. 89
Example for Custom Requisition WF ( 1 of 5 )
PROCEDURE StartProcess( RequisitionNumber IN VARCHAR2,
RequisitionDesc IN VARCHAR2,
RequisitionAmount IN NUMBER,
RequestorUsername IN VARCHAR2,
ProcessOwner IN VARCHAR2,
Workflowprocess IN VARCHAR2 DEFAULT
NULL,
item_type IN VARCHAR2 DEFAULT NULL ) IS
--
ItemType VARCHAR2(30) := NVL(item_type,'WFDEMO');
ItemKey VARCHAR2(30) := RequisitionNumber;
ItemUserKey VARCHAR2(80) := RequisitionDesc;
--
Spider Systems Pvt. Ltd. Slide No. 90
Example for Custom Requisition WF ( 2 of 5 )
BEGIN
--
-- Start Process :
-- If workflowprocess is passed, it will be run.
-- If workflowprocess is NOT passed, the selector
function
-- defined in the item type will determine which
process to run.
--
Wf_Engine.CreateProcess( ItemType => ItemType,
ItemKey => ItemKey,
process => WorkflowProcess );
Spider Systems Pvt. Ltd. Slide No. 91
Example for Custom Requisition WF ( 3 of 5 )
Wf_Engine.SetItemUserKey ( ItemType => ItemType,
ItemKey =>
ItemKey,
UserKey =>
ItemUserKey);
--
--
-- Initialize workflow item attributes
--
Wf_Engine.SetItemAttrText ( itemtype => itemtype,
itemkey => itemkey,
aname =>
'REQUISITION_NUMBER',
avalue => RequisitionNumber);
--
Spider Systems Pvt. Ltd. Slide No. 92
Example for Custom Requisition WF ( 4 of 5 )
` Wf_Engine.SetItemAttrText ( itemtype => itemtype,
itemkey => itemkey,
aname =>
'REQUISITION_DESCRIPTION',
avalue => ItemUserKey);
--
Wf_Engine.SetItemAttrNumber ( itemtype => itemtype,
itemkey => itemkey,
aname => 'REQUISITION_AMOUNT',
avalue => RequisitionAmount );
--
Wf_Engine.SetItemAttrText ( itemtype => itemtype,
itemkey => itemkey,
aname =>
'REQUESTOR_USERNAME',
avalue => RequestorUsername);
Spider Systems Pvt. Ltd. Slide No. 93
Example for Custom Requisition WF ( 5 of 5 )
Wf_Engine.SetItemOwner ( itemtype => itemtype,
itemkey => itemkey,
owner => ProcessOwner );
--
Wf_Engine.StartProcess( itemtype => itemtype,
itemkey => itemkey );
EXCEPTION
WHEN OTHERS THEN
--
Wf_Core.context('WF_REQDEMO','StartProcess',RequisitionNu
mber,RequisitionAmount,RequestorUsername,ProcessOwner,Wor
kflowprocess);
RAISE;
--
END MyStartProcess;
Spider Systems Pvt. Ltd. Slide No. 94
Launch Process Activity
The Launch Process activity lets you launch another workflow
process from the current process.
This activity calls the PL/SQL procedure named
WF_STANDARD.LAUNCHPROCESS.
Spider Systems Pvt. Ltd. Slide No. 95
WF: Technical Foundation
Spider Systems Pvt. Ltd. Slide No. 96
WF_ACTIVITY_ATTRIBUTES
* ACTIVITY_ITEM_TYPE
* ACTIVITY_NAME
* ACTIVITY VERSION
* NAME
WF_ACTIVITY_ATTR_VALUES
* PROCESS_ACTIVITY_ID
* NAME
WF_PROCESS_ACTIVITIES
* INSTANCE_ID
WF_ACTIVITY_TRANSITIONS
* FROM_PROCESS_ACTIVITY
* RESULT_CODE
* TO_PROCESS_ACTIVITY
WF_ITEM_ACTIVITTY_STATUSES
* ITEM_TYPE
* ITEM_KEY
* PROCESS_ACTIVITY
WF_ITEM_ACTIVITY_STATUSES
WF_ACTIVITIES
* ITEM_TYPE
* NAME
* VERSION
A B C D E F
Spider Systems Pvt. Ltd. Slide No. 97
WF_ITEM_TYPES
* NAME
WF_ITEMS
* ITEM_TYPE
* ITEM_KEY
WF_ITEM_ATTRIBUTES
* ITEM_TYPE
* NAME
WF_ITEM_ATTRIBUTES_VALUES
* ITEM_TYPE
* ITEM_KEY
* NAME
B D E
G
Spider Systems Pvt. Ltd. Slide No. 98
WF_MESSAGE_ATTRIBUTES
* MESSAGE_TYPE
* MESSAGE_NAME
* NAME
WF_NOTIFICATION ATTRIBUTES
* NOTIFICATION_ID
* NAME
WF_MESSAGES
* TYPE
* NAME
WF_NOTIFICATIONS
* NOTIFICATION_ID
WF_ROUTING_RULES
* RULE_ID
WF_ROUTING_RULE_ATTRIBUTES
* RULE_ID
* NAME
* TYPE
A
G
C F
Spider Systems Pvt. Ltd. Slide No. 99
WF_ITEM_TYPES
It stores all the Item_type definitions
NAME
PROTECT_LEVEL
CUSTOM_LEVEL
PERSISTENCE_TYPE
PERSISTENCE_DAYS
WF_SELECTOR
Spider Systems Pvt. Ltd. Slide No. 100
WF_ITEM_ATTRIBUTES
The WF_ITEM_ATTRIBUTES table stores definitions of
attributes associated with a process.
Each row includes the sequence in which the attribute is
used as well as the format of the attribute data.
ITEM_TYPE
NAME
SEQUENCE
TYPE
PROTECT_LEVEL
CUSTOM_LEVEL
SUBTYPE
FORMAT
Spider Systems Pvt. Ltd. Slide No. 101
WF_ITEMS
WF_ITEMS is the runtime table for workflow processes. Each
row defines one work item within the system.
ITEM_TYPE
ITEM_KEY
ROOT_ACTIVITY
OWNER_ROLE
PARENT_ITEM_TYPE
PARENT_ITEM_KEY
BEGIN_DATE
END_DATE
USER_KEY
Spider Systems Pvt. Ltd. Slide No. 102
WF_PROCESS_ACTIVITIES
WF_PROCESS_ACTIVITIES stores the data for an activity
within a specific process.
A process activity is a Modeled workflow process, which can be
included as an activity in other processes to represent a sub
process
PROCESS_ITEM_TYPE
PROCESS_NAME
PROCESS_VERSION
ACTIVITY_ITEM_TYPE
ACTIVITY_NAME
Spider Systems Pvt. Ltd. Slide No. 103
WF_ACTIVITIES
WF_ACTIVITIES table stores the definition of an activity.
ITEM_TYPE
NAME
VERSION
TYPE
RERUN
EXPAND_ROLE
PROTECT_LEVEL
CUSTOM_LEVEL
BEGIN_DATE
END_DATE
Spider Systems Pvt. Ltd. Slide No. 104
WF_ITEM_TYPES
It stores all the Item_type definitions
NAME
PROTECT_LEVEL
CUSTOM_LEVEL
PERSISTENCE_TYPE
PERSISTENCE_DAYS
WF_SELECTOR
Spider Systems Pvt. Ltd. Slide No. 105
Relation Between Tables (1 of 3)
WF_ITEMS consists of all the definitions of each
ITEM_TYPES.
When a Workflow is launched, WF_ITEMS gets populated
with a new record for that item with the ITEM_TYPE and a
ITEM_KEY entered by the user.
The WF_ENGINE.LaunchProcess and
WF_ENGINE.CreateProcess is called by the background
engine.
All the activities for this ITEM_TYPE are read from
WF_ACTIVITIES table.
Spider Systems Pvt. Ltd. Slide No. 106
Relation Between Tables (2 of 3)
WF_ITEM_ATTRIBUTES stores all the attributes from an
item. These are prompted at the launch of a workflow.
When attributes are read from the users, the
corresponding columns in WF_ITEM_ATTRIBUTES are
inserted into WF_ITEM_ATTRIBUTE_VALUES with a
ITEM_TYPE and ITEM_KEY to uniquely identify the
instance.
These can be changed by using
WF_ENGINE.SetItemAttr<datatype> procedure and read
using WF_ENGINE.GetItemAttr<datatype> function.
Spider Systems Pvt. Ltd. Slide No. 107
Relation Between Tables (3 of 3)
WF_ITEM_ACTIVITY_STATUSES store the activity values as
and when they complete. The WF_PROCESS_ACTIVITY
table provides for the INSTANCE_ID used to identify which
is the process.
The ACTIVITY_STATUSES and the
ACTIVITY_RESULT_CODE fields would identify how each
Workflow is progressing.
Spider Systems Pvt. Ltd. Slide No. 108
Views Used in Workflow
Workflow uses views for effective querying of data. These
views are de-normalized so as to provide a faster access
to data over networks.
Some of the important views are:
WF_ITEMS_V
WF_ITEM_ACTIVITY_STATUSES_V
WF_NOTIFICATIONS_VIEWS
WF_ROLES
WF_USERS
WF_USER_ROLES
Spider Systems Pvt. Ltd. Slide No. 109
PL/SQL APIs
Spider Systems Pvt. Ltd. Slide No. 110
Objectives
Various PL/SQL APIs exist for the working of Oracle
Workflow. We discuss some of these.
WF_ENGINE
WF_CORE
WF_PURGE
WF_MONITOR
WF_QUEUE
WF_NOTIFICATIONS
Spider Systems Pvt. Ltd. Slide No. 111
WF_ENGINE
The state of a workflow item is defined by the various states
of all activities that are part of the process for that item. The
engine changes activity states in response to an API call to
update the activity family of calls.
The Workflow Engine APIs can be called by an application
program or a workflow function in the runtime phase to
communicate with the engine and to change the status of
each of the activities.
These APIs are defined in a PL/SQL package called
WF_ENGINE.
Spider Systems Pvt. Ltd. Slide No. 112
WF_ENGINE Procedures (1 of 3)
CreateProcess
SetItemUserKey
GetItemUserKey
GetActivityLabel
SetItemOwner
StartProcess
LaunchProcess
Spider Systems Pvt. Ltd. Slide No. 113
WF_CORE
PL/SQL procedures called by function activities can use a set of
core Oracle Workflow APIs to raise and catch errors.
When a PL/SQL procedure called by a function activity either
raises an unhandled exception, or returns a result beginning with
ERROR:, the Workflow Engine sets the function activitys status
to ERROR and sets the columns ERROR_NAME,
ERROR_MESSAGE, and ERROR_STACK in the table
WF_ITEM_ACTIVITY_STATUSES to reflect the error.
The columns ERROR_NAME and ERROR_MESSAGE get set to
either the values returned by a call to WF_CORE.RAISE( ), or to
the SQL error name and message if no call to RAISE( ) is found.
The column ERROR_STACK gets set to the contents set by a call
to WF_CORE.CONTEXT( ), regardless of the error source.
Spider Systems Pvt. Ltd. Slide No. 114
WF_CORE Procedures
CLEAR
GET_ERROR
TOKEN
RAISE
CONTEXT
TRANSLATE
Spider Systems Pvt. Ltd. Slide No. 115
WF_PURGE
WF_PURGE can be used to purge obsolete runtime data
for completed items and processes, and to purge
information for obsolete activity versions that are no
longer in use.
One may want to periodically purge this obsolete data
from your system to increase performance.
Spider Systems Pvt. Ltd. Slide No. 116
WF_PURGE Procedures
Items
Activities
Notifications
Total
TotalPERM
Spider Systems Pvt. Ltd. Slide No. 117
WF_USER_ROLES
The WF_USER_ROLES view is an intersection of the users and
roles in WF_USERS and WF_ROLES.
User_Name
User_Orig_System
User_Orig_System_id
Role_Name
Role_Orig_System
Role_Orig_System_id
Spider Systems Pvt. Ltd. Slide No. 118
Administering WF
Spider Systems Pvt. Ltd. Slide No. 119
The administrative scripts to help set up and maintain various
features in Oracle Workflow. For the standalone version of
Oracle Workflow, the scripts are located on your server in the
Oracle Workflow admin/sql subdirectory. For the version of
Oracle Workflow embedded in Oracle Applications, the scripts
are located in the sql subdirectory under $FND_TOP.
Spider Systems Pvt. Ltd. Slide No. 120
Details with Manuals Page#
Run a workflow processwfrun.sql: page 14 13.
Start a background enginewfbkg.sql: page 14 4.
Show activities deferred for the next background engine
executionwfbkgchk.sql: page 14 5.
Display a status report for an item
wfstatus.sql: page 14 13.
wfstat.sql: page 14 13.
Spider Systems Pvt. Ltd. Slide No. 121
Change the internal name of a workflow object
Note: Generally, you cannot update the internal name of a
workflow object in Oracle Workflow Builder. However, if you load
your process definition to a database, you can use one of these
scripts to update a workflow objects internal name if no runtime
data exists for the object. You should only use these scripts to
correct errors in an objects internal name during design time.
wfchita.sql: page 14 6.
wfchitt.sql: page 14 6.

Potrebbero piacerti anche