Sunteți pe pagina 1din 26

8/25/2014

oracle Workflow tutorial

The Best Dedicated Server


softlayer.com/dedicated-server

100,000+ Servers Already in Use. Order Yours & Start Work in Seconds


ARTICLES

SCRIPTS

TRAININGS

CONTACT

A RT IC LE S / T OOLS / WORKFLOW

Workflow tutorial
Prudhvi Avuthu

Search

Apps Questions
Ask a Question

Apr 17, 2011

erpSchools
Like

Overview:
This workflow tutorial will illustrate how to create or define a new workflow from

7,028 people like erpSchools.

scratch including 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
Recommend

collect the details of the item created and sends a notification to group of users along

Facebook social plugin

Forms Migration
sibvisions.com

with the details and link to master item form.


Process flow:

Tool-based Java migration - more


efficient than Forms!

When an item is created it will create/insert a record in MTL_SYSTEM_ITEMS_B so


create a database trigger on the table and launch workflow from that trigger. All you
need to do is create the workflow, create the trigger, pl/sql package, roles and finally
create an item in inventory.
Open WFSTD and save as new workflow

August 2014

Create Process
Create Functions including START and END

Create Attributes
Create Messages

10

Create Roles & assign to notification

11

12

13

14

15

16

17

Link all activities with in process

18

19

20

21

22

23

24

25

26

27

28

29

30

31

Create Notification

Save workflow to database


Create database trigger
Create PL/SQL Package
http://erpschools.com/articles/workflow-tutorial

1/26

8/25/2014

oracle Workflow tutorial

Run Workflow Background Process Concurrent Program

1) Open WFSTD and save as new workflow:

Jul

POPULAR QUESTIONS
Specify the steps that need to be
done starting from creating an invoice
until transferring it to GL in AP.
asked by

Prudhvi Avuthu

What table holds the link between


OM and AR?
asked by

Prudhvi Avuthu

Can we create an Invoice without


a PO in payables?
asked by

Prudhvi Avuthu

What does TCA stand for? What


is it used for ?
asked by

Prudhvi Avuthu

Name the standard Key Flexfields


in AR.
asked by

Navigation: File >> Open

Prudhvi Avuthu

What are Aging Periods used for


in AP?
asked by

Prudhvi Avuthu

What is the name of the program


used to import expense reports into
AP? Name the tables that store the
expense reports related date.
asked by haritha

What are Payment Terms?

asked by

Prudhvi Avuthu

Can you make a partial payment


for an invoice in AP?
asked by haritha

What is the process/steps for


Vendor Conversion?
asked by

Prudhvi Avuthu

Click Browse then navigate to Workflow installation directory


Navigation: Workflow Installation Directory WFDATAUSWFSTD
Now Click File > Save as, Enter ErpSchools Demo and click OK
Right click on WFSTD and select New Item type

http://erpschools.com/articles/workflow-tutorial

2/26

8/25/2014

oracle Workflow tutorial

Enter the fields as shown in below image

Now you will see ErpSchools Demo icon in the Navigator

http://erpschools.com/articles/workflow-tutorial

3/26

8/25/2014

oracle Workflow tutorial

Expand the node to see attributes, processes, notifications, functions, Events,


Messages and lookup types.

2) Create Process
Double click on Process to open up the properties window as shown below

http://erpschools.com/articles/workflow-tutorial

4/26

8/25/2014

oracle Workflow tutorial

Enter the fields as shown in below image

Click OK

http://erpschools.com/articles/workflow-tutorial

5/26

8/25/2014

oracle Workflow tutorial

Double click ErpSchools Process Icon to open process window where we can draw our
workflow diagram.

Right click on process window and then click on New Function.

http://erpschools.com/articles/workflow-tutorial

6/26

8/25/2014

oracle Workflow tutorial

Properties window will open as shown below

Change/Enter the fields as shown in below image


Change Item Type to Standard. This is important as we are using START and END
functions which came from WFSTD (Standard item type).
Select Internal Name as Start
Remaining fields will be populated automatically.
Go to Node tab and select Start from the drop down. This is mandatory and cant be
ignored.

http://erpschools.com/articles/workflow-tutorial

7/26

8/25/2014

oracle Workflow tutorial

Click Apply then OK

Again Right click on white space and click New Function

http://erpschools.com/articles/workflow-tutorial

