You are on page 1of 10

Apps - CUSTOM.pll http://oracle.anilpassi.com/custom.pll-2.

html

Home Technical Articles Training Articles Receive Email for New Articles Contributors Apps Book

Home Technical Articles Oracle Workflows


MAIN MENU
Google Apps Calendars, messaging, email & more. Try Google Apps for Your Domain. www.google.com/a
Home
Online General Ledger Sign Up Free! Web Based Accounting & Powerful Reporting Software. zoho.com/books
Technical Articles
Financials Budget Portlets Get Customized Portlet Development Save on Portlet Building Costs www.syncex.com/services
HR and Payroll
Oracle Workflows This website has now moved to http://apps2fusion.com
Oracle Scripts
Installation
Fusion Twit ter http://twitter.com/anilpassi
Training Articles
Receive Email for New
Articles
Contributors
Apps Book

RELATED ITEMS

Playing with
CUSTOM.pll
Switch off
CUSTOM.pll
programatically
CUSTOM.pll | Print | E-mail

Written by Anil Passi


CUSTOM.pll Best
Sunday, 01 April 2007
Practice
CUSTOM.pll is used to add extensions to Oracle's form Functionality. Some of the common scenario where CUSTOM.pll can be used are:-
CUSTOM.pll versus
1. Enabling/Disabling the fields
Forms
2. Changing the List of Values in a LOV field at runtime.
Personalization
3. Defaulting values
4. Additional record level validations
5. Navigation to other screens.
6. Enabling Special Menu

Primarily there are t wo methods of ext ending Oracle Forms, and t hese are
CUSTOM.pll
FORMS Personalizations
In this article we will cover the basics of using CUSTOM.pll for extending Oracle Forms

H ow and why does CU STOM.pll work?


Every form in Oracle Apps is created using something called as TEMPLATE.fmb. But some of the modules like HRMS have their own HR Specific
Templates[HRTEMPLT.fmb]. These template files have form level triggers that make call to CUSTOM.pll. The triggers that can be trapped using CUSTOM.pll in HRMS
screen can be different than those which can be trapped for other modules.

Commonly used events that are trapped using CU STOM.pll are:-


ZOOM
WHEN-NEW-FORM-INSTANCE
WHEN-NEW-BLOCK-INSTANCE
WHEN-NEW-RECORD-INSTANCE
WHEN-NEW-ITEM-INSTANCE
WHEN-VALIDATE-RECORD

H owever, f or example in HR MS, you can also write code in CU STOM.pll to t rap below lilist
st ed event s :-
PRE-DELETE and POST-DELETE
PRE-UPDATE and POST-UPDATE
PRE-INSERT and POST-INSERT
POST-FORMS-COMMIT
WHEN-CREATE-RECORD
KEY-DELREC

1 of 10 5/24/2011 1:04 PM
Apps - CUSTOM.pll http://oracle.anilpassi.com/custom.pll-2.html

Home Contact Us

COPYRIGHT : This work is licensed


under a Creative Commons
Attribution-NonCommercial 2.5
License. The content on this site is
copyright protected.

H ow to identif y which t rigger is most suitable for writ ing your business logic?
You can either open the FMB itself, and see the triggers which are calling CUSTOM.pll.
However, there is a easier way to work out the most suitable triggers. You can navigate to Help/Diagnostics/Custom Code/Show Custom Events

Once that radio button has been set, you will see the list of Events Displayed on the screen.

I n some cases, the desired WH EN-NEW-BLOCK-INSTANCE or WH EN-NEW-ITEM-I NSTANCE are no t being fired. What can I do?
It should always be possible to trap these events in CUSTOM.pll . But in some cases, the form might have these triggers at block/field level, with the trigger property
being OVERRIDE. Due to this, the corresponding form level triggers[ to invoke CUSTOM.pll] do not fire. In this case you must raise a bug with Oracle on Metalink.

Structure code code in CUSTOM.pll


IF event_name = 'WHEN-NEW-FORM-INSTANCE'

