<-----Google Analytics Code Start----> <-----Google Analytics Code Close---->
Skip to content

Green

color

Default screen resolution  Wide screen resolution  Increase font size  Decrease font size  Default font size  Skip to content Default color Pink color Green color Green color
This website has now moved to http://apps2fusion.com





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


Primarily there are two methods of extending Oracle Forms, and these are

    CUSTOM.pll
    FORMS Personalizations
In this article we will cover the basics of using CUSTOM.pll for extending Oracle Forms


How and why does CUSTOM.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 CUSTOM.pll are:-

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


However, for example in HRMS, you can also write code in CUSTOM.pll to trap below listed events :-

PRE-DELETE and POST-DELETE
PRE-UPDATE and POST-UPDATE
PRE-INSERT and POST-INSERT
POST-FORMS-COMMIT
WHEN-CREATE-RECORD
KEY-DELREC




How to identify which trigger is most suitable for writing 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.



In some cases, the desired WHEN-NEW-BLOCK-INSTANCE or  WHEN-NEW-ITEM-INSTANCE are not 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'
      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 CUSTOM.pll can be used
1. Change the label of a field

app_item_property2.set_property ('BLOCK.FIELD',label,'New Label');

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

3. Alter the 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 mandatory

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. Handle 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 question, and take appropriate 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');
  IF n_button_selection = 1 THEN
    xx_call_invoice_print;
  ELSE
    xx_fax_invoice;
  END IF;


9. Call Another form function
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 CUSTOM
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 CUSTOM.pll, please visit
Best Practices for Development on CUSTOM.pll
Playing with CUSTOM.pll




Comments (43)add
...
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)
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

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_posting_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

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


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_item_property
written by Sangram , January 03, 2008
Is there any way of using set_menu_item_property in forms personalization?
Help->diagnostics-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->diagnostics-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. Is it personalization code or custom.pll code or even some customization code from form trigger
Disable When-Validate-item trigger
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 forward_to item
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 for the current application in the custom.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 Custom.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 Custom.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
...
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.

busy