8/26

8/25/2014

oracle Workflow tutorial

Change the properties as below


Item Type: Standard
Internal Name: END

Go to Node tab and select End from the drop down. This is mandatory and cant be
ignored.
Click Apply and then OK

http://erpschools.com/articles/workflow-tutorial

9/26

8/25/2014

oracle Workflow tutorial

We will come back to this process window later after we have all components /
activities ready to link. for now just close process window and go to navigator

3) Create Workflow Function:


Right click on white space in the process window and then click New Function.
Alternatively you can select Functions in Navigator and right click to get New
Function option

Enter the fields as shown in below image

http://erpschools.com/articles/workflow-tutorial

10/26

8/25/2014

oracle Workflow tutorial

Click Apply and then OK

We will join these activities later after we have our notification ready.

4) Create Workflow Attributes:


Navigation: Window menu > Navigator

http://erpschools.com/articles/workflow-tutorial

11/26

8/25/2014

oracle Workflow tutorial

Right click on Attributes and click New Attribute

Enter the fields as shown in below image

http://erpschools.com/articles/workflow-tutorial

12/26

8/25/2014

oracle Workflow tutorial

Click Apply and then OK


Create one more attribute
Right click on Attributes and click New Attribute

Enter the fields as shown in below image

http://erpschools.com/articles/workflow-tutorial

13/26

8/25/2014

oracle Workflow tutorial

Click Apply and then OK.


Here INVIDITM form belongs to Master Item for from inventory module.
Now we have two attributes ready to use.

5) Create Workflow Messages:


click on Message and click New

Properties window will pop up as show below

http://erpschools.com/articles/workflow-tutorial

14/26

8/25/2014

oracle Workflow tutorial

Enter the fields


Internal Name: ERP_SEND_ITEM_DET_MSG
Display Name: Send Item Details Message
Description: Send Item Details Message

Go to Body Tab and enter as shown below

http://erpschools.com/articles/workflow-tutorial

15/26

8/25/2014

oracle Workflow tutorial

Click Apply and then OK


Navigation: Window Menu > Navigator
Select Item Form Link Attribute

Drag and drop both attributes to Send Item Details Message. If you miss this step
you will not be able to see the attribute values with in email.

6) Create Workflow Notifications:


Right click on white space in process window and then click New Notification

http://erpschools.com/articles/workflow-tutorial

16/26

8/25/2014

oracle Workflow tutorial

Enter fields as shown in the below image


Message: Sned Item Details Message

Click Apply and then OK

7) Create Roles and assign it to notification:


Adhoc roles can be created through PL/SQL APIs 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
Alternatively you can use USERNAME directly with in the notification.
If you wish to create User Roles manually then follow the below articles

User Role Creation through API: WF_DIRECTORY API


User Role Creation from "User Management" Responsibility: Role Creat
http://erpschools.com/articles/workflow-tutorial

17/26

8/25/2014

oracle Workflow tutorial

ion

Using Adhoc roles in workflow notifications:


Navigation: File > Load Roles from Database
Select roles you want to use and then click OK.
Open the notification properties and then navigate to node tab, select performer as
the role you just created and loaded from database.
8)Link all activities with in process
Open Process window and join all the activities we created so far. To join one activity
to other you need to first select the source activity , right click and drag a line to
destination activity.

9)Save workflow to database


There are three different methods to upload a workflow into database. The simple one
is from workflow builder tool itself.
Go to File > Save as and choose the option database.
Provide your apps user login credentials and click OK.
To understand how to save workflow from a file (.wft) to database and vice versa you
can read the below article.
Workflow Migration

10)Launching workflow from PL/SQL:

Make sure to run "Workflow background process" after item is create


d.
Workflow will get into defered status initially and after workflow b
ackground process program is completed it should be in running mode.

http://erpschools.com/articles/workflow-tutorial

18/26

8/25/2014

oracle Workflow tutorial

Compile the PL/SQL code in database.


First create a database trigger as below to call a PL/SQL procedure from which you
kick off the workflow.
Create Database Trigger
1

CREATE OR REPLACE TRIGGER "ERP_SCHOOLS_DEMO_TRIGGER" AFTER INSERT ON INV.MTL_SYSTEM_ITEMS_B REFERENCING

DECLARE

lv_id

NUMBER

:= :NEW.inventory_item_id;