2 of 10 5/24/2011 1:04 PM
Apps - CUSTOM.pll http://oracle.anilpassi.com/custom.pll-2.html

THEN
IF form_name = 'ARXTWMAI' AND block_name = 'INVOICE_HEADER'
THEN
xx_arxtwmai.default_customer;
ELSIF form_name = 'ARXTWMAI' AND block_name = 'INVOICE_HEADER'
THEN
.....
END IF;
ELSIF event_name = 'WHEN-NEW-BLOCK-INSTANCE'
THEN
.....
END IF ;

Lets take some scenario's where CU STOM.pll can be used


1. Change t he label of a field
app_item_property2.set_property ('BLOCK.FIELD',label,'New Label');

2. D efault a value
copy (TO_CHAR (n_person_id),'PERSON_BLOCK.PERSON_ID' );

3. Alt er t he SQL for LOV Query


PROCEDURE filter_customers_in_lov IS
v_customer_group_id recordgroup;
n_temp_id NUMBER;
v_customer_lov lov;
BEGIN
v_customer_group_id := create_group_from_query('XX_CUSTOMER_GROUP'
,'select ... from hz_cust_accounts where ..your custom criteria here..');
n_temp_id := populate_group(v_customer_group_id);
v_customer_lov := find_lov('EXISTING_LOV_NAME_HERE');
IF get_lov_property(v_customer_lov,group_name) = 'EXISTING_GROUP_NAME_HERE'
THEN
set_lov_property(v_customer_lov,group_name,'XX_CUSTOMER_GROUP');
END IF;
END filter_customers_in_lov;

4. Make a field mandat ory


app_item_property2.set_property ('XXBLOCK_NAME.XXFIELD_NAME',required,property_true);
Similarly you can enable or disable the fields too.

5. You can display messages, for example


FND_MESSAGE.CLEAR;
fnd_message.set_name('APPL_SHORT_NAME_HERE', 'MSG_NAME_HERE'); or fnd_message.set_string('message text');
fnd_message.warn or fnd_message.error or fnd_message.

6. Enable or Disable Special Menu


PROCEDURE manage_special_menu IS
mi_id menuitem;
BEGIN
mi_id := find_menu_item('SPECIAL.SPECIAL15');
IF name_in('system.cursor_block') = 'INVOICE_HEADER' THEN
app_special2.instantiate('SPECIAL15', 'Print Invoice');
set_menu_item_property(mi_id, displayed, property_true);
set_menu_item_property(mi_id, enabled, property_true);
ELSE
set_menu_item_property(mi_id, displayed, property_false);
END IF;
END manage_special_menu;

7. H andle the click on Special Menu


IF event_name = 'SPECIAL15' THEN
IF form_name = 'INVOICE_FORM' THEN
xx_invoice_form.process_printing;
END IF;
IF form_name = 'SUPPLIER_FORM' THEN
xx_supplier_form.email_supplier;
END IF;
END IF;

8. Ask user a quest ion, and take appropriat e action


v_token_value VARCHAR2(1000);
n_button_selection INTEGER;
BEGIN
fnd_message.set_name('APPL', 'MESSAGE');
fnd_message.set_token('XXTOKEN1', v_token_value);
n_button_selection := fnd_message.question('Email Invoice', 'Fax Invoice', '', 1, 2, 'question');

3 of 10 5/24/2011 1:04 PM
Apps - CUSTOM.pll http://oracle.anilpassi.com/custom.pll-2.html

IF n_button_selection = 1 THEN
xx_call_invoice_print;
ELSE
xx_fax_invoice;
END IF;

9. Call Anot her form f unct ion


fnd_function.EXECUTE(
function_name => 'XX_FORM_FUNCTION_NAME_HERE'
,open_flag => 'Y'
,session_flag => 'SESSION'
,other_params => 'P_INVOICE_ID = "' || n_invoice_header_id || '"'
,activate_flag => 'Y');

