Customizing Oracle Applications 11i Using Custom - PLL Varun Tekriwal
Customizing Oracle Applications 11i Using Custom - PLL Varun Tekriwal
Using
Custom.pll
Varun Tekriwal
TCS Internal
© Oracle Applications Center of Excellence, Mumbai
Why
Why We
We Have
Have The
The CUSTOM
CUSTOM Library
Library
In the past when organizations wanted to create or replace internal business application
packages, their options were primarily:
Buy an ‘off-the-shelf’ application and hope that it meets most of the needs of the
organization
These options have usually been considered mutually exclusive, and both have their own
relative advantages and disadvantages. Off-the-shelf applications are ideal if the all of
the companies requirements can be satisfied. On the other hand, custom-built
applications give you everything that you wanted but at the cost of internal ownership of
the application, which includes not just the code, but the support and maintenance of the
custom application over time.
TCS Internal
© Oracle Applications Center of Excellence, Mumbai
The CUSTOM library is a facility that enables you to augment and extend the Oracle
Applications without modification of Oracle Applications code.
The CUSTOM library can be used for defining ‘zooms’ (a mechanism to ‘jump’ to forms
from other forms ) and for enforcing business rules.
TCS Internal
© Oracle Applications Center of Excellence, Mumbai
How
How the
the CUSTOM
CUSTOM Library
Library Works
Works
The CUSTOM library works by sending ‘events’ from each Oracle
Applications form to the CUSTOM library, which is automatically
attached at runtime. User defined custom code, which is in the
CUSTOM library, can then take effect based on these events.
TCS Internal
© Oracle Applications Center of Excellence, Mumbai
Events
CUSTOM
Library *.fmx
Your Custom Library
WHEN-NEW-FORM-INSTANCE
WHEN-VALIDATE-RECORD
The CUSTOM library is actually a pair of files called CUSTOM.pll and CUSTOM.plx.
The ‘.plx’ extension is a compiled version of the ‘.pll’ file.
In Release 11i, these files reside in the $AU_TOP/resource directory. The CUSTOM
library you modify must replace the default CUSTOM library in this directory in order for
your code to take effect. Be aware that if both the ‘.pll’ and ‘.plx’ versions of the file exist
in the same directory then Oracle Forms will use the ‘.plx’ version of the file. A ‘.plx’ is
only created when you generate a library using the Oracle Forms generator (using the
parameter COMPILE_ALL set to Yes), not when you compile and save using the Oracle
Forms Designer.
TCS Internal
© Oracle Applications Center of Excellence, Mumbai
Some
Some Custom
Custom Library
Library Rules
Rules
Since there is only a single library that is shared by all forms in your installation, be careful
about what code you put in the library. All restrictions and limitations that exist in any
standard Forms library also apply to the CUSTOM library.
In addition, these rules apply:
You cannot use SQL in the CUSTOM library (call server side packages instead, or use a
record group to issue the SQL for you)
You cannot change the specification of the CUSTOM package
You cannot attach the APPCORE library to the CUSTOM library (because CUSTOM is
attached to APPCORE), and you cannot call APPCORE routines (which usually start with
“APP”). For example, function APP_ITEM_PROPERTY is not available within the CUSTOM
library. You should use Oracle Forms SET_ITEM_PROPERTY instead.
•Use FNDSQF library for function security, flexfields and message procedures.
TCS Internal
© Oracle Applications Center of Excellence, Mumbai
CUSTOM.pll
CUSTOM.pll and
and APPCORE
APPCORE Library
Library
Attached at Runtime
APPCORE
Library *.fmx
CUSTOM
Library
The CUSTOM library can be switched on and off dynamically by the user by selecting
the Help->Tools->Custom Code->Off option from the menu bar.
You can prevent users from being able to switch off the CUSTOM library by setting the
profile ‘Diagnostics’ to ‘No’(this profile also controls access to most of the other
functions on the ‘Tools’ menu).
TCS Internal
© Oracle Applications Center of Excellence, Mumbai
When
When to
to Use
Use the
the CUSTOM
CUSTOM Library
Library
There are four main ways to use the CUSTOM library. Each of these must be coded
differently.
Zoom: A Zoom opens another form and can pass parameters to the opened form.
Logic for generic events: Augment Oracle Applications logic for certain generic form
events such as WHEN–NEW–FORM–INSTANCE or WHEN–VALIDATE–RECORD.
Logic for product-specific events: Augment or replace Oracle Applications logic for
certain product–specific events that enforce business rules.
Custom entries for the Special menu: Add entries to the Special menu for Oracle
Applications forms, such as an entry that opens a custom form.
TCS Internal
© Oracle Applications Center of Excellence, Mumbai
Some
Some Customizations
Customizations done:
done:
1. Displaying a message when the Users screen is opened in Oracle
Apps.
--------RESPONSIBILITY SECURITY CUSTOMIZATION - OWNER --
@MED COE ALL----------------------------------------------
If ( form_name = 'FNDSCAUS' and event_name = 'WHEN-NEW-
FORM-INSTANCE') then
fnd_message.set_string('GEMS Oracle CoE - All new users
have to be created with their SSO ID as their username');
fnd_message.show;
end if;
TCS Internal
© Oracle Applications Center of Excellence, Mumbai
For example, let’s say that your company insists that vendor
names always be entered in uppercase. The CUSTOM library
allows you to add code to do this without altering any Oracle
source code:
TCS Internal
© Oracle Applications Center of Excellence, Mumbai
Advanced
Advanced Custom
Custom Coding
Coding
Notice that not all Oracle Forms events are sent to the CUSTOM library
(such as WHEN-CHECKBOX-CHANGED, and many others).
This means that you must always make sure that your custom code can be set into motion by
one of the supported triggering events mentioned above.
But what if the triggering event needed for your requirements is not on the official list?
Or you must add a bunch of custom code to a form? The CUSTOM library can (and
should) still be used when base code simply has to be changed, as it puts the majority of
your customizations into the CUSTOM library and minimizes code changes that must be
re-applied when the base form is patched or upgraded.
TCS Internal
© Oracle Applications Center of Excellence, Mumbai
A Company had a problem with Receivables users doing blind queries on the Account
Details screen, which would initiate a full table scan of a 6 million row table (which was
further joined to 8 other tables…).
You don’t have to be a DBA to understand that this brought the database to its knees even
if only a few users did it simultaneously. This company wanted to ensure that any queries
done against the Account Details screen always included some sort of search criteria, so
the result set would be smaller and so that indexes would be used by the optimizer for
fastest performance. The event that had to be caught in order to accomplish this was the
WHEN-BUTTON-PRESSED event from the Find window.
The CUSTOM library was the perfect repository for the required code, but the form
definition had to be altered to pass a customer-defined event ‘CUSTOM_FIND’ to the
CUSTOM library. The code is ahead.
TCS Internal
© Oracle Applications Center of Excellence, Mumbai
PROCEDURE event(event_name VARCHAR2) IS
query_fields VARCHAR2(100);
BEGIN
-- Normally the CUSTOM library doesn’t get the WHEN-BUTTON-PRESSED event. We modified the
-- AR Account Details Find screen's "FIND" button to pass this event. See C:\apps10\au10\res\plsql\ARXCOQIT.PLL,
-- in the ARXCOQIT_FIND procedure, which is executed when the FIND button is pressed on that screen.
-- We added a call to custom.event(‘CUSTOM_FIND’)
IF (event_name = 'CUSTOM_FIND') THEN
-- Has the user entered criteria into any fields?
query_fields := NAME_IN('CQIT_FIND.trx_number')||
NAME_IN('CQIT_FIND.name')||
NAME_IN('CQIT_FIND.number')||
NAME_IN('CQIT_FIND.sales_order')||
NAME_IN('CQIT_FIND.purchase_order');
-- If not, then inform user of error
IF query_fields IS NULL THEN
fnd_message.set_string('To avoid serious performance degradation, you must supply at least one criteria before querying.');
fnd_message.error;
-- Disable query
COPY( 'FALSE' ,'parameter.g_query_find' );
END IF;
END IF;
END event;
TCS Internal
© Oracle Applications Center of Excellence, Mumbai
Some
Some more
more Customizations
Customizations
Change LOV values
Remove unwanted tab pages
Change a default where clause
Conclusion
Conclusion
The CUSTOM library provides a non-invasive mechanism that allows customers to
extend the application in a manageable and controlled environment while preserving
support for the core application. The ability to turn CUSTOM library code on or off
ensures application support even when problems are encountered because it enables
you
to identify whether the problem is custom code related or core application related.
TCS Internal
© Oracle Applications Center of Excellence, Mumbai
Thank You
TCS Internal
© Oracle Applications Center of Excellence, Mumbai