Tuesday, November 16, 2010

Forms Personalization

In this article, I would like to explain different possibilities of Forms Personalizations. Surely before explaining what can be done, first we will touch base upon what exactly it is.


Why was forms personalization introduced by Oracle in 11.5.10?
1. CUSTOM.pll is a programmatic methodology for extending Oracle Forms, even for trivial tasks.
2. Multiple developers working on same CUSTOM.pll could cause version related headaches

Does Forms Personalization replace CUSTOM.pll?
Not really, however it does provide an alternative to most common activities for which earlier one would use CUSTOM.pll
Forms personalization is driven by the same set of events as that for CUSTOM.pll.
Keep in mind that Oracle Forms Libraries first invoke the Forms Personalization, and then the CUSTOM.pll too for the same set of events.

How do I enable Forms Personalizations?
Enable the personalizations using the Help/Diagnostics menu.
What are the various components of Forms Personalizations?Different components of Oracle Forms Personalizations are listed below. You begin with recognizing which Triggers/Events that you wish to trap and under what conditions. The condition can be entered using the syntax as defined in the picture below.
What does the Action Tab do?Here you will either change form property, or display messages or enable menu etc.
Can I modify SQL Query behind the LOV using Forms Personalizations?Of course you can. In the below example I am restricting the LOV to less than 3records by introducing where rownum <3

Can I call a PL/SQL Stored procedure passing it form field variables?Yes, using the syntax below.
Note: You can also invoke FORMS_DDL built-in to perform DDL.
Can I call BuiltIn's? Indeed, as shown below, you can pick from all the form built-in's as below.



What is forms Personalization?
It is new features where some of the customization can be handled easy by simply setting the rules from the front end.It is available from 11.5.10.2
Why do we need forms Personalization?
For example in scenarios like
1.Change the prompts
2.Display some custom message when certain conditions are met
3.Enable and disabling fields/buttons based on conditions
4.For Enabling special menu.(like opening another reference form from the current form)
IF both Form personalization and custom pll are done for a form which one will take effect first?
Form personalization first and then only custom pll
How to start doing it?
Open the form where you want to personalize .
Menu Navigation: Help ->Diagnostics->Custom Code -> Personalize
This should open the personalization Form.
There are two profile options which will decide whether you able to see or not
Profiles:
Utilities: Diagnostics = Yes/No
Hide Diagnostics = Yes/No



There is new option available for level to define whether the rule need to be applied at form level or function level.Because a form can be attached to multiple functions.
Insert Get Expression & Insert item value button help you in building the conditional statement , very help for non technical people.
The major thing to observe are
1.SEQ: The sequence in which the rules are executed
2.Description:Description of the Rule
3.Level -- whether it is at form level or Function level..
4.Condition –what is the event and the object where the below condition need to
be checked
5.Action-- what actions it should perform when the condition is met
6.Context -- same a profile option levels at what level the rule need to be applied
Under actions
SEQ: it gives the list of actions that need to be performed when the condition is met
Type:1.Property – used for changing the properties of field
Message –used to display message when the condition is met
Built in --used to calling some standard form and AOL functionalities 
Menu -- used in case of enabling special menu’s
General & Important Observations:
All actions and rules can be enabled and disabled(using checkbox) or deleted using delete option on the tool bar
Always validate the rule after you create using validate button
Save the record before you close this personalization form
To move form personalization from one instance to other there is FNDLOAD utility available .

Check the site for FNDLOAD examples…

Standard Forms Customization(Part1--Custom PLL )


There are different ways to handle Forms Level Customizations.
1.Using Custom.PLL
2.Using Forms Personalizations
3.Copy the Standard form Object and Change the Code

First lets see Custom.pll how to use it?


What is Custom.PLL??
The CUSTOM.pll library is a standard Oracle Forms PL/SQL library that is supplied by Oracle with the Oracle
Applications. This is Oracle’s built-in feature that allows the customer to enhance the standard functionality of the
Applications by implementing site-specific business rules. Every Oracle Forms -based eBusiness screen, and any
custom form developed using the Oracle Application development standards, will access the CUSTOM library.
This makes an ideal point of creating business rules that effect the entire organization.

Where is this located?
Custom.pll is located in $AU_TOP/resource Directory.

How to add code to this ?
open this pll using the Form builder.make changes to the program units

How to compile this PLL ?
Once you make changes you need to compile the pll.use the F60gen to compile it
f60gen module=custom.pll userid=APPS/ output_file=$AU_TOP/resource/custom.plx module_type=library batch=no compile_all=special

What are Different Triggers that is supported?

WHEN-NEW-FORM-INSTANCE – initially entering a form

WHEN-NEW-BLOCK-INSTANCE – entering a zone (or block) within a form

WHEN-NEW-ITEM-INSTANCE – moving into a new field within the form

WHEN-NEW-RECORD-INSTANCE - creating a new record

