Work Flows PDF
Work Flows PDF
Work Flows PDF
The flow of any work or task, which covers the entire cycle of that task, is called Workflow.
Example: If you want to apply the leave then you have to fill leave application and submit the same
to your manager. Then after reviewing your application your manager may approve/reject your
leave application. This is called workflow of leave.
Workflow is one of the components of Oracle Apps, which automates the flow of work/task. That
could be purchase order cycle, order management cycle etc.
1. Rules
2. Roles
3. Routing
4. Real time
1. Rules: This is related to business logic. This rule always refers to the requirements of the
business. It tells what to implement by using workflow. In Oracle Apps these rules are
implemented by Procedures
2. Roles: Role means who are mainly involved in the activity. For example in the above leave
workflow, Leave initiator, Manager are called roles in leave workflow. In oracle Apps
workflow, Responsibilities playing as roles.
3. Routing: Routing represents the actual flow of workflow. It tells us how the workflow is
going. In workflow diagram, the transition lines represent the routing of the workflow.
4. Real Time: This R represents the Real time concept in the workflow. By using workflow we
can control the time also. For example if the leave approval is pending with Manager for 3
days then automatically this workflow escalates to next approval authority. Time out
feature of Workflow implements this concept.
1. Workflow Builder: This is the main component of workflow. By using this component,
developers will develop/customize the workflow. You can create new workflow from scratch
or you can customize already existing seeded workflow.
2. Workflow Engine: This component mainly controls the entire workflow activities in Oracle
Apps.
3. Workflow Definition Loader: This component translates the graphic components to text
format while saving this workflow in disk as a file and it gets saved with .wft extension
(Workflow Text). This loader also translates the .wft format to graphics format while
opening the file in workflow builder.
4. Workflow Notification Engine: This component is responsible to send the notifications to the
roles defined in workflow. For example when employee submits the leave request,
workflow notification engine sends the leave information as notification to Manager.
5. Workflow Status Monitor: By using this component, we can see the status of worklow
related to current transaction.
Overview:
This article will illustrate how to create or define workflow attributes, notifications, messages, roles
or users, functions, processes and last but not the least, how to launch a workflow from PL/SQL.
The workflow concepts are better explained using an example.
Business Requirement:
When an item is created in inventory, workflow needs to be launched and it should collect the
details of the item created and sends a notification to group of users along with the details and link
to master item form.
Important WF Tables:
wf_user_role_assignments
wf_user_roles
wf_roles
wf_items
wf_item_attributes
wf_item_attribute_values
wf_item_attributes_tl
wf_activities
wf_activities_tl
wf_activity_attributes
wf_activity_attributes_tl
wf_activity_transitions
wf_deferred--wf_control
WF_NOTIFICATION_ATTRIBUTES
WF_MESSAGES
WF_MESSAGES_TL
WF_MESSAGE_ATTRIBUTES
WF_MESSAGE_ATTRIBUTES_TL
WF_ETS
WF_PROCESS_ACTIVITIES
WF_ITEMS is the runtime table for workflow processes. Each row defines one work item
within the system.
1)
Open WFSTD and save as new workflow:
Navigation: File >> Open
Click Browse then navigate to Workflow installation directory
Now Click File >Save as, Enter ErpSchools Demo and click OK
Navigation:
Window menu > Navigator
Type: Text
Type: Form
Value: INVIDITM
Click Apply and then OK
3) Create Workflow Function:
Open Erpschools process in That Right click and then click on New Function
6)
Create Roles:
Adhoc roles can be created through PL/SQL from database or they can be created from
Applications using User Management Responsibility. If you use PL/SQL to create roles make sure
you give all user names and role names in UPPER case to avoid some problems
BEGIN
wf_directory.CreateAdHocRole(lv_role,
lv_role_desc,
NULL,
NULL,
MAILHTML,
NULL,
NULL,
ACTIVE,
NULL);
End;
DECLARE
v_role_name varchar2(100);
v_user_name varchar2(100);
BEGIN
v_role_name := ERPSCHOOLS_DEMO_ROLE;
v_user_name := NAME3;
WF_DIRECTORY.AddUsersToAdHocRole(v_role_name, v_user_name);
END;
DECLARE
v_role_name varchar2(100);
v_user_name varchar2(100);
BEGIN
v_role_name := ERPSCHOOLS_DEMO_ROLE;
v_user_name := NAME3;
END;
Open the notification properties and then navigate to node tab, select performer as the role you
just created and loaded from database.
Tables:
WF_ROLES
WF_USER_ROLES
WF_LOCAL_ROLES
WF_USER_ROLE_ASSIGNMENTS
First create a database trigger as below to call a PL/SQL procedure from which you kick off the
workflow.
DECLARE
lv_itemkey VARCHAR2(10);
error_msg VARCHAR2(2000);
error_code NUMBER;
BEGIN
lv_user_id := fnd_global.user_id;
lv_orgid := fnd_global.org_id;
ERP_DEMO.LAUNCH_WORKFLOW(ERP_DEMO
,lv_itemkey
,lv_id
,lv_orgid
,lv_item_segment1
);
EXCEPTION
error_code := SQLCODE;
error_msg := SQLERRM(SQLCODE);
RAISE_APPLICATION_ERROR(-20150,error_msg);
END;
PROCEDURE LAUNCH_WORKFLOW
itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
process IN VARCHAR2,
item_id IN NUMBER,
org_id IN NUMBER,
item_segment1 IN VARCHAR2
);
END ERP_DEMO;
PROCEDURE LAUNCH_WORKFLOW(
itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
process IN VARCHAR2,
item_id IN NUMBER,
org_id IN NUMBER,
item_segment1 IN VARCHAR2
)
IS
v_master_form_link varchar2(5000);
v_item_number varchar2(100);
error_code varchar2(100);
error_msg varchar2(5000);
BEGIN
v_item_number := item_segment1;
WF_ENGINE.Threshold := -1;
v_master_form_link := wf_engine.getitemattrtext(
set the attribute values in workflow so that you can use them in notifications
WF_ENGINE.STARTPROCESS(itemtype, itemkey);
error_msg := SQLERRM(SQLCODE);
END LAUNCH_WORKFLOW;
This procedure will just put the item number into workflow attribute ERP_ITEM_NUMBER
PROCEDURE GET_ITEM_DETAILS(
itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
actid IN NUMBER,
funcmode IN VARCHAR2,
IS
v_GET_ITEM_NUMBER VARCHAR2(1000);
BEGIN
WF_ENGINE.SetItemAttrText(itemtype, itemkey,
ERP_ITEM_NUMBER,v_GET_ITEM_NUMBER );
v_GET_ITEM_NUMBER := wf_engine.getitemattrtext(
resultout:=COMPLETE:||Y';
dbms_output.put_line(Entered Exception);
fnd_file.put_line(fnd_file.log,Entered Exception);
END GET_ITEM_DETAILS;
END ERP_DEMO;