Oracle Workflow Tutorial

26
8/25/2014 oracle Workflow tutorial http://erpschools.com/articles/workflow-tutorial 1/26 Prudhvi Avuthu Apr 17, 2011 ARTICLES / TOOLS / WORKFLOW Workflow tutorial Overview: This workflow tutorial will illustrate how to create or define a new workflow from 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 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. Process flow: 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 Create Process Create Functions including START and END Create Attributes Create Messages Create Notification Create Roles & assign to notification Link all activities with in process Save workflow to database Create database trigger Create PL/SQL Package Search Apps Questions Ask a Question August 2014 M T W T F S S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 The Best Dedicated Server softlayer.com/dedicated-server 100,000+ Servers Already in Use. Order Yours & Start Work in Seconds erpSchools 7,028 people like erpSchools. Facebook social plugin Like Forms Migration sibvisions.com Tool-based Java migration - more efficient than Forms! ARTICLES SCRIPTS TRAININGS CONTACT Recommend

Transcript of Oracle Workflow Tutorial

Page 1: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

Prudhvi Avuthu

Apr 17, 2011

A RT IC LE S / TOOLS / WORKFLOW

Workflow tutorial

Overview:

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

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

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.

Process flow:

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

Create Process

Create Functions including START and END

Create Attributes

Create Messages

Create Notification

Create Roles & assign to notification

Link all activities with in process

Save workflow to database

Create database trigger

Create PL/SQL Package

Search

Apps Questions

Ask a Question

August 2014

M T W T F S S

1 2 3

4 5 6 7 8 9 10

11 12 13 14 15 16 17

18 19 20 21 22 23 24

25 26 27 28 29 30 31

The Best Dedicated Serversoftlayer.com/dedicated-server

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

erpSchools

7,028 people like erpSchools.

Facebook social plugin

Like

Forms Migrationsibvisions.com

Tool-based Java migration - more

efficient than Forms!

ARTICLES SCRIPTS TRAININGS CONTACT

Recommend

Page 2: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

Run “Workflow Background Process” Concurrent Program

1) Open WFSTD and save as new workflow:

Navigation: File >> Open

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

« 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

→ 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

Page 3: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

Enter the fields as shown in below image

Now you will see ErpSchools Demo icon in the Navigator

Page 4: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

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

Page 5: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

Enter the fields as shown in below image

Click OK

Page 6: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

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.

Page 7: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

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 can’t be

ignored.

Page 8: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

Click Apply then OK

Again Right click on white space and click New Function

Page 9: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

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 can’t be

ignored.

Click Apply and then OK

Page 10: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

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

Page 11: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

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

Page 12: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

Right click on Attributes and click New Attribute

Enter the fields as shown in below image

Page 13: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

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

Page 14: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

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

Page 15: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

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

Page 16: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

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

Page 17: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

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 API’s 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

Page 18: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

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.

Page 19: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

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

–Create PL/SQL Package to kickoff workflow

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

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 :=2;

error_msg VARCHAR2(2000);

error_code NUMBER;

BEGIN

lv_user_id := fnd_global.user_id;

lv_orgid := fnd_global.org_id;

lv_itemkey := 1132; -- This should be unique value

ERP_DEMO.LAUNCH_WORKFLOW('ERP_DEMO'

,lv_itemkey

,'ERPSCHOOLS_PROCESS' --process name

,lv_id

,lv_orgid

,lv_item_segment1

);

EXCEPTION WHEN OTHERS THEN

error_code := SQLCODE;

error_msg := SQLERRM(SQLCODE);

RAISE_APPLICATION_ERROR(-20150,error_msg);

END;

1

2

3

4

5

6

7

8

9

10

11

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

);

END ERP_DEMO;

Page 20: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

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

)

IS

v_master_form_link varchar2(5000);

v_item_number varchar2(100);

v_add_item_id varchar2(5000);

error_code varchar2(100);

error_msg varchar2(5000);

BEGIN

v_add_item_id := ' ITEM_ID="' || item_id || '"';

v_item_number := item_segment1;

v_master_form_link := v_master_form_link || v_add_item_id;

WF_ENGINE.Threshold := -1;

WF_ENGINE.CREATEPROCESS(itemtype, itemkey, process);

-- Get the value of attribute assigned in workflow

v_master_form_link := wf_engine.getitemattrtext(

itemtype => itemtype

,itemkey => itemkey

,aname => 'ERP_SEND_ITEM_FORM_LINK');

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

v_master_form_link := v_master_form_link||':#RESP_KEY="INVENTORY" #APP_SHORT_NAME="INV" ORG_MODE="Y" '

v_master_form_link := v_master_form_link || v_add_item_id;

--set the attribute values in workflow so that you can use them in notifications

WF_ENGINE.SetItemAttrText(itemtype, itemkey, 'MASTERFORM', v_master_form_link);

WF_ENGINE.SetItemAttrText(itemtype, itemkey, 'ERP_ITEM_NUMBER', item_segment1);

-- start the workflow process

WF_ENGINE.STARTPROCESS(itemtype, itemkey);

EXCEPTION WHEN OTHERS THEN

error_code := SQLCODE;

error_msg := SQLERRM(SQLCODE);

-- add dbms or fnd_output messages as required

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,

Page 21: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

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

TOOLS /

SQL Loader Part 2

WORKFLOW /

Oracle workflow ad hoc roles