WHEN-FORM-NAVIGATE – navigating thru a form using the mouse

WHEN-VALIDATE-RECORD – saving (committing) the information to the database

EXPORT – triggered by using the Export feature Some events are field specific

ZOOM – Pre -11 feature for moving to another form and querying up specific records

Some events are form specific

SPECIALn - (where n is a number between 1 and 45) used to generate entries in the ‘Special’ menu of the
tool bar and the code is triggered by selecting a menu choices from the ‘Special’ option on the toolbar

KEY-Fn – (where n is a number between 1 and 8) triggered by pressing the corresponding function key

Some events are application specific:
Application Object Library

WHEN-LOGIN-CHANGED – when a user logs on as a different user
WHEN-RESPONSIBILITY-CHANGED – when a user changes responsibilities
WHEN-PASSWORD-CHANGED – when a user changes their password

How to make changes get affected?
Once you make the changes compile the pll and generate the PLX
Since the CUSTOM library is loaded once for a given session, a user must log out of the
application and sign-on again before any changes will become apparent.



Examples--Metalink:

1. Sample code to make all the responsibilities read only for a specific user.
BEGIN

IF event_name = 'WHEN-NEW-FORM-INSTANCE' THEN
IF FND_PROFILE.VALUE('USER_NAME')='' THEN

BEGIN
COPY('Entering app_form.query_only_mode.','global.frd_debug');
COPY('YES', 'PARAMETER.QUERY_ONLY');
APP_MENU2.SET_PROP('FILE.SAVE', ENABLED,PROPERTY_OFF);
APP_MENU2.SET_PROP('FILE.ACCEPT', ENABLED,PROPERTY_OFF);
formname := NAME_IN('system.current_form');
blockname := GET_FORM_PROPERY(formname, FIRST_BLOCK);

WHILE (blockname is not null) LOOP

IF (GET_BLOCK_PROPERTY(blockname, BASE_TABLE) is not NULL) THEN

SET_BLOCK_PROPERTY(blockname, INSERT_ALLOWED, PROPERTY_FALSE);
SET_BLOCK_PROPERTY(blockname, UPDATE_ALLOWED, PROPERTY_FALSE);
SET_BLOCK_PROPERTY(blockname, DELETE_ALLOWED, PROPERTY_FALSE);

END IF;

blockname := GET_BLOCK_PROPERTY(blockname, NEXTBLOCK);

END LOOP;


END query_only_mode;


END;

2.How does one restrict or reduce the LOV?
"The customer LOV can be overriden using the when-new-item-instance or when-new-form-instance event at the form level through CUSTOM.pll."
You will need to write custom code using that specific event in the custom.pll

Some sample code
if (event_name = 'WHEN-NEW-FORM-INSTANCE' and form_name = 'form name')then
r:=find_group('group name');
if not id_null(r) then
delete_group('group name');
end if;
v:='select colum1,column2
from table';

r:=create_group_from_query('group name',v);

set_lov_property('lov NAME',group_name,r);--lov

See that the column names should be same as the old query so that the mappings still holds good



3.How to make the attachment function in specific responsibilities to act as read-only mode so that users who log into these specific responsibilities can only view attachments, while for the rest of the responsibilities allow users to add, update and delete attachments?


// Source File Name: custom.pll
// Source File path: $AU_TOP/resource

form_name varchar2(30) := name_in('system.current_form');
block_name varchar2(30) := name_in('system.cursor_block');
begin
if (event_name = 'WHEN-NEW-FORM-INSTANCE') then
if (form_name = 'FNDATTCH') then
if (FND_GLOBAL.RESP_NAME Like '') then -- 
Set_item_Property( SEQ_NUM, ENABLED,PROPERTY_FALSE);
Set_item_Property( CATEGORY_DESCRIPTION, ENABLED,PROPERTY_FALSE);
Set_item_Property( DOCUMENT_DESCRIPTION, ENABLED,PROPERTY_FALSE);
Set_item_Property( DATATYPE_NAME, ENABLED,PROPERTY_FALSE);
Set_item_Property( FILE_NAME_DISPLAY, ENABLED,PROPERTY_FALSE);
end if;
end if;
end if;

4. How to make the customisation CustomPO Number not less than PO 4 digits in sales order form?

procedure event(event_name varchar2) is
form_name varchar2(30) := name_in('system.current_form');
block_name varchar2(30) := name_in('system.cursor_block');
item_name varchar2(30) := name_in('system.cursor_item');

Begin
if (form_name = 'OEXOEORD'and block_name = 'ORDER') then
if LENGTH(name_in('ORDER.CUST_PO_NUMBER')) > 3 then
fnd_message.set_name('FND','Cust PO Number should be less than 4 digits');
fnd_message.Error;
RAISE FORM_TRIGGER_FAILURE;
End if;
End if;
End Event;

No comments:

Post a Comment