lv_item_segment1

VARCHAR2(100)

:= :NEW.segment1;

lv_itemtype

VARCHAR2(80)

:= :NEW.item_type;

lv_user_id

NUMBER

:= -1;

lv_itemkey

VARCHAR2(10);

lv_orgid

NUMBER

error_msg

VARCHAR2(2000);

10 error_code

:=2;

NUMBER;

11 BEGIN
12 lv_user_id := fnd_global.user_id;
13 lv_orgid := fnd_global.org_id;
14 lv_itemkey := 1132; -- This should be unique value
15 ERP_DEMO.LAUNCH_WORKFLOW('ERP_DEMO'
16 ,lv_itemkey
17 ,'ERPSCHOOLS_PROCESS' --process name
18 ,lv_id
19 ,lv_orgid
20 ,lv_item_segment1
21 );
22 EXCEPTION WHEN OTHERS THEN
23 error_code := SQLCODE;
24 error_msg

:= SQLERRM(SQLCODE);

25 RAISE_APPLICATION_ERROR(-20150,error_msg);
26 END;

Create PL/SQL Package to kickoff workflow


1

CREATE OR REPLACE PACKAGE APPS.ERP_DEMO IS

PROCEDURE LAUNCH_WORKFLOW

itemtype

IN VARCHAR2,

itemkey

IN VARCHAR2,

process

IN VARCHAR2,

item_id

IN NUMBER,

org_id

IN NUMBER,

item_segment1

IN VARCHAR2

10 );
11 END ERP_DEMO;

http://erpschools.com/articles/workflow-tutorial

19/26

8/25/2014

oracle Workflow tutorial

CREATE OR REPLACE PACKAGE BODY APPS.ERP_DEMO IS