A RT IC LE S /

AutoInvoice Grouping Rules

TOOLS /

SQL Loader Part 1

WORKFLOW /

Run / start workflow from Workflow Administrator Responsibility

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

resultout OUT NOCOPY VARCHAR2

)

IS

v_GET_ITEM_NUMBER VARCHAR2(1000);

BEGIN

SELECT SEGMENT1 INTO V_GET_ITEM_NUMBER FROM MTL_SYSTEM_ITEMS_B WHERE ROWNUM =1;

WF_ENGINE.SetItemAttrText(itemtype, itemkey, 'ERP_ITEM_NUMBER',v_GET_ITEM_NUMBER );

-- you can use the get function as below.

--v_GET_ITEM_NUMBER := wf_engine.getitemattrtext(

-- itemtype => itemtype

-- ,itemkey => itemkey

-- ,aname => 'X_ATTRIBUTE');

resultout:='COMPLETE:'||'Y';

exception when others then

dbms_output.put_line('Entered Exception');

fnd_file.put_line(fnd_file.log,'Entered Exception');

END GET_ITEM_DETAILS;

END ERP_DEMO;

/

Page 22: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

A RT IC LE S /

Folders in Oracle Forms

TOOLS /

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

dynamically in XML publisher

›DataLoader Tutorial

33 COMMENTS

thirupathi JUL 22, 2011 @ 16:33:40

this is vary use full material

thank u

REPLY

shantanu jain

AUG 02, 2011 @ 07:27:12

this is the best website for study ………….

REPLY

Core Tamil NOV 25, 2011 @ 16:47:00

Ammmaa Apdiya..

REPLY

kartheeka

AUG 10, 2011 @ 13:59:59

good for beginners

REPLY

abhi karthi AUG 10, 2011 @ 14:01:14

very good material to easy learn

REPLY

sudhakar

AUG 10, 2011 @ 16:43:56

Excellent for beginners

REPLY

Aparna

AUG 18, 2011 @ 14:03:51

Can you please post such screenshots for discoverer tutorial for beginner

like where to write the query and all

REPLY

javed khan

AUG 23, 2011 @ 17:06:23

Can you please post such screenshots for discoverer plus tutorial for

REPLY

Page 23: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

beginner like how to edit the query and how to create new worksheet and

how to define the LOV for the parameter like wise……All related

informatin.

sreenivas

SEP 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

REPLY

RAKESH KUMAR KAR

OCT 13, 2011 @ 15:01:48

this is vary use full material

thank u. It help me a lot.

REPLY

MILAN

OCT 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?

REPLY

Waqas Hassan

OCT 23, 2011 @ 15:52:04

Hi,

I want to download “Oracle Workflow Builder”. How can i download this

software?

Regards.

REPLY

Mahendar

DEC 08, 2011 @ 15:32:12

Use ful…

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

REPLY

mahesh

DEC 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

REPLY

sreekanth

DEC 21, 2011 @ 09:48:42

Excellent material for the beginners. Thk you erp schools.

REPLY

shishu paul FEB 07, 2012 @ 14:53:44

REPLY

Page 24: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

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

Shishu Paul Chandigarh

Raman

MAY 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

JUN 08, 2012 @ 00:51:38

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

REPLY

aithya

AUG 22, 2012 @ 15:46:10

hi

good material oracle workflow

REPLY

Nageswara Rao

AUG 27, 2012 @ 12:39:53

Hi Sir

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

REPLY

sasha

OCT 02, 2012 @ 23:22:18

Thank u sir. God bless u

REPLY

Sunil Mane

FEB 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.

REPLY

Puspendu Das

APR 10, 2013 @ 18:24:00

I am also facing the same problem as Sunil Mane

REPLY

abhi MAY 21, 2013 @ 21:47:26

Great …. document

Regards

REPLY

Page 25: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

Abhi

Subhan

AUG 26, 2013 @ 15:01:51

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

REPLY

Jagadekara Reddy

SEP 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

REPLY

Abid

OCT 04, 2013 @ 17:39:46

workflow can’t be initialize from database trigger.

see note 603595.1

REPLY

Abid

OCT 04, 2013 @ 18:22:17

Sorry for previous comments

Workflow can’t trigger from database trigger unless you run

Workflow Background Engine concurrent request

REPLY

Mahtab

OCT 12, 2013 @ 11:25:46

Excellent study material

REPLY

chandu

JUN 11, 2014 @ 14:20:08

This is good for beginers.

Thanks for you effort!!!

REPLY

chandu

JUN 11, 2014 @ 14:22:00

Good material for beginers.

Thanks for your effort

REPLY

Priya MP

JUN 26, 2014 @ 14:01:31

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

WS_NOTIFICATIONS table?

REPLY

venkat JUL 02, 2014 @ 13:27:28

Hi Sir,

Thanks for your effort

REPLY

LEAVE A REPLY

Page 26: Oracle Workflow Tutorial

8/25/2014 oracle Workflow tutorial

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

B AC K TO TOP

TAGS

Add ADF AP API ar BI concurrent program Controller conversion email forms iexpense iexpenses interface internal requisition internal

sales order inventory Invoices JAva o2c OAF OAF Page om Oracle Oracle Apps order to cash output payables payment batch

personalization position heirarchy Prepayments 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.

YOUR NAME

YOUR EMAIL

YOUR WEBSITE

POS T C OM M E NT