10. Make some segments of a KeyFlexfield Display-Only depending upon some condition
For example to make 1st segment of a KFF display-only, we can use
IF v_check_result='xyz' THEN
FND_KEY_FLEX.UPDATE_DEFINITION(
BLOCK => 'BLOCKNAMEHERE'
,FIELD => 'FLEXFIELDNAME'
,ENABLED => 'Y'
,DISPLAYABLE => 1);
END IF ;

As you may have gathered by now, almost any form related task can be done using CUSTOM.pll
Action Type in CU STOM Allowed
Opening SQL Cursors Yes
Executing pl/sql stored procedures Yes
Referencing fields using bind notation like :block.field No
Exception management Yes

For additional reading on CU STOM.pll, please visit


Best Practices for Development on CUSTOM.pll
Playing with CUSTOM.pll

Comments (43)
Subscribe to this comment's feed

...
written by balkrishna , April 02, 2007
Excellent Article

i think u can elobrate this topic using some real time example
this will help in great

thnaks
balkrishna

...
written by Anil Passi , April 02, 2007
Cheers Bala

...
written by kumar , April 05, 2007
hi Anil

If you can organize this site ...that will be really great

thanks

...
written by Viral , April 15, 2007
Is it possible to write any other (apart of 6 triggers mentioned in custom.pll) trigger to write in custom.pll. Like PRE-INSERT or PRE-UPDATE. I need
to insert data in a staging table when the data in the form is INSERTED/UPDATED. How can I achieve this?

...
written by Pawan , April 19, 2007
about forms customization.
I have three or four button in forms,
i want to disable one button for particular user,not for senior lable person(like manager)
can u send me the steps for this)

4 of 10 5/24/2011 1:04 PM
Apps - CUSTOM.pll http://oracle.anilpassi.com/custom.pll-2.html

thanks in advance
pawan

...
written by Anil Passi , April 20, 2007
Hi there

You can use forms personalizatiton to achieve this. In the context field, enter the USERNAME for which button needs to be hidden.

In case there are two many users, then my question would be if superuser and lower-level user have differing responsibilities. If so, your context could be
responsibility.

If for some reasons you can not use Forms Personalization, then in CUSTOM.pll, use fnd_global.user_id or fnd_global.employee_id to drive your logic.

Thanks,
Anil

...
written by Datta , April 24, 2007
Hi Anil,
I want to convert forms from Forms 4.5 to Forms 10g, What is the procedure for it?
Will have to convert forms4.5 to forms 6i & then forms 6i to forms 10g? or is there any tool to do it. Please guide?

...
written by Anil Passi , April 25, 2007
Hi Datta

Yes, try 4.5-->6.0-->10g route

If that does not work, then 4.5-->6.0-->9g-->10g will certainly work.

Thanks,
Anil Passi

...
written by srinivasarao , April 29, 2007
hi,
excellent article

...
written by sandeep.yaparla , July 06, 2007
hi
The document what your given is very good
Actually i have one problem i need to display lov values based on my record group
For this i created one record group programmatically and i attached this group to lov and I attached this lov to my item when i run it ‘s showing the old values.
Actually the lov what am chaining is key flex field item lov i want to aching how can i help me out

...
written by Anil Passi , July 06, 2007
Hi Sandeep,

I haven't tried this, and I assume you aren't changing the LOV against the individual segment of KeyFlex.

Anyway, if standard KEY-FLEX API gets called in WHEN-NEW-ITEM-INSTANCE, then it will override your LOV/RG changes.

Try to get your code to execute in WHEN-NEW-ITEM-INSTANCE

Thanks,
Anil Passi

...
written by sandeep.yaparla , July 09, 2007
ya anil Thanks for your reply but i tried to override the kff lov with my lov for perticular item but its not showing its's displaying the old values.
would please give me an example because iam structed in middle i need to finish it asap
please
thanks
regards
sandeep.

...
written by Anil Passi , July 09, 2007
Hi Sandeep

