How To Customize Standard Oracle Application Using Custom Library – custom.pll


There are numerous scenarios for each customer to customize the standard Application. The following sample code demonstrate how to pop up an error message when customer business validation fails.
This note provides a detail steps for customizing the standard application using custom library.

The code attached here will validate number of digits entered in Customer PO Number field from the sales order form. If the number of digits exceeds 3 digits an error message needs to be populated.

  1. Take a back up of custom.pll and custom.plx from $AU_TOP/resource
  2. Have custom.pll, appcore.pll and appcore2.pll copied over to your local folder. The best method is to just copy the entire contents of $AU_TOP/resource
  3. Open CUSTOM.pll in Oracle Forms Developer
  4. Attach appcore2.pll to the custom library
  5. Modify the text of the CUSTOM package body in the appropriate section as below
  6. Save your changes and use the Oracle Forms Compiler program to generate a custom.plx file for the CUSTOM library
  7. Exit from Oracle Forms Developer.
  8. Verify that your file generated successfully. If path name is left blank the file will be generated in c:\orawin\bin (or platform equivalent). Move it to AU_TOP/resource.
  9. Retry it out from the Oracle Applications Navigator.

Sample

Modify the code CUSTOM package body as follows in the appropriate sections

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;

Output

If the customer PO Number in sales order form has less than 4 digits the form will not populate any error message. If the customer po number field has more than for 3 digits the error message will be populated.

Retry it from following steps:

1. Open the Application Navigator 
2. Navigate to Order Management Responsibility 
3. Open the Sales Order Form 
4. Enter the values in Custom PO Number field with 4 digits
5. While navigating to next field the following error message pops up   

Cust PO Number should be less than 4 digits

How To Make All The Responsibilities Read Only For A User


Here is a sample code could be used to make all the responsibilities read only for a specific user. I am sure we can use it in different variations.

1. Open the Custom.pll in the Form Builder.
2.Add the following sample code in the Procedure Event for the event WHEN-NEW-FORM-INSTANCE
3.Compile the Custom.pll and place under the directory $AU_TOP/resource

BEGIN
IF event_name = ‘WHEN-NEW-FORM-INSTANCE’ THEN
IF FND_PROFILE.VALUE(‘USER_NAME’)=’<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;

The above code will make all the Responsibilities read only for a specific user.

It will fundamentally make all the form functions to behave as passing the parameter QUERY_ONLY.

Template Form in Oracle Applications


Template Form in Oracle Apps

This document provides an overview of the template form. This form derives its importance from the fact that this form is the starting point of all development involving forms. The document highlights the importance of Template.fmb in forms development and also provides a detailed explanation of the various components of the Template form.

Overview of the Template Form

The TEMPLATE form is the starting point for all development of new forms. The first step in creating a form for use in Oracle Applications is to copy the template form from $AU_TOP/forms/US, to a local directory and renaming it.

The Template form is unique because it contains some special libraries and triggers that render the application using the template form some standard characteristics. The components of the template form are:

· References to object groups: The template form contains platform–independent references to predefined standard object groups in the APPSTAND form. STANDARD_PC_AND_VA, STANDARD_TOOLBAR, and STANDARD_CALENDAR).

· Libraries: The template form contains platform–independent attachments of several libraries (including FNDSQF, APPCORE, and APPDAYPK).

· Special triggers: The template form contains several form–level triggers with required code. These are responsible for standard the behavior of the form.

· Predefined Program Units: The template form contains predefined program units that include a spec and a body for the package APP_CUSTOM, which contains default behavior for window opening and closing events.

· Applications Color Palette: The template form contains the application color palette. This gives the forms developed using the template form the look and feel of Oracle Applications

· Many referenced objects (from the object groups) that support the Calendar, the toolbar, alternative regions, and the menu. These objects include LOVs, blocks, parameters, and property classes, and so on.

· The TEMPLATE form contains sample objects that can be seen as examples for the expected layout cosmetics. These samples can be completely removed from the form later as they are only examples and are not required. The following objects are the samples and can be removed:

§ Blocks: BLOCKNAME, DETAILBLOCK

§ Window: BLOCKNAME

§ Canvas–view: BLOCKNAME

Hence, the template form comes along with many attachments, predefined program units, and defined visual attributes as well as examples that not only give the forms that are developed using the template.fmb a standard look and feel, but also make t easier to develop forms with consistent and standard functionality.

Libraries in the Template form

As stated above, the template form contains platform–independent attachments of several libraries. These libraries are used while running the form as a part of Oracle Applications. Hence, these libraries should not be changed or modified. There are three main libraries that are attached to the template form:

http://www.exforsys.com/images/OracleApps/t8_files/image002.gif

APPCORE: APPCORE contains the packages and procedures that are responsible for the standard ‘Oracle Applications’ behavior of the forms. The forms have to support the menu, toolbar, and other required standard behaviors in compliance with oracle applications. The Oracle Applications forms also have to display specific runtime behaviors in accordance with the Oracle Applications Interface Standards, such as the way in which fields are enabled, behaviors of specific types of windows etc. APPCORE contains the procedures to support this standard runtime behavior. APPCORE also contains various other utilities for exceptional handling, message levels, and so on.

APPDAYPK: The APPDAYPK library contains the packages that control the Oracle Applications Calendar feature. The calendar (or the date picker) is a utility that oracle apps provide to pick the dates for a date type field.

FNDSQF: FNDSQF contains packages and procedures for Message Dictionary, flexfields, profiles, and concurrent processing. It also has various other utilities for navigation, multicurrency, WHO, etc.

Other Libraries à The template form also contains a few other libraries that are not linked directly to the template form, but are linked to the three libraries listed above. Although, while using the form it makes no difference whether the library is linked directly to template or to another library that is linked to template. These are discussed below.

CUSTOM library: The CUSTOM library (CUSTOM.pll) is probably the most widely used and customized in the libraries attached to the template form. This library allows extension of Oracle Applications forms without modification of Oracle Applications code. Any form goes to the CUSTOM.pll whenever any event fires on the form. Code can be written in the CUSTOM.pll with the logic branching based on the form, block and trigger on which you want it to run.

You can use the CUSTOM library for customizations such as Zoom (such as moving to another form and querying up specific records), enforcing business rules (for example, vendor name must be in uppercase letters), and disabling fields that do not apply for your site.

GLOBE: The GLOBE library allows Oracle Applications developers to incorporate global or regional features into Oracle Applications forms
without modification of the base Oracle Applications form. Oracle Applications sends events to the GLOBE library. Regional code can
take effect based on these events. The GLOBE library calls routines in
the JA, JE, and JL libraries.

VERT: The VERT library allows Oracle Applications developers to incorporate vertical industry features (for automotive, consumer packaged goods, energy, and other industries) into Oracle Applications forms without modification of the base Oracle Applications form. Oracle Applications sends events to the VERT library. Vertical industry code can take effect based on these events. The VERT library calls routines in various other libraries.

JA: The JA library contains code specific to the Asia/Pacific region and is called by the GLOBE library.

JE: The JE library contains code specific to the EMEA (Europe/ MiddleEast/ Africa) region and is called by the GLOBE library.

JL: The JL library contains code specific to the Latin America region and is called by the GLOBE library.

Thanks Shivmohan Purohit