13. Create Package for Each Block with Procedures for Each Item for the Triggers
passing TRIGGER_NAME as parameter.
14. For FORM_LEVEL triggers Create Package as the Form name and Procedure as
<FORM_NAME>_PROC.
15. For BLOCK_LEVEL triggers Create Package as the Form name and Procedure as
<BLOCK_NAME>_PROC.
16. GENERATE THE SEQUENCE NO. in the PRE-INSERT trigger where ID
applicable.
17. Set the FND_STANDARD.SET_WHO in the PRE-INSERT and PRE-UPDATE
trigger as applicable.
18. Apply the CREATION_OR_LAST_UPDATE_DATE property class to
the form fields CREATION_DATE and LAST_UPDATE_DATE.
19. For blocks that are based on a table, but do not have Record History
information, disable the menu entry HELP–>ABOUT_THIS_RECORD
Code a block–level WHEN–NEW–BLOCK–INSTANCE trigger (style
”Override”) with these lines:
app_standard.event(’WHEN–NEW–BLOCK–INSTANCE’);
app_special.enable(’ABOUT’, PROPERTY_OFF);
20. When basing a block on a view, you must code ON–INSERT, ON–UPDATE,
ON–DELETE, and ON–LOCK triggers to insert, update,delete, and lock the root
table instead of the view.
21. Single table views do not require triggers for inserting, updating, deleting and
locking. Set the block Key Mode to Unique.
22. 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. Single table views do not require
a ROW_ID column.
23. Use each sequence to supply unique ID values for one column of one table.
APPS form Development Guide: Page 3 Prepared By: Sridhar Vishwanath
• Within a package, define private variables first, then private procedures, and
finally public procedures.
• Always end procedures and packages by following the ”end” statement with the
procedure or package name to help delineate procedures.
• Indent code logically. Using increments of two spaces provides an easy way to
track your nested cases.
• Use uppercase and lowercase to improve the readability of your code (PL/SQL
is case–insensitive). As a guideline, use uppercase for reserved words and
owercase for everything else.
24. Use FND_MESSAGE to display an error message,then
RAISE FORM_TRIGGER_FAILURE to stop processing: (In FORMS)
IF (error_condition) THEN
fnd_message.set_name(appl_short_name,message_name);
fnd_message.error;
RAISE FORM_TRIGGER_FAILURE;
END IF;
If a failure occurs in a stored procedure and you want to stop further processing,
use the package procedures FND_MESSAGE.SET_NAME to set a message, and
APP_EXCEPTION.RAISE_EXCEPTION to stop processing:
IF (error_condition) THEN
fnd_message.set_name(appl_short_name,
message_name);
APP_EXCEPTION.RAISE_EXCEPTION;
END IF;
25. Explicitly hide a canvas that does not appear on the screen.
26. If there is any additional logic which has been added to the KEY– trigger that you
want to take advantage of, you can invoke the trigger by using the DO_KEY built–in.
27. Use FND_FUNCTION.EXECUTE instead of either CALL_FORM or
OPEN_FORM whenever you need to open a form programmatically.
Using FND_FUNCTION.EXECUTE allows you to open forms without bypassing
Oracle Applications security, and takes care of finding the correct directory path for
the form .
28. Oracle Forms Built–In With APPCORE Replacements
EXIT_FORM -- The Oracle Applications forms have special exit
processing. Do not call EXIT_FORM directly;always call do_key(’EXIT_FORM’).
OPEN_FORM : FND_FUNCTION.EXECUTE
CLEAR_FORM ,COMMIT : do_key(’clear_form’) , do_key(’commit_form’)
EDIT_FIELD/EDIT_TEXTITEM : do_key(’edit_field’)
VALIDATE : APP_STANDARD.APP_VALIDATE
DATE_FIELDS: Date fields that the user enters should use the Calendar.
• For date fields, use the DATE data type unless the user needs to enter time.
• Use the DATETIME data type to require the user to enter time.
• To default a form field to the current date without the time, use $$DBDATE$$.
To default a form field to the current date and time, use $DBDATETIME$$.
• Create date fields as 11 characters without time, or 20 characters with
time. You do not need to specify a format mask in the item.
• In general, validate your date fields at the record level rather than at
the item level.
OPTION GROUPS: Apply the RADIO_GROUP property class to the option group.
Apply the RADIO_BUTTON property class to each button of an option group.
Using APP_ITEM_PROPERTY.SET_PROPERTY
The APP_ITEM_PROPERTY.SET_PROPERTY cover routine modifies
the following properties:
• ALTERABLE
• ALTERABLE_PLUS
• ENTERABLE
• DISPLAYED
• ENABLED
• REQUIRED
If the item is neither a display item nor a button then also set:
set_item_property(itemid, QUERYABLE, PROPERTY_ON);
set_item_property(itemid, INSERT_ALLOWED, PROPERTY_ON);
set_item_property(itemid, UPDATEABLE, PROPERTY_ON);
CLOSE WINDOW: The window close events for all non–modal windows (but no
modal windows) get passed to APP_CUSTOM.CLOSE_WINDOW.
To close the first window of a form, APP_WINDOW.CLOSE_FIRST_WINDOW.
Master-Detail Relationship:
When a detail block is in a different window than its master, and each window is non–
modal, then the detail block must provide a mechanism for the user to toggle between
immediate and deferred coordination.
When a detail block is not visible, its coordination should always be deferred. Use the
procedure APP_WINDOW.SET_COORDINATION to coordinate master–detail blocks
in different windows.
The check box should have the CHECKBOX_COORDINATION property class, which
provides a value of ”IMMEDIATE” when checked and ”DEFERRED” when unchecked.
The check box value should default to checked (IMMEDIATE).
Combination Block:
You can have a single block in which some items are single–record (Detail) and some are
multi–record (Summary). The Synchronize with Item property does this automatically.
You control which portion of the block is navigated to in different situations using a field
called Switcher. The Switcher field is the first navigable item in the block. When the
cursor enters the Switcher, it is immediately moved to the first item in either the Detail or
Summary portion of the block.
• To prevent the user from tabbing out of the Detail and into the Summary, set the
Previous Navigation Item property for the first Detail item, and the Next
Navigation Item property for the last Detail item.
• To enforce the standard multi–record block navigation behavior of Change
Record, call APP_COMBO.KEY_PREV_ITEM in the KEY–PREV–ITEM (Fire
APPS form Development Guide: Page 9 Prepared By: Sridhar Vishwanath
in ENTER–QUERY mode: No) trigger of the first navigable item of the Summary
portion, and call next_record in the KEY–NEXT–ITEM trigger (Fire in
ENTER–QUERY mode: No) of the last navigable item of the Summary portion.
• Create a parameter to store the record count for the portion of the block you are
currently in. Name the parameter <block>_RECORD_COUNT, where <block> is
the name of the combination block. The APPCORE code depends on this naming
standard. This information is used to determine which portion of the block to
navigate to. The parameter should have a Data Type of NUMBER and a default
value of 2, so that the cursor is initially in the Summary portion. (If you want the
cursor to start in the Detail portion, set the default value to 1).
• Create a block level WHEN–NEW–ITEM–INSTANCE trigger (Execution
Hierarchy: Before) that contains the following code:
:PARAMETER.<block>_RECORD_COUNT :=
GET_ITEM_PROPERTY(:SYSTEM.CURSOR_ITEM,
RECORDS_DISPLAYED);
• The Switcher Create a text item and assign it the property class SWITCHER. It
needs to be the lowest sequenced item in the block. Place it at (0,0) on the toolbar
canvas (the switcher belongs on the toolbar canvas because whatever canvas it is
on paints). Create an item–level WHEN–NEW–ITEM–INSTANCE trigger
(Execution Hierarchy:
Override) that contains the following code:
IF(:PARAMETER.<block>_RECORD_COUNT > 1) THEN
GO_ITEM(’<first Summary field>’);
ELSE
APP_WINDOW.SET_WINDOW_POSITION(’<Detail window>’,
’OVERLAP’,
’<Summary window>’);
GO_ITEM(’<first Detail field>’);
END IF;
• The Summary/Detail Menu Item Create a block–level SUMMARY_DETAIL
trigger (Execution Hierarchy: Override) that contains the following code:
IF GET_ITEM_PROPERTY(:SYSTEM.CURSOR_ITEM,
RECORDS_DISPLAYED) > 1 THEN
:PARAMETER.<block>_RECORD_COUNT := 1;
ELSE
:PARAMETER.<block>_RECORD_COUNT := 2;
END IF;
GO_ITEM(’<block>.Switcher’);
This code changes the value in the RECORDS_DISPLAYED parameter so that
the Switcher sends the cursor into the opposite portion of the block. It will fire
whenever the user chooses ”Go –> Summary/Detail.”
Create a block–level PRE–BLOCK trigger (Execution Hierarchy: Override) that
contains the following code:
APPS form Development Guide: Page 10 Prepared By: Sridhar
Vishwanath
APP_SPECIAL.ENABLE(’SUMMARY_DETAIL’, PROPERTY_ON);
Finally, create a form–level PRE–BLOCK trigger (Execution Hierarchy:
Override) that contains the code:
APP_SPECIAL.ENABLE(’SUMMARY_DETAIL’, PROPERTY_OFF);
If all blocks are combination blocks, you can turn on SUMMARY_DETAIL at
the form–level and ignore the PRE–BLOCK trigger. If most blocks are
combination blocks, you can turn SUMMARY_DETAIL on at the form–level,
and disable it at the block–level for those blocks that are not combination blocks.
• Initial navigation and window operations If your combination block is the first
block in the form, position the two windows in the PRE–FORM trigger with the
following calls:
APP_WINDOW.SET_WINDOW_POSITION(’<Summary window>’,
’FIRST_WINDOW’);
APP_WINDOW.SET_WINDOW_POSITION(’<Detail window>’,’OVERLAP’,
’<Summary window>’);
Usually, the Summary is entered first, but there are cases where it is dynamically
determined that the Detail should be entered first. If you need to dynamically
decide this, set the parameter <block>_RECORD_COUNT in the PRE–FORM
trigger (1 to send it to the Detail, 2 to send it to the Summary).
TABBED REGION: A tabbed region is the area of the window that contains a group of
related tabs.
The three degrees of difficulty require different types of layout methods
and coding methods.
• Simple: no scrolling or fixed fields
• Medium: scrolling but no fixed fields – Place items onto stacked canvases, in
front of the tab pages, to facilitate scrolling of fields.
• Difficult: fixed fields with or without scrolling
If you want a Row–LOV or Find window to raise immediately upon entering the
form, at the end of your WHEN–NEW–FORM–INSTANCE trigger, call:
EXECUTE_TRIGGER(’QUERY_FIND’);\
Implementing FIND_WINDOW
To implement a Find window, create an additional window that
contains the
fields a user is most likely to search by when they initiate the search and copy all
the item values from that block into the results
block just before executing a query.
STEP1: Copy the QUERY_FIND Object Group from APPSTAND to your form.
It contains a window, a block and a canvas from which to start building
your Find window.
After you copy it, delete the object group. This leaves the window,canvas
and block, but allows you to copy the object group again if you need
another Find window.
STEP2: Rename the Find Block, Canvas, and Window. Set the queryable
property of the block to No.
STEP3: Edit the WHEN–BUTTON–PRESSED trigger for the NEW button in the
APPS form Development Guide: Page 12 Prepared By: Sridhar
Vishwanath
Find window block so that it passes the Results block name as the
argument. This information allows Oracle Applications to navigate to
your block and place you on a new record.
app_find.new(’<Your results blockname here>’);
MESSAGE DECTIONER
Message Name: A non–updatable internal identifier for a message in your
application. A message name, together with your application name and language name,
uniquely identifies your message text.
MESSAGE: Text your application displays or prints to an output file.
MESSAGE NUMBER: A number that appears with your message.If you define a non–
zero message number for your message, Message Dictionary automatically prepends your
message with the prefix APP– (or its translated equivalent).
VARIABLE TOKEN: A keyword you create to represent a value when you define a
message. You specify the same variable token, along with its current value, when
you call Message Dictionary from your form or program module.