Usually you never alter the KFF using personalization or CUSTOM.pll

5 of 10 5/24/2011 1:04 PM
Apps - CUSTOM.pll http://oracle.anilpassi.com/custom.pll-2.html

Are you simlpy wanting to filter the values during data entry?

You can also append to the where conditions of a Key Flexfield, a common example is for exclusion of accounts with summary flag

fnd_key_flex.define(BLOCK => 'YOUR BLOCK NAME'


,field => 'Your KFF Field Name'
,appl_short_name => 'SQLGL'
,code => 'GL#'
,num => v_chart_of_accts
,id => 'GL_CODE_COMBINATION_ID'
,displayable => 'ALL'
,description => 'ACCOUNT_FLEX_DESC'
,where_clause => 'summary_flag != ''Y'' and ENABLED_FLAG =''Y'' and detail_post ing_allowed_flag
ing_allowed_flag = ''Y''');

Thanks,
Anil Passi

...
written by sandeep.yaparla , July 10, 2007
Hi anil
thanks
i got it.

regards
sandeep

...
written by k.subbu , July 10, 2007
Dear Anil,

The articles in your website is excellent.It gives an indepth knowledge to anyone.The presentation of the articles is also excellent.

I am looking forward for some more articles like this.


i want form fire trigger sequence in oracle forms please send ASAp.

Thanks & Regards,


subbu

...
written by APassi , July 10, 2007
Hi Subbu

You can put some messages in these form triggers and note down the sequence in which they fire. If I remember it correctly, the sequence is pre-form,
when-new-form, pre-block,-when-new-block, pre-item, when-new-item.

I tried this some 8yrs ago, by putting in messages into these triggers. Please correct this if your findings are any different.

Thanks
Anil Passi

...
written by Ferry , July 13, 2007
Hi Anil,

first of all, thanks so much for this wonderful site, i learnt a lot.

i m thinking to customize the LoV query in Expenditure Type column in AP Invoice Distribution.

currently the Lov showing all the expenditure types, while in fact it should be restricted based on Resource Group defined in Project.

can i do this thru custom.pll???

Thanks&Regards,
Ferry

...
written by Anil Passi , July 13, 2007
Hi Ferry

Sure you can use CUSTOM.pll

But this can also be achieved using forms personalization FP

step 1. create a new record group with a query filtering on resource group
step 2. attach that record group to the existing LOV

6 of 10 5/24/2011 1:04 PM
Apps - CUSTOM.pll http://oracle.anilpassi.com/custom.pll-2.html

Both these steps are possible via FP

Thanks
Anil

...
written by kishan , August 16, 2007
Hi,
Can we handle the clear tool from tool bar in custom.pll

Regards
B.kishan kumar

...
written by fnd_key_flex.update_definition , September 02, 2007
Hi Anil,

i need some help on the point 10 on this document. copied below:


,FIELD => 'FLEXFIELDNAME' what do we need to put here?
for instance what could be FIELD when the flexfield is 'system items'? can we know this using the 'help->diagnostic->??'

thanks,
ahmed

10. Make some segments of a KeyFlexfield Display-Only depending upon some condition
For example to make 1st segment of a KFF display-only, we can use
IF v_check_result='xyz' THEN
FND_KEY_FLEX.UPDATE_DEFINITION(
BLOCK => 'BLOCKNAMEHERE'
,FIELD => 'FLEXFIELDNAME'
,ENABLED => 'Y'
,DISPLAYABLE => 1);
END IF ;

...
written by kishankumar , September 05, 2007
Hi,

Iam facing one situtation ,How to trap the clear record event in the custom.pll in PO screen. KEY-DELREC and KEY-CLRREC are captured only in HRMS
module or it can also capture in PO(distribution) module

Regards,
B.kishan kumar

...
written by kishankumar , September 05, 2007
Hi,

Iam facing one situtation ,How to trap the clear record event in the custom.pll in PO screen. KEY-DELREC and KEY-CLRREC are captured only in HRMS
module or it can also capture in PO(distribution) module

Regards,
B.kishan kumar

...
written by Anil Passi , September 05, 2007
Hi BK
Please open your PO form and see if APP_STANDARD.EVENT is getting called from the desired trigger at FORM Level

Also, use examine to see if any other alternate trigger/event combination may be used

7 of 10 5/24/2011 1:04 PM
Apps - CUSTOM.pll http://oracle.anilpassi.com/custom.pll-2.html

Thanks
Anil passi

apply validations
written by chris , October 12, 2007
Hi anil,

I need to write two custom codes to custom.pll and add a DFF. Details are
1)the oracle user,contractor and preparer should all be employees. in requisition and receipt forms emp name is mandatory. the two validations needs to such
that supp name associated with contractor should not be same as the suppname entered in requisition form and receipt form. If they are same then the
validation should not allow to save transaction if a) ora user/preparer has entered supp to whom preparer/user belong to and b)if user has entered receipt
against PO having supp same as user associated supp.The DFF will have Context value field for employee having LOV of ‘Employee’ and ‘Contractor’ ,if user
selects the value as ‘Contractor’, then supplier field will be prompted ,which is mandatory .

Thanks
chris

Master org to blocked


written by srinidhi goud , October 30, 2007
Hi anil,

I have a requirement to block the master org in the change organization form.
How can i do this using custom.pll.
Thanks and regards,
Srinidhi.

Custom.pll
written by SharmaManu , October 30, 2007
Hi Anil,
I found your site couple of weeks back and I found it very usefull, thanks for all your efforts. If possible please provide an insight.

Question : Requirement is that If ITEM has 0(ZERO) UNIT_PRICE than user should not be able to select it in PO form (POXPOEPO).
I dont want to customize form for this but enable to do it using Custom.pll, I'm able to pop-up message using Form Personalization but still Unit Price field is
editable.

Thanks

Descriptive Flexfiledl
written by Nile MA , November 15, 2007
Hi,
I read your article on Making some segments of a KeyFlexfield Display-Only depending upon some condition.

Similarly, is it possible to make some segments of a Descriptive Flexfield Disabled or ReadOnly. It will be helpful if you assist me.

Thanks,
Nile.

Firing Sequence of the Triggers in Forms 6i...


written by Mark Valentine , November 26, 2007
Hi to all...

Such a wonderful site... You have Anil Passi...

I would like to have the firing sequence of the triggers in the forms 6i.....

Regards,
Mark V.

using set_menu_it em_property


written by Sangram , January 03, 2008
Is there any way of using set_menu_item_property in forms personalization?

Help->diagnost ics-Custom Code ->Off


written by Velmurugan , January 08, 2008
Hi Anil, First i want to thank you for posting valuable technical/functional solutions.

I have one issue, that is a particular forms retrieves required record when the Help->diagnostics-Custom Code ->Off .

But the same time Help->diagnostics-Custom Code ->Normal, when i move the block its not showing correct records.

Question is Help->diagnostics-Custom Code ->Off in this case what are the code will be disabled.

Help->diagnost ics-Custom Code ->Off

8 of 10 5/24/2011 1:04 PM
Apps - CUSTOM.pll http://oracle.anilpassi.com/custom.pll-2.html

written by Velmurugan , January 08, 2008


Hi Anil, First i want to thank you for posting valuable technical/functional solutions.

I have one issue, that is a particular forms retrieves required record when the Help->diagnostics-Custom Code ->Off .

But the same time Help->diagnostics-Custom Code ->Normal, when i move the block its not showing correct records.

Question is Help->diagnostics-Custom Code ->Off in this case what are the code will be disabled. Is it personalization code or custom.pll code or even some
customization code from form trigger

Disable When-Validat e-it em t rigger


written by Vivek Kumr , January 14, 2008
Hi

is there any way using form Personalization, I can disable the When-Validate-Item trigger.

...
written by Anil Passi , January 15, 2008
Hi Vivek

You can use set item property item_is_valid = true.


I dont remember the exact syntax though. But if the item is in valid, when WVI will not be fired. But why would you ever want to stop standard validation doe by
Oracle's form?
This can cause data corruption if not analysed properly.

THanks,
Anil

change record group for lov in PO approve f orward_to it em


written by Alexandar , January 17, 2008
Hi,
I discovered that bind variable :po_approve.approval_path_id can not be used in record group, how to overcome this limitation?
Thanks.

How to find responsibility and applicaion_id f or t he current application in the cust om.pll
written by R A M S , February 21, 2008
Hi,

I have a requirement in Purchasing Order form by using Form personalization or Custom.pll, Requirement is as follows

1. Po Num(segment1 column) should be enabled (its done, no issue abt it)


2. Po number will be populated on our own sequences along with resp_name (first 3 letters) by concatanated with resp_name.

Thanks in advance for your valuable suggestions,

With Best,

Ramprasad K
M U M B A I..

For example BBC(where BBC is British Brod Corporation)

Problems using Cust om.pll


written by Adrian , March 10, 2008
I need to do this:
I need to do a validation in a standart form (OEXOEORD.fmb from release 12), using custom.pll, when i press the commit button.
Thanxs It's URGENT!!!
sorry my english!!!!!!!
thanxs again.

Problems using Cust om.pll


written by Adrian , March 10, 2008
I need to do this:
I need to do a validation in a standart form (OEXOEORD.fmb from release 12), using custom.pll, when i press the commit button.
Thanxs It's URGENT!!!
sorry my english!!!!!!!
thanxs again.

...
written by Anil Passi , March 10, 2008
Hi Adrian

Enable show custom events, and see if WHEN-VALIDATE-RECORD is captured CUSTOM.pll prior to COMMIT taking place.

Thanks,
Anil Passi

9 of 10 5/24/2011 1:04 PM
Apps - CUSTOM.pll http://oracle.anilpassi.com/custom.pll-2.html

...
written by Naveen Sankuratri , March 14, 2008
Hi Anil,
Its good to follow foot steps of Great people.Its not a bad thing to copy good ideas from people like you

Mr.
written by Julius Gonsalves , March 19, 2008
Hi Anil,

All your examples are very useful. I need to open a Custom From by button press of an Oracle Form. At present this button press is opening an Oracle Form.
What are the steps?

Thanks,

Julius

...
written by Julius Gonsalves , March 20, 2008
Hi Anil,

Can we write code in CUSTOM.pll for the event WHEN-BUTTON-PRESSED? At present 'Find' button of eBusiness Center Form (ASTRCALL) is calling
Universal Search Form (ASTLSGEN). I created a Custom Form based on ASTLSGEN.fmb. Now I want 'Find' button of eBusiness Center Form (ASTRCALL)
should call my form instead of Universal Search Form (ASTLSGEN).

Can it be done by Form Personalization? How?


If we need to use CUSTOM.pll for this, what are the steps?

Thanks,

Julius

...
written by Anil Passi , March 21, 2008
Hi Julius

I suggest that you hide that button using forms personalization and then create a new tools menu via FP. This new tool menu can call your custom form.

Thanks,
Anil

...
written by Julius Gonsalves , March 21, 2008
Hi Anil,

Many thanks for your quick respond.


That means FP or CUSTOM.pll will not work for WHEN-BUTTON-PRESSED event of an Apps form?

Julius

You must be logged in to a comment. Please register if you do not have an account yet.

Oracle 9i,10g, 11g Tuning and monitoring with Lab128 - for DBA and DB performance analysts www.lab128.com

1192+ of Oracle Openings Exp: 0 to 13 Yrs.Sal: 25k to 95k PM Apply Now & get Multiple Interviews TimesJobs.com/Oracle_Developer

Oracle 11g DBA Training Best Trainers, Best Place to Work in Indian Training Industry www.Koenig-India.com

10 of 10 5/24/2011 1:04 PM

You might also like