The Template Form

Overview of the TEMPLATE Form

The TEMPLATE form is the required starting point for all development of new forms. Start developing each new form by copying the TEMPLATE.fmb file, located in $AU_TOP/forms/US (or your language and platform equivalent), to a local directory and renaming it as appropriate.

TEMPLATE contains the following:

Libraries in the TEMPLATE Form

The TEMPLATE form includes platform-independent attachments of several libraries. Some of these libraries are attached "directly" to the TEMPLATE (FNDSQF, APPCORE, and APPDAYPK), while the others are attached to these three libraries. However, in Oracle Forms, the different types of attachments are indistinguishable. If more libraries are later attached to any of these libraries, the additional libraries will also appear to be attached directly to TEMPLATE.

The following libraries are all attached to TEMPLATE. You may also see additional libraries, particularly if your site uses Oracle E-Business Suite in multiple countries or if your site uses Oracle Industry Applications.

Warning: You should not modify any Oracle E-Business Suite libraries other than the CUSTOM library, or you could seriously damage your Oracle E-Business Suite products.

APPCORE

APPCORE contains the packages and procedures that are required of all forms to support the menu, Toolbar, and other required standard behaviors. Additionally it contains packages that should be called to achieve specific runtime behaviors in accordance with the Oracle E-Business Suite User Interface Standards for Forms-Based Products, such as the way in which fields are enabled, behaviors of specific types of windows, and the dynamic 'Special' menu. Finally, it contains various other utilities for exception handling, message levels, and so on. Some APPCORE event routines call routines in the VERT, GLOBE, and CUSTOM libraries (in that order).

Procedures and functions in APPCORE typically have names beginning with "APP".

See: APPCORE Routine APIs

APPDAYPK

APPDAYPK contains the packages that control the Oracle E-Business Suite Calendar feature.

See: The Calendar

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.

Procedures and functions in FNDSQF typically have names beginning with "FND".

CUSTOM

The CUSTOM library allows extension of Oracle E-Business Suite forms without modification of Oracle E-Business Suite code. 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.

You write code in the CUSTOM library, within the procedure shells that are provided. All logic must branch based on the form and block for which you want it to run. Oracle E-Business Suite sends events to the CUSTOM library. Your custom code can take effect based on these events.

See: Using the CUSTOM Library

GLOBE

The GLOBE library allows Oracle E-Business Suite developers to incorporate global or regional features into Oracle E-Business Suite forms without modification of the base Oracle E-Business Suite form. Oracle E-Business Suite 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 E-Business Suite developers to incorporate vertical industry features (for automotive, consumer packaged goods, energy, and other industries) into Oracle E-Business Suite forms without modification of the base Oracle E-Business Suite form. Oracle E-Business Suite 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/Middle East/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.

Special Triggers in the TEMPLATE form

The TEMPLATE form contains several form-level triggers that must exist in order for other routines to operate properly. Specific rules about modifications you can safely make to these triggers are discussed below.

Important: Under no circumstances may any of these triggers be deleted.

The text within these triggers must remain within the trigger; however, frequently developers need to add text before or after this text. These triggers are listed below.

Warning: You must not change triggers that are referenced into the form, even though it is technically possible in Oracle Forms Developer. Changing referenced triggers may cause problems in your form or may cause problems for future upgrades.

Standard Forms Triggers

User-Named Triggers:

Triggers That Often Require Some Modification

ACCEPT

APP_STANDARD.EVENT('ACCEPT');

This trigger processes invocation of the "Action, Save and Proceed" menu choice or toolbar button. It saves and moves to the next record of the block specified as the First Navigation Block.

Replace the code in this trigger, or create block-level triggers with execution style 'Override'.

See: Save and Proceed

FOLDER_RETURN_ACTION

null;

This trigger allows customization of specific folder events.

Replace text with specific code needed to process folder actions.

Warning: Oracle does not support modifications to this trigger except for Oracle E-Business Suite internal use.

KEY-DUPREC

APP_STANDARD.EVENT('KEY-DUPREC');

