Professional Documents
Culture Documents
There are different kinds of procedures for the different kinds of code
you write: item handlers, event handlers, table handlers, and business
rules. Code resides in these procedures; do not put any code in the
triggers other than calls to the procedures.
Handlers may reside in program units in the form itself, in form
libraries, or in stored packages in the database as appropriate.
Item Handlers
An item handler is a PL/SQL procedure that encapsulates all of the
code that acts upon an item. Most of the validation, defaulting, and
behavior logic for an item is typically in an item handler.
Event Handlers
An event handler is a PL/SQL procedure that encapsulates all of the
code that acts upon an event. Usually event handlers exist to satisfy
requirements of either Oracle Forms or the Oracle Applications User
Interface Standards for Forms–Based Products, as opposed to particular
business requirements for a product.
Table Handlers
A table handler encapsulates all of the code that manages interactions
between a block and its base table. When an updatable block is based
on a view, you must supply procedures to manage the insert, update,
lock and delete. Referential integrity checks often require additional
procedures. Table handlers may reside on either the forms server or
the database, depending on their size and the amount of interaction
with the database, but they typically reside in the database.
Business Rules
A business rule describes complex data behavior. For example, one
business rule is: ”A discount cannot be greater than 10% if the current
credit rating of the buyer is less than ’Good’.” Another business rule is:
”A Need–By Date is required if a requisition is made for an inventory
item.”
A business rule procedure encapsulates all of the code to implement
one business rule when the business rule is complex or affects more
than one item or event. The business rule procedure is then called by
the item or event handlers that are involved in the business rule. If the
business rule is simple and affects only one item or event, implement
the business rule directly in the item or event handler.
Libraries
Libraries contain reusable client–side code. They support these form
coding standards by allowing the same code to be used by all forms to
enforce specific validation, navigation and cosmetic behaviors and
appearances.
Application–Specific Libraries
Each application is strongly encouraged to create its own libraries.
Typically, each application creates a central library that governs
behaviors of objects found throughout many of its forms.
Attaching Libraries
If you
attach a library to a form in the Oracle Forms Developer
type in just the filename, in uppercase only, with no file
extension (for example, CUSTOM).
Note that your attachment
should never include a directory path; your FORMS60_PATH should
include the directory that holds all your libraries.
While you can develop forms using the standard Oracle Forms
Developer, you cannot run your Oracle Applications–based forms from
the Oracle Forms Developer.
Sharing objects:
APPSTAND Form
The APPSTAND form contains the master copy of the shared objects.
It contains the following:
Object group STANDARD_PC_AND_VA, which contains the
Visual Attributes and Property Classes required to implement
much of the user interface described in the Oracle Applications
User Interface Standards for Forms–Based Products. A property
class exists for almost every item and situation needed for
development.
TEMPLATE Form
The TEMPLATE form is the required starting point for all development
of new forms. It includes references to many APPSTAND objects,
several attached libraries, required triggers, and other objects.
Start developing each new form by copying this file, located in
$AU_TOP/forms/US (or your language and platform equivalent), to a
local directory and renaming it as appropriate. Be sure to rename the
filename, the internal module name, and the name listed in the call to
FND_STANDARD.FORM_INFO found in the form–level PRE–FORM
trigger.
FNDMENU
The Oracle Applications default menu (with menu entries common to
all forms, such as File, Edit, View, Help, and so on) is contained in the
$AU_TOP/resource/US directory (or its equivalent) as the file
FNDMENU. You should never modify this file, nor should you create
your own menu for your forms.
Standard Libraries
Application Object Library contains several libraries that support the
Oracle Applications User Interface Standards for Forms–Based Products:
FNDSQF contains packages and procedures for Message
Dictionary, flexfields, profiles, and concurrent processing. It also
has various other utilities for navigation, multicurrency, WHO,
etc.
APPCORE and APPCORE2 contain the packages and procedures
that are required of all forms to support the menu, Toolbar, and
other required standard behaviors. APPCORE2 is a
near–duplicate of APPCORE intended for use with the CUSTOM
library.
APPDAYPK contains the packages that control the Applications
Calendar.
APPFLDR contains all of the packages that enable folder blocks.
ROW_ID. Your view should then include all of the columns in the root
table, including the WHO columns, and denormalized foreign key
information.
Suggestion: You only need to include the ROWID column if
an Oracle Forms block is based on this view. The Oracle Forms
field corresponding to the ROW_ID pseudo–column should
use the ROW_ID property class.
PL/SQL Procedures
Definition:
Server–side
Server–side is a term used to describe PL/SQL procedures that are
stored in an Oracle database (on the database server). Procedures and
functions stored in the database are also referred to as stored
procedures and functions, and may also be referred to as being
database server–side procedures.
Client–side
Client–side is a term used to describe PL/SQL procedures that run in
programs that are clients of the Oracle database, such as Oracle Forms,
Oracle Reports, and libraries.
The term ”client–side” in this manual usually refers to the forms server
(where the forms reside). ”Client–side” in this manual does not
typically refer to the ”desktop client”, which is usually a PC or other
desktop machine running a Web browser.
General PL/SQL Coding Standards
Always Use Packages
PL/SQL procedures should always be defined within packages. Create
a package for each block of a form, or other logical grouping of code.
Package Sizes
A client–side (Oracle Forms) PL/SQL program unit’s source code and
compiled code together must be less than 64K. (A program unit is a
package specification or body or stand–alone procedure.) This implies
that the source code for a program unit cannot exceed 10K.
When an Oracle Forms PL/SQL procedure exceeds the 64K limit,
Oracle Forms raises an error at generate time.
Server–side packages and procedures do not have a size limit, but
when Oracle Forms refers to a server–side package or procedure, it
creates a local stub, which does have a size limit. The size of a package
stub depends on the number of procedures in the package and the
number and types of arguments each procedure has. Keep the number
of procedures in a package less than 25 to avoid exceeding the 10K
limit.
Using DEFAULT
Use DEFAULT instead of ”:=” when declaring default values for your
parameters. DEFAULT is more precise because you are defaulting the
values; the calling procedure can override the values.
Conversely, use ”:=” instead of DEFAULT when declaring values for
your constant variables. Using ”:=” is more precise because you are
assigning the values, not defaulting them; the values cannot be
overridden.
Global Variables
Oracle Forms and PL/SQL support many different types of global
variables. The following table lists the characteristics of each, which
enables you to select the type most appropriate for your code.
Definitions:
Oracle Forms Global: a variable in the ”global” pseudo–block of
a form
PL/SQL Package Global: a global defined in the specification of
a package
Exception Handling
Errors in Oracle Forms PL/SQL
If a failure occurs in Oracle Forms PL/SQL and you want to stop
further processing, use FND_MESSAGE to display an error message,
then RAISE FORM_TRIGGER_FAILURE to stop processing:
IF (error_condition) THEN
fnd_message.set_name(appl_short_name,
message_name);
fnd_message.error;
RAISE FORM_TRIGGER_FAILURE;
END IF;
Note that RAISE FORM_TRIGGER_FAILURE causes processing to stop
quietly. Since there is no error notification, you must display any
messages yourself using FND_MESSAGE before raising the exception.
Avoid RAISE_APPLICATION_ERROR
Do not use RAISE_APPLICATION_ERROR. It conflicts with the
scheme used to process server side exceptions.
Exit_form
Oracle Forms Built–In With APPCORE Replacements
These Oracle Forms built–ins have equivalent APPCORE routines that
provide additional functionality:
The Oracle Applications forms have special exit
processing. Do not call EXIT_FORM directly;
always call do_key(’EXIT_FORM’).
SET_ITEM_PROPERTY:
Replace with APP_ITEM_PROPERTY.SET_
PROPERTY and APP_ITEM_PROPERTY.SET_
VISUAL_ATTRIBUTE. These APPCORE routines
set the properties in the Oracle Applications
standard way and change the propagation
behavior. Some properties use the native Oracle
Forms SET_ITEM_PROPERTY. For a complete list
of properties that APP_ITEM_PROPERTY.SET_
PROPERTY covers, see the documentation for that
routine.
GET_ITEM_PROPERTY:
Use APP_ITEM_PROPERTY.GET_PROPERTY
when getting Oracle Applications specific
properties. Use the Oracle Forms built–in when setting or getting other properties.
OPEN_FORM :
Use FND_FUNCTION.EXECUTE. This routine is
necessary for function security.
Both OPEN_FORM and FND_FUNCTION.EXECUTE cause the POST–RECORD
and POST–BLOCK triggers to fire.
CLEAR_FORM
Use do_key(’clear_form’). This routine raises
the exception FORM_TRIGGER_FAILURE if there
is an invalid record.
You may use this built–in without ”do_key” to
avoid the additional functionality that comes from
going through the trigger.
COMMIT
Use do_key(’commit_form’). This routine
raises the exception FORM_TRIGGER_FAILURE if
there is an invalid record.
You may use this built–in without ”do_key” to
avoid the additional functionality that comes from
going through the trigger.
VALIDATE
Use APP_STANDARD.APP_VALIDATE instead.
This routine navigates to any item that causes
navigation failure.
Warning: Change the block Key Mode from the default value
”Unique Key” to ”Non–Updatable Key” when the block is
based on a multi–table view. Specify your primary key items
by setting ”Primary Key” to True in the items’ property sheets.
Modules
Module properties establish an overall framework for the look and feel
of each form.
Property Class
The TEMPLATE form automatically applies the MODULE property
class to the module. The settings of this class vary on each GUI
platform.
Warning: Do not change any values set by the MODULE
property class.
Module Names
Make sure that in each of your forms, the Module Name matches the
file name. For example, if a form is called POXPOMPO.fmb, make sure
the Module Name (visible in Oracle Forms Developer) is POXPOMPO.
Windows
From the APPSTAND form, windows automatically inherit the proper
look and feel of the GUI platform on which they are running, such as
characteristics of the frame, title bar fonts, and window manager
buttons. This section describes features common to all Oracle
Applications windows, as well as behaviors for modal and non–modal
windows.
Do not use the ROOT_WINDOW,
because it interferes with the proper functioning of the toolbar and
other standard Oracle Applications objects.
Non–Modal Windows
A non–modal window (a ”regular window”) allows the user to interact
with any other window, as well as the toolbar and the menu.
Non–modal windows are used for the display of most application
entities.
Property Class
Apply the WINDOW property class to all non–modal windows.
Primary Canvas
Always enter the name of the content canvas associated with the
window.
Closing
You must explicitly code the closing behavior for your windows to
ensure that windows do not close while in Enter Query mode, closing
the first window of a form closes the entire form, and other standard
behaviors. You code the closing behavior in the
APP_CUSTOM.CLOSE_WINDOW procedure.
Window Opening
If you have logic that must occur when a window opens, place the logic
in APP_CUSTOM.OPEN_WINDOW. You must add logic to control
block coordination and to position windows.
Canvases
describes the settings for content and stacked canvases.
Window
Always enter the name of the window the canvas is shown in.
Content Canvases
Property Class
You should apply the CANVAS property class to all content canvases.
Size (Width, Height)
You should size the content canvas the same as the window it is shown
in.
Stacked Canvases
One or more stacked canvases may be rendered in front of the content
canvas of a particular window. If needed, a stacked canvas may fully
occupy a window.
See ”Alternative Regions” for a full description of stacked canvas
behavior with regions.
Property Class
Stacked canvases should use the CANVAS_STACKED property class to
enforce the correct behavior.
Display Characteristics
Stacked canvases should adhere to these display characteristics:
Only the one stacked canvas that is to be shown when its
window is first opened should be set to Visible.
Stacked canvases always have Raise on Entry set to Yes.
Canvases stacked on top of each other (as in alternative regions)
should all be the same size.
The content canvas should be blank in the area that would be covered
by the stacked canvases.
Blocks
This section discusses the general settings for all blocks, as well as how
to set up blocks for the following situations:
Context Blocks
Dialog Blocks
Blocks With No Base Table
Multi–Record Blocks
Single–Record Blocks
Combination Blocks
Master–Detail Relations
Dynamic WHERE Clauses
Property Class
Use the BLOCK property class for all non–modal blocks; use
BLOCK_DIALOG for blocks displayed within modal windows.
Never override the Visual Attribute Group property of this class; it
varies on each platform.
Key–Mode
If the block is based on a table or a single–table view, set Key–Mode to
Unique. If the block is based on a join view, set Update Allowed to No.
Ensure that at least one item in the block is marked as a primary key
(set Primary Key at the item level to Yes for each item that makes up
the primary key of the data block).
Context Blocks
Context blocks are shown in detail windows to provide context, and
replicate fields that are shown in master windows. To create a context
block, make display items that are part of the same block as the master
and synchronize the context field with the master field.
Dialog Blocks
Dialog blocks are the blocks presented in modal windows. They
require the user to interact with them before proceeding to other
windows of the application.
Multi–Record Blocks
Multi–record blocks allow the user to see as many records of an entity
as possible, usually at the tradeoff of seeing fewer attributes of each
record simultaneously.
Navigation Style
Set the Navigation Style to Change Record for all multi–record blocks.
Current Record Indicator
If the block does not have any detail blocks (and therefore does not
support drilldown), create a current record indicator for the block as
follows: Create a text item in the multi–record block. Give the text
item the name ”CURRENT_RECORD_INDICATOR” and apply the
property class ”CURRENT_RECORD_INDICATOR”.
Single–clicking on the indicator moves the cursor to the first navigable
field of the appropriate record. Do this by creating an item–level
WHEN–NEW–ITEM–INSTANCE trigger (Execution Hierarchy:
Override) on the record indicator item, and issue a GO_ITEM to the
first field of the block. For example:
GO_ITEM(’lines.order_line_num’);
Combination Blocks
Combination blocks are hybrid formats, where fields are presented in
both multi–record (Summary) and single–record (Detail) formats. The
Summary and Detail formats are each presented in their own window,
but all of the fields of both formats are part of a single block.
Master–Detail Relations
Prevent Masterless Operations
A user cannot enter or query detail records except in the context of a
master record. Always set the Coordination property to Prevent
Masterless Operation.
Regions
Regions are groups of fields. Most regions are purely cosmetic, where a
frame (box) surrounds a group of related fields or a frame (line)
appears above a group of related fields. In these cases, there is no code
impact other than making sure that once the cursor is in a region, the
block tabbing order goes through all the items in one region before
proceeding to other regions or fields in the block.
Tabbed Regions
Some regions, called tabbed regions, appear only at selected times and
are displayed on tab canvases.