PROCEDURE LAUNCH_WORKFLOW(

itemtype

IN VARCHAR2,

itemkey

IN VARCHAR2,

process

IN VARCHAR2,

item_id

IN NUMBER,

org_id

IN NUMBER,

item_segment1

IN VARCHAR2

10 IS
11 v_master_form_link varchar2(5000);
12 v_item_number varchar2(100);
13 v_add_item_id varchar2(5000);
14 error_code varchar2(100);
15 error_msg varchar2(5000);
16 BEGIN
17 v_add_item_id := ' ITEM_ID="' || item_id || '"';
18 v_item_number := item_segment1;
19 v_master_form_link := v_master_form_link || v_add_item_id;
20 WF_ENGINE.Threshold := -1;
21 WF_ENGINE.CREATEPROCESS(itemtype, itemkey, process);
22 -- Get the value of attribute assigned in workflow
23 v_master_form_link := wf_engine.getitemattrtext(
24 itemtype => itemtype
25 ,itemkey

=> itemkey

26 ,aname

=> 'ERP_SEND_ITEM_FORM_LINK');

27 -- assign values to variables so that you can usethe attributes


28 v_master_form_link := v_master_form_link||':#RESP_KEY="INVENTORY" #APP_SHORT_NAME="INV" ORG_MODE="Y" '
29 v_master_form_link := v_master_form_link || v_add_item_id;
30 --set the attribute values in workflow so that you can use them in notifications
31 WF_ENGINE.SetItemAttrText(itemtype, itemkey, 'MASTERFORM', v_master_form_link);
32 WF_ENGINE.SetItemAttrText(itemtype, itemkey, 'ERP_ITEM_NUMBER', item_segment1);
33 -- start the workflow process
34 WF_ENGINE.STARTPROCESS(itemtype, itemkey);
35 EXCEPTION WHEN OTHERS THEN
36 error_code := SQLCODE;
37 error_msg

:= SQLERRM(SQLCODE);

38 -- add dbms or fnd_output messages as required


39 END LAUNCH_WORKFLOW;
40 -- This procedure will just put the item number into workflow attribute ERP_ITEM_NUMBER
41 PROCEDURE GET_ITEM_DETAILS(
42 itemtype

IN VARCHAR2,

43 itemkey

IN VARCHAR2,

44 actid

IN NUMBER,

45 funcmode

IN VARCHAR2,

http://erpschools.com/articles/workflow-tutorial

20/26

8/25/2014
46 resultout

oracle Workflow tutorial


OUT NOCOPY VARCHAR2

47 )
48 IS
49 v_GET_ITEM_NUMBER VARCHAR2(1000);
50 BEGIN
51 SELECT SEGMENT1 INTO V_GET_ITEM_NUMBER FROM MTL_SYSTEM_ITEMS_B WHERE ROWNUM =1;
52 WF_ENGINE.SetItemAttrText(itemtype, itemkey, 'ERP_ITEM_NUMBER',v_GET_ITEM_NUMBER );
53 -- you can use the get function as below.
54 --v_GET_ITEM_NUMBER := wf_engine.getitemattrtext(
55 --

itemtype => itemtype

56 --

,itemkey

=> itemkey

57 --

,aname

=> 'X_ATTRIBUTE');

58 resultout:='COMPLETE:'||'Y';
59 exception when others then
60 dbms_output.put_line('Entered Exception');
61 fnd_file.put_line(fnd_file.log,'Entered Exception');
62 END GET_ITEM_DETAILS;
63 END ERP_DEMO;
64 /

Create Inventory Item


Go to Inventory module and create inventory item from master org form.

Run Workflow Background Process concurrent program

Go to System administrator responsibility and launch concurrent program Workflow


background process and choose Yes to the parameter process deferred.

RELATED POSTS
A RT IC LE S /

Register PL SQL stored procedure in Oracle Apps


T OOLS /

SQL Loader Part 2


WORKFLOW /

Oracle workflow ad hoc roles


A RT IC LE S /

AutoInvoice Grouping Rules


T OOLS /

SQL Loader Part 1


WORKFLOW /

Run / start workflow from Workflow Administrator Responsibility


http://erpschools.com/articles/workflow-tutorial

21/26

8/25/2014

oracle Workflow tutorial

A RT IC LE S /

Folders in Oracle Forms


T OOLS /

Forms Customization Steps and Registration Process


WORKFLOW /

Workflow migration: WFLOAD | Workflow Definitions Loader


A RT IC LE S /

Responsibility in Oracle Apps

Display and change images

DataLoader Tutorial

dynamically in XML publisher

33 COMMENTS

thirupathi

REPLY

JU L 22, 2011 @ 16:33:40

this is vary use full material


thank u

shantanu jain

REPLY

A U G 02, 2011 @ 07:27:12

this is the best website for study .

Core Tamil

REPLY

NOV 25, 2011 @ 16:47:00

Ammmaa Apdiya..

kartheeka

REPLY

A U G 10, 2011 @ 13:59:59

good for beginners

abhi karthi

REPLY

A U G 10, 2011 @ 14:01:14

very good material to easy learn

sudhakar

REPLY

A U G 10, 2011 @ 16:43:56

Excellent for beginners

Aparna

REPLY

A U G 18, 2011 @ 14:03:51

Can you please post such screenshots for discoverer tutorial for beginner
like where to write the query and all

javed khan

REPLY

A U G 23, 2011 @ 17:06:23

Can you please post such screenshots for discoverer plus tutorial for
http://erpschools.com/articles/workflow-tutorial

22/26

8/25/2014

oracle Workflow tutorial

beginner like how to edit the query and how to create new worksheet and
how to define the LOV for the parameter like wiseAll related
informatin.

sreenivas

REPLY

S E P 29, 2011 @ 11:35:40

Its good but but you missed the connectivity between start, function,
notification and end.
Its more usefull when yo provide such sreen shots for who ever wants to
do sample workflow development.
and its more usefull when you provide issues where you mostly will struck
up while developing workflow.
you site is very usefull for techical consultant.Keep it up our job my
friend.
Thanks
Sreenivas

RAKESH KUMAR KAR

REPLY

OC T 13, 2011 @ 15:01:48

this is vary use full material


thank u. It help me a lot.

MILAN

REPLY

OC T 14, 2011 @ 14:22:21

plz give me me a solution When an item is created it will create/insert a


record in MTL_SYSTEM_ITEMS_B ,the notification goes to the creator.
Workflow will launched from concuurent program not from the database
trigger.
will u plz help me out?

Waqas Hassan

REPLY

OC T 23, 2011 @ 15:52:04

Hi,
I want to download Oracle Workflow Builder. How can i download this
software?
Regards.

Mahendar

REPLY

D E C 08, 2011 @ 15:32:12

Use ful
but need brief intruduction about the used proces,,,,,

mahesh

REPLY

D E C 20, 2011 @ 15:43:30

hi,
how to add request date date column in order workflow first table and this
column extracts information from order line request date..
PLZ help me

sreekanth

REPLY

D E C 21, 2011 @ 09:48:42

Excellent material for the beginners. Thk you erp schools.

shishu paul

REPLY

FE B 07, 2012 @ 14:53:44

http://erpschools.com/articles/workflow-tutorial

23/26

8/25/2014

oracle Workflow tutorial

Very good material and definitions and like as an live demonstrations.


Shishu Paul Chandigarh

Raman

REPLY

MA Y 03, 2012 @ 12:26:14

Dear Sir,
Very good material, but small issue while saving the workflow,
can you help me out. Please find the error given below
382: Design Validation generated 1 warning(s). You may save
invalid definitions but they should not be used in running
process.
354: SAVE validation failed for activity
ERP_DEMO/ERP_ITEM_PROCESS.
352: Process must contain a start activity with no in
transitions.
Raman
REPLY

Jack
JU N 08, 2012 @ 00:51:38

Good effort, but alot of gaps.. it need more clarifications..anyway thanks !

aithya

REPLY

A U G 22, 2012 @ 15:46:10

hi
good material oracle workflow

Nageswara Rao

REPLY

A U G 27, 2012 @ 12:39:53

Hi Sir
This Example is very good.please tell me out deploy oracla apps.

sasha

REPLY

OC T 02, 2012 @ 23:22:18

Thank u sir. God bless u

Sunil Mane

REPLY

FE B 22, 2013 @ 12:26:54

I have tried this example. When I saved in data base and checked from
tables, get data from item_types,messages,attributes,processes. But i
cant get value for notification from WF_NOTIFICATIONS table. I have
created item in master organization and again checked but still not
getting value for notification and also from front end on workflow screen.
Can u help me to resolve it.

Puspendu Das

REPLY

A PR 10, 2013 @ 18:24:00

I am also facing the same problem as Sunil Mane


REPLY

abhi
MA Y 21, 2013 @ 21:47:26

Great . document
Regards
http://erpschools.com/articles/workflow-tutorial

24/26

8/25/2014

oracle Workflow tutorial

Abhi

Subhan

REPLY

A U G 26, 2013 @ 15:01:51

This is very use full material and very easy for beginner.

Jagadekara Reddy

REPLY

S E P 25, 2013 @ 15:06:11

HI RAMAN,
DOUBLE CLICK ON START ICON NODE TAB GIVE START/END AS START
AND END FOR END ICON THEN IT WILL VALIDATE

Abid

REPLY

OC T 04, 2013 @ 17:39:46

workflow cant be initialize from database trigger.


see note 603595.1

Abid

REPLY

OC T 04, 2013 @ 18:22:17

Sorry for previous comments


Workflow cant trigger from database trigger unless you run
Workflow Background Engine concurrent request

Mahtab

REPLY

OC T 12, 2013 @ 11:25:46

Excellent study material


REPLY

chandu
JU N 11, 2014 @ 14:20:08

This is good for beginers.


Thanks for you effort!!!

chandu

REPLY

JU N 11, 2014 @ 14:22:00

Good material for beginers.


Thanks for your effort

Priya MP

REPLY

JU N 26, 2014 @ 14:01:31

This tutorial is really helpful. Is it possible to query the


WS_NOTIFICATIONS table?

venkat

REPLY

JU L 02, 2014 @ 13:27:28

Hi Sir,
Thanks for your effort

LEAVE A REPLY
http://erpschools.com/articles/workflow-tutorial

25/26

8/25/2014

oracle Workflow tutorial

YOUR NAME
YOUR EMAIL
YOUR WEBSITE

POS T C OM M E NT

B AC K TO TOP

TAGS
Add ADF AP

API

ar

BI concurrent program Controller conversion email forms

sales order inventory Invoices JAva


personalization

o2c

position heirarchy Prepayments

iexpense

iexpenses interface internal requisition internal

OAF OAF Page om Oracle Oracle Apps order to cash output payables payment batch
process Publisher R12 REceivables Remove responsibilities responsibility

script users UTL_MAIL

workflow xml XML Publisher


Copyright erpSchools & Prudhvi Avuthu
Copying of content without written permission is not allowed.

http://erpschools.com/articles/workflow-tutorial

26/26

S-ar putea să vă placă și