This trigger disables the default duplicate record functionality of Oracle Forms.

To process the "Edit, Duplicate Record Above" menu choice properly, code a block-level KEY-DUPREC with execution style 'Override'. This trigger should perform a duplicate_record, then validate or clear fields as needed.

See: Duplicating Records

KEY-CLRFRM

APP_STANDARD.EVENT('KEY-CLRFRM');

This trigger validates the record before attempting to clear the form.

Add any additional code after the supplied text. Typically you would add GO_BLOCK calls if you have alternative regions in your form, where the GO_BLOCK calls repopulate your region control poplist after a Clear Form operation.

KEY-MENU

APP_STANDARD.EVENT('KEY-MENU');

This trigger disables the Block Menu command of Oracle Forms.

To enable operation of Alternative Regions via the keyboard from a specific block, code a block-level KEY-MENU with execution style 'Override'. This trigger should open an LOV with the same choices as the Alternative Region control poplist.

See: Alternative Regions

KEY-LISTVAL

APP_STANDARD.EVENT('KEY-LISTVAL');   

This trigger performs flexfield operations or LOV invocation.

Create block- or item-level triggers with execution style 'Override' on fields using the Calendar, or fields that dynamically invoke flexfields.

See: The Calendar

ON-ERROR

APP_STANDARD.EVENT('ON-ERROR');  

This trigger processes all errors, server or client side, using Message Dictionary calls.

To trap specific errors, check for your specific errors before the APP_STANDARD call.

declare
           original_mess      varchar2(80);
        begin
    IF MESSAGE_CODE = <your message number> THEN
              original_mess := MESSAGE_TYPE||'-'||
                 to_char(MESSAGE_CODE)||': '||MESSAGE_TEXT; 
     --- your code handling the error goes here
             message(original_mess);
           ELSE
              APP_STANDARD.EVENT('ON_ERROR');
           END IF
        end;  

See: Overview of Message Dictionary

APP_EXCEPTION: Exception Processing APIs

POST-FORM

APP_STANDARD.EVENT('POST-FORM');  

This trigger is reserved for future use.

Add any additional code before the supplied text.

PRE-FORM

FND_STANDARD.FORM_INFO('$Revision: <Number>$', 
                   '<Form Name>', 
                   '<Application Shortname>', 
                   '$Date: <YY/MM/DD HH24:MI:SS> $',
                   '$Author: <developer name> $');
APP_STANDARD.EVENT('PRE-FORM');  
APP_WINDOW.SET_WINDOW_POSITION('BLOCKNAME',
                   'FIRST_WINDOW');

This trigger initializes internal Oracle E-Business Suite values and the menu. The values you enter here are shown when you choose "Help, About Oracle Applications" from the Oracle E-Business Suite menu.

You must modify the application short name. The application short name controls which application's online help file is accessed when the user presses the window help button on the toolbar. If you leave the application short name as FND, your user will not see any help because Oracle E-Business Suite will not be able to construct a valid help target.

The form name is the user form name (form title). This is for your reference only, and is not used elsewhere.

Oracle uses a source control system that automatically updates the values beginning with "$". If you are not using that source control system, you can and should modify those values with your own development information.

You must also modify the APP_WINDOW call to use your own block name (of your first block) instead of BLOCKNAME. Do not modify the string FIRST_WINDOW.

See: Controlling Window Behavior

QUERY_FIND

APP_STANDARD.EVENT('QUERY_FIND');  

This trigger issues a default message stating that Query Find is not available.

Replace the code in this trigger, or create block-level triggers with execution style 'Override' when you create a Find window or Row-LOV in your form.

See: Query Find Windows

WHEN-NEW-FORM-INSTANCE

FDRCSID('$Header: ... $');
APP_STANDARD.EVENT('WHEN-NEW-FORM-INSTANCE');

-- app_folder.define_folder_block('template test',
    'folder_block', 'prompt_block', 'stacked_canvas',
    'window', 'disabled functions');
-- app_folder.event('VERIFY');

