Sunday, November 8, 2009

Oracle Workflow and Workflow Components

Oracle Workflow
Workflow is a business management system that automates and streamlines business process. Within and between enterprises, oracle workflow supports complete business process integration. Enables modeling, automation. Enables routing information of any type according to user defined business rules.

Workflow Process

Every Business process is represented as a workflow process. Each workflow process in turn consists of a sequences of activities. Activities Includes business events such as raising PO, includes functions such as updating requisitions details and notifications such as e-mail to manager for approval. Sequence of such activities are represented in a Workflow process to achieve a business requirement.

Sample Workflow Process


Oracle Workflow is available in Two Versions:
- Standalone version
- Embedded version
1. A standalone version of Oracle Workflow is available with the Oracle database and Oracle9i Application Server.
2. Oracle Workflow is embedded in the Oracle E-Business Suite to enforce a common set of business rules.
3. Oracle Workflow Embedded version is incorporated in applications including Enterprise Resource Planning (ERP), Customer Relationship Management (CRM), and Human Resources Management Systems (HRMS).
4. Oracle Workflow Embedded version  is leveraged by both professional applications (which are typically Forms-based applications for power users)
5. Self-service applications (which are typically HTML-based applications i expenses for expense reports processing)
6. Our discussion is confined to embedded workflow. But the concepts we discuss hold good for Standalone workflow version also.

Processing of event based workflow
On occurrence of event (such as submission of invoice for approval) Application Modules Raises invoice approval event and passes it to BES. BES triggers event subscriptions using rule functions. These event subscription in turn launches workflow process.



Oracle Workflow Architecture



Oracle workflow grouped into four parts
- Workflow Development Client
- Oracle Server
- Application Server
- End-User Client

Workflow Development Client: The development client is a PC running Windows 95, Windows 98, Windows 2000, or Windows NT 4.0 or higher. This platform is used to create and modify Oracle Workflow process definitions.
Development tool/utilities used by workflow developers to define workflow process are
-Workflow Builder
-Workflow Definitions Loader
-Workflow XML Loader

Oracle Server: The Oracle Server platform is the Oracle RDBMS. This platform hosts the business application integrated with Oracle Workflow, the Workflow Engine, Business Event System, Notification System, and directory services.
Components that reside on Oracle Server are
-Workflow Engine
-Notification System
-Directory Services
-Business Event System (for Event Based Workflow)

Application Server: The application server is the environment outside of the RDBMS. This environment includes ancillary services such as the Oracle9i Application Server (Oracle9iAS) as the web server, and the Notification Mailer.
End-User Client: The end-user client is the workstation or PC that an end user uses to perform daily tasks. This client includes browser support for reviewing and responding to notifications in the Notification Worklist, the Oracle Workflow Monitor to view workflow process, as well as mail applications for reviewing and responding to notifications by e-mail.
Components that reside on Client and accessible using browser are
-Notification Worklist
-Workflow Monitor

Workflow Process and Process Definition

A process definition is composed of activities and the relationship between them that accomplish workflow process. Workflow process is initiated when an application calls a set of Oracle Workflow Engine APIs. Workflow engine invokes “Start” activity or “Receive” Event of a Workflow Process.

1.Each workflow process is identified by unique Item Type at database level(such as Payables Invoice Approval Workflow Item type is APINV).
2.Each workflow process is saved in a single flat file. Payables Invoice Approval Workflow process definition is stored in apfiawie.wft flat file.
3.After opening the workflow process definition in workflow builder. Right click on Item Type (in below picture it is AP Invoice) and select properties.
4.This displays Item type internal name and display name.
5.Workflow Process consists of Process Activities (In this slide we can note two process ‘Invoice Approval -  Main and Send Notifications)


Process Activity
Most important activity in workflow process is a  process activity. Process activity represents a collection of other activities (Function, Event, Notification). Icons/Nodes represents activities and Arrow corresponds to transition from one activity to other. Process Diagram displays Process activity. In this diagram we can see Invoice Approval – Main process activity comprising “Receive Invoice”, “Check if matched to PO”, “Send Notifications” etc.,


Function Activity
A function activity calls a PL/SQL stored procedure or some external program to perform an automated function in process activity. Select Activity Icon from process diagram. Right click on it and select properties. Check the first tab page to identify the activity type. Here it is a “Function” activity.

Event Activity
An event activity can either Receive, Raise, or Send a business event. This can be noted from “Event Action” field. We can select Icon using “Browse” button. Event Activity retrieves the event name, event key, and event data as specified in the event details (tab page). The event details can be dynamically determined at runtime.

-A Receive event activity can be marked as a Start activity for a process, meaning it is always enabled to receive events. Alternatively, a Receive event activity can be placed within the process, so that it is only enabled to receive events
-A Raise event activity retrieves information about the event and raises the event to the Business Event System, which will then execute subscriptions to the event.
-A Send event activity retrieves the event name, event key, event message, outbound agent, and inbound agent, as specified in the node’s event details.

Notification Activity
When the workflow engine reaches a notification activity, it issues a Send( ) API call to the Notification System to send the message to an assigned performer. In this notification activity, Message being sent can be found in the Message field. This field holds the message content name. (In below picture Message content is Identified by name “Request Approver”). When a performer responds to a notification activity, the Notification System processes the response and informs the workflow engine that the notification activity is complete so that it can continue processing the next eligible activity.

In Notification Activity, you specify the performer (I.e. receiver) of a notification in “Node” tab page in Performer section. You can either designate the performer to be a specific role or an type attribute that dynamically returns the name of a role.


Attributes
Attributes Acts as a global variable that can be referenced or updated by any activity within a process. Applications packages can reference and set item type attributes using the Oracle Workflow Engine APIs during runtime of workflow process. Attributes provide information that will need in a notification message. Can Right Click on Attribute in navigation Tree and select Properties. This displays internal name and type.


Wfstatus.sql
Wfstatus.sql is provided along with workflow product or oracle application. We can find it in $fnd_top/sql folder. We need to run this script from sql*plus. Complete list of activities executed for workflow process instance are displayed. Spooling the result to text file makes it easy for customer to send details of workflow process instance to support.

wfstatus.Sql script execution:          
- Change to the $FND_TOP/sql directory
- Connect to sqlplus as apps
- spool
- Run the following command
  @wfstatus APINV  57936_1 (Input parameters are Item_type and Item_key)
- spool off
- Open to view details of workflow Item

This is the output report of wfstatus.sql



Workflow Item section consists of Process Instance details. One record exists for combination of Item Type and Item Key. If no record is selected means workflow process is not launched and other sections of report will not have any information. Please note correct Item Type and Item Key needs to provided. Otherwise we will not get any data in workflow Item section.

Activity Statuses Section provides Activities executed in Activity column. Generally value in this column has two parts separated by forward slash “/”. First Part indicates the process activity and Second part indicates activity within that process activity. In this example ‘Invoice Approval Main” is the Process activity and “Check if matched to PO” is the activity within that process.

Status Column Provides the status of activity.

Result column provides Return value on completion of that activity.


Errored Activities section provide details of activities that got Errored while executing workflow process.
Attribute Values provide values of variables that are being used while executing  workflow process.
Related Posts Plugin for WordPress, Blogger...