The APP_STANDARD.EVENT call in this trigger supports the query-only mode invoked by FND_FUNCTION.EXECUTE. The FDRCSID call supports the Oracle E-Business Suite source control system. The APP_FOLDER calls are for Oracle E-Business Suite internal use only. Custom forms do not require either the FDRCSID or the APP_FOLDER calls, but it does no harm to leave them in the trigger.

Add any additional code before the supplied text.

Warning: Oracle does not support modifications to the APP_FOLDER calls in this trigger except for Oracle E-Business Suite internal use.

WHEN-NEW-RECORD-INSTANCE

APP_STANDARD.EVENT('WHEN-NEW-RECORD-INSTANCE');  

This trigger manages the state of the Oracle E-Business Suite menu and toolbar.

Create block-level triggers as needed, with execution style 'Before'.

See: Synchronizing

WHEN-NEW-BLOCK-INSTANCE

APP_STANDARD.EVENT('WHEN-NEW-BLOCK-INSTANCE');

This trigger manages the state of the Oracle E-Business Suite menu and toolbar.

Create block-level triggers as needed, with execution style 'Before'.

See: Synchronizing

WHEN-NEW-ITEM-INSTANCE

APP_STANDARD.EVENT('WHEN-NEW-ITEM-INSTANCE');

This trigger manages the state of the Oracle E-Business Suite menu and toolbar.

If you add a flexfields routine call, you should add it before the APP_STANDARD.EVENT call. In general, you should not add any other code to this trigger, as such code would affect every item in the form and could hurt your form performance.

Create block-or item-level triggers as needed, with execution style 'Before'.

See: Synchronizing

Triggers That Cannot Be Modified

Oracle E-Business Suite does not support the modification of these form-level triggers in any way.

CLOSE_THIS_WINDOW

This trigger invokes APP_CUSTOM.CLOSE_WINDOW from the menu Action->Close Window.

CLOSE_WINDOW

APP_CUSTOM.CLOSE_WINDOW(:SYSTEM.EVENT_WINDOW);

This trigger processes all window close events. Code that processes the close window events must reside in the APP_CUSTOM.CLOSE_WINDOW package.

See: Controlling Window Behavior

EXPORT

app_standard.event('EXPORT');

This trigger processes invocation of the "Action, Export" menu choice.

FOLDER_ACTION

app_folder.event(:global.folder_action);

This trigger processes invocation of entries on the Folder menu.

KEY-COMMIT

APP_STANDARD.EVENT('KEY-COMMIT');

This trigger processes commits in normal or called forms.

Warning: Oracle strongly recommends against the use of called forms. This procedure supports them for backward compatibility only.

KEY-EDIT

APP_STANDARD.EVENT('KEY-EDIT');

This trigger performs flexfield operations, or Calendar or Editor invocation.

KEY-EXIT

APP_STANDARD.EVENT('KEY-EXIT');

This trigger processes Close events, and leaves enter-query mode.

KEY-HELP

APP_STANDARD.EVENT('KEY-HELP');

This trigger invokes the Window Help system.

LASTRECORD

APP_STANDARD.EVENT('LASTRECORD');

This trigger processes the menu event Go->Last Record.

MENU_TO_APPCORE

APP_STANDARD.EVENT(:global.menu_to_appcore);

This trigger supports the Special menu.

STANDARD_ATTACHMENTS

atchmt_api.invoke;

This trigger processes invocation of the Attachments menu entry or toolbar button.

WHEN-WINDOW-CLOSED

execute_trigger('CLOSE_WINDOW');

This trigger centralizes window close events from the Oracle E-Business Suite or Window Manager menu.

WHEN-FORM-NAVIGATE

You cannot modify this referenced trigger. It enables certain standard behaviors, such as normalizing a minimized form when it is navigated to.

To make use of this form event, populate a global variable called GLOBAL.WHEN_FORM_NAVIGATE with the name of a user-named trigger. Usually you populate this global immediately before issuing a GO_FORM.

See: Passing Instructions to a Form

ZOOM

appcore_custom.event('ZOOM');

This trigger processes invocation of the "Action, Zoom" menu choice or toolbar button.