Introduction to APPCORE Routine APIs

This blog post provides you with specifications for calling many Oracle Applications APIs from your PL/SQL procedures. Most routines in the APPCORE library are described here. Some APPCORE routines are described in other chapters (for example, the APP_SPECIAL routines are described in the chapter "Controlling the Toolbar and the Default Menu"). The routines described in this chapter include:
       APP_COMBO: Combination Block API
       APP_DATE: Date Conversion APIs
       APP_EXCEPTION: Exception Processing APIs
       APP_FIELD: Item Relationship Utilities
       APP_FIND: Query Find Utilities
       APP_ITEM: Individual Item Utilities
       APP_ITEM_PROPERTY: Property Utilities
       APP_NAVIGATE
       APP_RECORD: Record Utilities
       APP_REGION: Region Utilities
       APP_STANDARD Package
       APP_WINDOW: Window Utilities

APP_COMBO: Combination Block API

Use APP_COMBO to control navigation in combination blocks.

APP_COMBO.KEY_PREV_ITEM

             Summary                                          procedure  APP_COMBO.KEY_PREV_ITEM;
             Location                                          APPCORE library
Description                                Call this procedure in the KEY-PREV-ITEM trigger to provide the standard behavior when back-tabbing from the first item in a record. This procedure ensures that the cursor automatically moves to the last item of the previous record.

APP_DATE and FND_DATE: Date Conversion APIs

You can use the APP_DATE and FND_DATE package utilities to format, convert, or validate dates. The packages are designed to hide the complexities of the various format masks associated with dates. These routines are particularly useful when you are manipulating dates as strings. The routines are designed to handle the multilingual, flexible format mask, and Y2K aspects of these conversions.
The APP_DATE routines are located in the APPCORE library and can be called from forms and other libraries, except for libraries that are attached to APPCORE, such as the
CUSTOM library. For code in the CUSTOM library and other libraries attached to
APPCORE, use the APP_DATE2 package in the special APPCORE2 library. The APP_DATE2 package is equivalent to APP_DATE, with the same routines and routine arguments.
The FND_DATE package is located in the database. You can call FND_DATE routines from SQL statements or other database packages. Many of the routines are in both the APP_DATE and the FND_DATE packages.

List of Date Terms

Because a date can be expressed in many different ways, it is useful to define several date-related terms that appear in the following APIs.
Form date field
A text item (in a form) that has a data type of "Date".

Form datetime field
A text item (in a form) that has a data type of "Datetime".

Form character field
A text item (in a form) that has a data type of "Char".
PL/SQL date
A PL/SQL variable declared as type "Date". Such a variable includes both date and time components.
User date format
The format in which the user currently sees dates in forms.
User datetime format
The format in which the user currently sees dates with a time component in forms.
Canonical date format
A standard format used to express a date as a string, independent of language. Oracle Applications uses
YYYY/MM/DD HH24:MI:SS as the canonical date format.
Warning: The APP_DATE and FND_DATE routines make use of several package variables, such as canonical_mask, user_mask, and others. The proper behavior of Oracle Applications depends on these values being correct, and you should never change any of these variables.

APP_DATE.CANONICAL_TO_DATE and FND_DATE.CANONICAL_TO_DATE

Summary
function APP_DATE.CANONICAL_TO_DATE(
     canonical varchar2)
return date;
Location
APPCORE library and database (stored function)
Description
This function takes a character string in the canonical date format (including a time component) and converts it to a PL/SQL date.
If APP_DATE.CANONICAL_TO_DATE fails, the routine displays a message on the message line and raises form_trigger_failure. If
FND_DATE.CANONICAL_TO_DATE fails, the routine raises a standard exception from the embedded TO_DATE call but does not return a message.
Arguments (input)
canonical - The VARCHAR2 string (in canonical format) to be converted to a PL/SQL date.
Example 1
declare
  hire_date varchar2(20) := '1980/01/01';
  num_days_employed number;
begin
  num_days_employed := trunc(sysdate) app_date.canonical_to_date(hire_date);   message('Length of employment in days: '||
  to_char(num_days_employed)); end;
Example 2
select fnd_date.canonical_to_date(tab.my_char_date) from ...

APP_DATE.DISPLAYDATE_TO_DATE and FND_DATE.DISPLAYDATE_TO_DATE

Summary
function APP_DATE.DISPLAYDATE_TO_DATE(chardate
varchar2) return date;
Location
APPCORE library and database (stored function)
Description
This function takes a character string in the user date format and converts it to a PL/SQL date.
If APP_DATE.DISPLAYDATE_TO_DATE fails, the routine
displays a message on the message line and raises form_trigger_failure. If
FND_DATE.DISPLAYDATE_TO_DATE fails, the routine raises a standard exception from the embedded TO_DATE call but does not return a message.
In previous releases this function was named
APP_DATE.CHARDATE_TO_DATE (that name has been retained for backwards compatibility).
Arguments (input)
chardate - The VARCHAR2 string (in the user date format) to be converted to a PL/SQL date.

APP_DATE.DISPLAYDT_TO_DATE and FND_DATE.DISPLAYDT_TO_DATE

Summary
function APP_DATE.DISPLAYDT_TO_DATE(charDT
varchar2)
                  return date;
Location
APPCORE library and database (stored function)
Description
This function takes a character string in the user datetime
format and converts it to a PL/SQL date.
If APP_DATE.DISPLAYDT_TO_DATE fails, the routine displays a message on the message line and raises
form_trigger_failure. If
FND_DATE.DISPLAYDT_TO_DATE fails, the routine raises a standard exception from the embedded TO_DATE call but does not return a message.
In previous releases this function was named
APP_DATE.CHARDT_TO_DATE (that name has been retained for backwards compatibility).
Arguments (input)                   charDT - The VARCHAR2 string (in the user datetime format) to be converted to a PL/SQL date.

APP_DATE.DATE_TO_CANONICAL and FND_DATE.DATE_TO_CANONICAL

Summary
function APP_DATE.DATE_TO_CANONICAL(
dateval date)                  return varchar2;
Location
APPCORE library and database (stored function)
Description
This function converts a PL/SQL date to a character string in the canonical date format. The entire time component is retained.
Arguments (input)
dateval - The PL/SQL date to be converted.
Example
select fnd_date.date_to_canonical(hire_date) from emp ...

APP_DATE.DATE_TO_DISPLAYDATE and FND_DATE.DATE_TO_DISPLAYDATE

Summary
function APP_DATE.DATE_TO_DISPLAYDATE(dateval
date)  return varchar2;
Location
APPCORE library and database (stored function)
Description
This function converts a PL/SQL date to a character string in the user date format. Any time component of the
PL/SQL date is ignored.
In previous releases this function was named
APP_DATE.DATE_TO_CHARDATE (that name has been retained for backwards compatibility).
           Arguments (input)                          dateval - The PL/SQL date to be converted.
Example
declare
  my_displaydate varchar2(30);
  my_dateval date;
begin   my_displaydate :=
  app_date.date_to_displaydate(my_dateval); end;

APP_DATE.DATE_TO_DISPLAYDT and FND_DATE.DATE_TO_DISPLAYDT

Summary
function APP_DATE.DATE_TO_DISPLAYDT(dateval
date)
return varchar2;
Location
APPCORE library and database (stored function)
Description
This function converts a PL/SQL date to a character string in the user datetime format. Any time component of the PL/SQL date is preserved.
In previous releases this function was named
APP_DATE.DATE_TO_CHARDT (that name has been retained for backwards compatibility).
Arguments (input)
dateval - The PL/SQL date to be converted.
Example
declare
  my_displaydt varchar2(30);   my_dateval date;
begin   my_displaydt :=
  app_date.date_to_displaydt(my_dateval); end; APP_DATE.DATE_TO_FIELD
Summary
procedure APP_DATE.DATE_TO_FIELD( dateval date,
          field varchar2,
          datetime varchar2 default 'DEFAULT',           date_parameter boolean default FALSE);
Location
APPCORE library
Description
This procedure copies a PL/SQL date into a form field,
form parameter, or global variable. Use this routine instead
of the COPY built-in routine when date processing is required.
When copying a value into form fields where the datatype is Date or Datetime, this procedure uses the appropriate internal mask to maintain the datatype.
When copying a value into form fields where the datatype is Char, by default this procedure applies the user datetime format if the field is long enough to hold it; otherwise this procedure applies the user date format.
When copying a value into global variables or form parameters, by default this procedure assumes a datatype of Char and applies the canonical date format, ignoring any time component. Use the date_parameter argument to override this behavior.
                       Arguments (input)                         dateval - The date to be copied.
field - The name of the field to which the date is copied, including the block name.
datetime - Use to override the default rules for determining date or datetime format. The default value is 'DEFAULT'. Specify 'DATE' or 'DATETIME' to force the copied value to have the date or datetime formats. Typically, you would use this argument to force the use of the datetime format in global variables and parameters, and for forcing use of the date format in character items that are longer than the datetime user mask.
date_parameter - Use this argument only if you are copying the value to a date parameter (with the date data type). If this argument is set to TRUE, the value is copied as a date value instead of as a character value.
Example
Replace the following code:
COPY(to_char(my_date_value, 'DD-MON-YYYY
{HR24:MI:SS}','my_block.my_date_field'); with the following code:
app_date.date_to_field(my_date_value, 'my_block.my_date_field');

APP_DATE.FIELD_TO_DATE

Summary
function APP_DATE.FIELD_TO_DATE(  field varchar2 default NULL,  date_parameter boolean default FALSE)
 return date;
Location
APPCORE library
Description
This function takes a value from a form field, form parameter, or global variable and returns a PL/SQL date. Use this routine instead of the NAME_IN built-in routine when date processing is required.
When copying a value from form fields where the datatype is Date or Datetime, this procedure uses the appropriate internal mask to maintain the time component.
When copying a value from form fields where the datatype is Char, this procedure applies the user datetime format if the field is long enough to hold it; otherwise this procedure applies the user date format.
When copying a value from global variables or form parameters, by default this procedure assumes a datatype of Char and applies the canonical date format, with or without the time component depending on the current length.
If APP_DATE.FIELD_TO_DATE fails, the routine raises a standard exception from the embedded TO_DATE call but does not return a message.
Arguments (input)
field - The name of the field from which the date should be copied, including the block name.
date_parameter - Use this argument only if you are copying the value from a date parameter (with the date data type). If this argument is set to TRUE, the value is copied from the parameter as a date instead of as a character value.
Example
Replace the following code: to_date(NAME_IN('my_block.my_date_field'), 'DD-MON-YYYY {HH24:MI:SS}'); with the following code:
my_date = app_date.field_to_date('my_block.my_date_field');

APP_DATE.VALIDATE_CHARDATE

Summary
procedure APP_DATE.VALIDATE_CHARDATE(
field varchar2 default NULL)
Location
APPCORE library
Description
This procedure checks to see if a character value in a given form field (datatype Char) is a valid date by parsing it with the user date format.
If the conversion to a date with no time component fails, the routine displays a message on the message line and raises form_trigger_failure. If the conversion succeeds, the routine copies the converted value back into the field to ensure display consistency.
Arguments (input)
APP_DATE.VALIDATE_CHARDT
field - The name of the character field to be validated, including the block name. If no field name is passed in, the procedure uses SYSTEM.CURSOR_ITEM.
Summary
procedure APP_DATE.VALIDATE_CHARDT(  field varchar2 default NULL)
Location
APPCORE library
Description
This procedure checks to see if a character value in a given form field (datatype Char) is a valid datetime string by parsing it with the user datetime format.
If the conversion to a date with a time component fails, the routine displays a message on the message line and raises form_trigger_failure. If the conversion succeeds, the routine copies the converted value back into the field to ensure display consistency.
Arguments (input)
FND_DATE.STRING_TO_DATE
field - The name of the character field to be validated, including the block name. If no field name is passed in, the procedure uses SYSTEM.CURSOR_ITEM.
Summary
function FND_DATE.STRING_TO_DATE(
 p_string IN VARCHAR2,
 p_mask   IN VARCHAR2)                   
RETURN DATE;



Location
Database (stored function)
Description
This function converts a character string to a PL/SQL date using the given date format mask. This function tests all installed languages, if necessary, to find one that matches the language-dependent fragments of the given string. Use this routine when you need to convert character string data to dates and are unsure of the language used to store the character date.
This function returns NULL if the string cannot be converted. There is no error message. Your code must test for a NULL return value and handle the error as appropriate.
Language is important if the mask has language-dependent fragments, as in the format mask DD-MON-RRRR, where the "MON" fragment is language dependent. For example, the abbreviation for February is FEB, but the French abbreviation is FEV. The language testing order of this function is:
Language indicated by the setting of "NUMERIC DATE
LANGUAGE".
Current (default) database language.
The "Base" language of the Oracle Applications installation (where the INSTALLED_FLAG column of the FND_LANGUAGES table is set to "B").
Other installed languages, ordered by the
NLS_LANGUAGE column of the FND_LANGUAGES
table (where the INSTALLED_FLAG column is set to "I").
Arguments (input)
p_string - The character string to be converted.
p_mask - The format mask to use for the conversion, such as DD-MON-RRRR.
FND_DATE.STRING_TO_CANONICAL
                         Summary                                          function FND_DATE.STRING_TO_CANONICAL(
     p_string IN VARCHAR2,      p_mask   IN VARCHAR2) RETURN VARCHAR2;
                         Location                                         Database (stored function)
                        Description                                     This function is identical to
FND_DATE.STRING_TO_DATE except that this function
returns a character string in the canonical date format instead of returning a PL/SQL date.
                                   Arguments (input)                    p_string - The character string to be converted.
p_mask - The format mask to use for the conversion, such as DD-MON-RRRR.

APP_EXCEPTION: Exception Processing APIs

You should use the APPCORE package APP_EXCEPTION to raise exceptions in the PL/SQL procedures written for your forms.

APP_EXCEPTION.RAISE_EXCEPTION

Summary
procedure  APP_EXCEPTION.RAISE_EXCEPTION( exception_type varchar2 default null,      exception_code number   default null,      exception_text varchar2 default null);
Location
APPCORE library and database (stored procedure)
Description
Arguments
This procedure stores exception information and raises exception form_trigger_failure.
exception_text
Additional context information.
exception_type
Error prefix that specifies error type (for example, ORA or
APP)
exception_code
APP_EXCEPTION.RETRIEVE
The number that identifies the error.
Summary
procedure  APP_EXCEPTION.RETRIEVE;
Location
APPCORE library and database (stored procedure)
Description
APP_EXCEPTION.GET_TYPE
This procedure retrieves exception information from the database.
Summary
function  APP_EXCEPTION.GET_TYPE return
varchar2;
Location
APPCORE library and database (stored function)
Description
APP_EXCEPTION.GET_CODE
This function returns the exception type.
Summary
function  APP_EXCEPTION.GET_CODE return number;
Location
APPCORE library and database (stored function)
Description
APP_EXCEPTION.GET_TEXT
This function returns the exception code.
Summary
function  APP_EXCEPTION.GET_TEXT return
varchar2;
Location
APPCORE library and database (stored function)
Description
This function returns the exception text.

APP_EXCEPTION.RECORD_LOCK_EXCEPTION

Description                                This is a predefined exception. Call it in an exception handler to handle cases where the record cannot be locked.
It is usually used with the
APP_EXCEPTION.RECORD_LOCK_ERROR procedure.

APP_EXCEPTION.RECORD_LOCK_ERROR

Summary
procedure  APP_EXCEPTION.RECORD_LOCK_ERROR (
counter  IN   OUT   number);
Description
This procedure asks the user to continue or cancel an
attempt to lock a record. It returns to the calling procedure to try again if the user continues. It displays an "Unable to
reserve record" acknowledgement and raises
FORM_TRIGGER_FAILURE if the user cancels.
APP_EXCEPTION.RECORD_LOCK_ERROR only asks the
user every two attempts to lock a record (e.g., counter = 2, 4, 6, etc.). The calling procedure should attempt to lock the
record in a loop and call RECORD_LOCK_ERROR in a
WHEN APP_EXCEPTION.RECORD_ LOCK_EXCEPTION
exception handler inside the loop. If the user continues, RECORD_LOCK_ERROR returns and the loop repeats. If the user cancels, RECORD_LOCK_ERROR raises FORM_TRIGGER_FAILURE and the loop exits.
Arguments

counter
APP_EXCEPTION.DISABLED
Maintained by RECORD_LOCK_ERROR to count the attempts to lock a record. Calling procedure should initialize to null or 0.
Summary
procedure  APP_EXCEPTION.DISABLED;
Description
This procedure rings the bell. Call this procedure to disable simple functions (typically in a KEY- trigger).

APP_FIELD: Item Relationship Utilities

This section describes utilities you can use to maintain relationships between your form items.

APP_FIELD.CLEAR_FIELDS

Summary
procedure  APP_FIELD.CLEAR_FIELDS( field1  varchar2,
    field2  varchar2 default NULL,     field3  varchar2 default NULL,     field4  varchar2 default NULL,     field5  varchar2 default NULL,     field6  varchar2 default NULL,     field7  varchar2 default NULL,     field8  varchar2 default NULL,     field9  varchar2 default NULL,     field10 varchar2 default NULL);
Description
This procedure clears up to ten items if the items are not
NULL and are not check boxes or required lists.

APP_FIELD.CLEAR_DEPENDENT_FIELDS

                                     Summary                            procedure  APP_FIELD.CLEAR_DEPENDENT_FIELDS(
master_field varchar2,     field1  varchar2,     field2  varchar2 default NULL,     field3  varchar2 default NULL,     field4  varchar2 default NULL,     field5  varchar2 default NULL,     field6  varchar2 default NULL,     field7  varchar2 default NULL,     field8  varchar2 default NULL,     field9  varchar2 default NULL,     field10 varchar2 default NULL);
Description                                This procedure clears up to ten dependent items if the master item is NULL and the dependent items are not NULL and not check boxes or required lists.
Arguments (input)
                        master_field                                 Name of master item
                       field1 ... field10                             Name of dependent item(s).

APP_FIELD.SET_DEPENDENT_FIELD

Summary                                   procedure  APP_FIELD.SET_DEPENDENT_FIELD(event varchar2,
   master_field    varchar2,    dependent_field varchar2
   invalidate      boolean    default  FALSE); procedure  APP_FIELD.SET_DEPENDENT_FIELD( event           varchar2,    condition       boolean,    dependent_field varchar2    invalidate      boolean    default  FALSE);
Description                                This procedure makes an item enterable or not enterable based on whether the master item is NULL or a specified condition is TRUE, and clears the field. The dependent item can be a text item, check box, or poplist.
You typically call this procedure in the following triggers:
Triggers:
       WHEN-VALIDATE-ITEM on the master field
       WHEN-VALIDATE-ITEM on the field(s) the condition is based on or in event INIT on the dependent field
       PRE-RECORD
       POST-QUERY (required only when the dependent item is in a multi-record block)
Arguments (input)
                                     event                       Name of trigger event. If you call this trigger on a master
field, pass VALIDATE instead of the trigger name (which may be WHEN-VALIDATE-ITEM,
WHEN-CHECKBOX-CHANGED,
WHEN-LIST-CHANGED, or WHEN-RADIO-CHANGED, any of which can also be used).
master_field    Name of master item condition      TRUE when dependent item is to be enabled dependent_field   Name of dependent item
invalidate                                   If TRUE, mark the item as invalid instead of clearing the dependent item. Set this flag to TRUE if the dependent item is a required list or option group.
For examples on using this procedure, see:Item Relations, page 9-1, , Mutually Inclusive Items with Dependent Items, page 9-11 and Defaults, page 9-14.

APP_FIELD.SET_EXCLUSIVE_FIELD

                                     Summary                                    procedure  APP_FIELD.SET_EXCLUSIVE_FIELD(
event           varchar2,    field1           varchar2,    field2           varchar2,    field3           varchar2  default NULL);
                                    Description           This procedure coordinates items so that only one item of a
set may contain a value. If a value is entered in one of the items, the other items are cleared and made non-NAVIGABLE (users can still mouse into these items). This procedure only covers sets of two or three mutually-exclusive items.
Arguments (input)
                                     event                                             Name of trigger event
(WHEN-NEW-RECORD-INSTANCE, PRE-RECORD, or
VALIDATE. VALIDATE is generally used in place of
WHEN-VALIDATE-ITEM, WHEN-RADIO-CHANGED,
WHEN-LIST-CHANGED, or
WHEN-CHECKBOX-CHANGED, any of which can also be used.)
                                     field1                                                Name of exclusive item (BLOCK.FIELD)
field2   Name of exclusive item (BLOCK.FIELD) field3             Name of exclusive item (BLOCK.FIELD, optional)
For examples on using this procedure, see: Mutually Exclusive Items, page 9-9.

APP_FIELD.SET_INCLUSIVE_FIELD

                         Summary                                            procedure  APP_FIELD.SET_INCLUSIVE_FIELD(
event           varchar2,    field1           varchar2,    field2           varchar2,    field3           varchar2  default NULL,    field4           varchar2  default NULL,    field5           varchar2  default NULL);
Description                                This procedure coordinates up to five items so that if any of the items contains a value, then all of the items require a value. If all of the items are NULL, then the items are not required.
Arguments (input)
                         event                                             Name of trigger event
(WHEN-NEW-RECORD-INSTANCE, PRE-RECORD, or
VALIDATE. VALIDATE is generally used in place of
WHEN-VALIDATE-ITEM, WHEN-RADIO-CHANGED,
WHEN-LIST-CHANGED, or
WHEN-CHECKBOX-CHANGED, any of which can also be used.)
field1   Name of inclusive item field2           Name of inclusive item field3         Name of inclusive item (optional) field4 Name of inclusive item (optional) field5             Name of inclusive item (optional)
For examples on using this procedure, see: Mutually Inclusive Items, page 9-10.

APP_FIELD.SET_REQUIRED_FIELD

                         Summary                                           procedure  APP_FIELD.SET_REQUIRED_FIELD(
event           varchar2,    condition       boolean,    field1           varchar2,    field2           varchar2  default NULL,    field3           varchar2  default NULL,    field4           varchar2  default NULL,    field5           varchar2  default NULL);
Description
Arguments (input)
This procedure makes an item required or not required based on whether a specified condition is true.
event
Name of trigger event
condition
True when items should be required
field1
Name of item
field2
Name of item
field3
Name of item (optional)
field4
Name of item (optional)
field5
Name of item (optional)
For examples on using this procedure, see: Conditionally Mandatory Items, page 9-12.

APP_FIND: Query-Find Utilities

Use the following routines to implement the Find Window functionality.

APP_FIND.NEW

Summary
procedure  APP_FIND.NEW( block_name varchar2);
Description
Arguments (input)
This routine is called by the "New" button in a Find Window to return the user to a new record in the block on which the find is based.
block_name
The name of the block the Find Window is based on

APP_FIND.CLEAR

Summary
procedure  APP_FIND.CLEAR;
Description
APP_FIND.CLEAR_DETAIL
This routine is called by the "Clear" button in a Find Window to clear the Find Window.
Summary
procedure  APP_FIND.CLEAR_DETAIL( detail_block    varchar2);
Description
Arguments (input)
This routine clears the result block of a find block (not a Find window). This action can only be performed from triggers that allow navigation.
detail_block
The name of the block to be cleared
Example
APP_FIND.CLEAR_DETAIL('MYBLOCK');

APP_FIND.FIND

Summary
procedure  APP_FIND.FIND( block_name    varchar2);
Description
Arguments (input)
This routine is called by the "Find" button in a Find Window to execute the Find.
block_name
APP_FIND.QUERY_RANGE
The name of the block the Find Window is based on
Summary
procedure  APP_FIND.QUERY_RANGE( low_value    varchar2/date/number,    high_value   varchar2/date/number,
   db_item_name varchar2);
Description
Arguments (input)
This utility constructs the query criteria for ranges in a Find Window. Depending on the datatype of the low and high value, it creates a range of characters, dates, or numbers.
low_value
The low value of the range
high_value
The high value of the range

db_item_name
APP_FIND.QUERY_FIND
The name of the item in the block that is being queried

Summary
procedure  APP_FIND.QUERY_FIND( lov_name varchar2);
procedure APP_FIND.QUERY_FIND(    block_window    varchar2,    find_window     varchar2,    find_block      varchar2);

Description
Arguments (input)
These routines invoke either the Row-LOV or the Find
Window. Call them from a user-named trigger
"QUERY_FIND."

lov_name
The name of the Row-LOV

block_window
The name of the window the Find Window is invoked for

find_window
The name of the Find Window

find_block
The name of the block in the Find Window

APP_ITEM: Individual Item Utilities

This section describes utilities for managing your items individually.

APP_ITEM.COPY_DATE

Summary
procedure  APP_ITEM.COPY_DATE( date_val  varchar2    item_name varchar2);
Description
Arguments (input)
Use this procedure to copy a hardcoded date value into a field. This routine does the copy in this way: copy(to_char(to_date('01-01-1900',
'DD-MM-YYYY'),
               'DD-MON-YYYY'), 'bar.lamb');
date_val
A character date, expressed in the format 'DD-MM-YYYY'
item_name
The name of the item to copy the value into, expressed as
block.item.
APP_ITEM.IS_VALID

Summary
procedure  APP_ITEM.IS_VALID(         val         varchar2
   dtype       varchar2  default 'DATE');
function APP_ITEM.IS_VALID(    val         varchar2
   dtype       varchar2  default 'DATE')
return BOOLEAN;
Description
Arguments (input)
Use this routine with fields that are of character datatype but contain data in the format of a date, number or integer. The procedure raises an error if the value is not in a valid format for the specified datatype. The function returns TRUE if the value is in the correct format, otherwise FALSE
val
Value to be checked
dtype
APP_ITEM.SIZE_WIDGET
Datatype value should use: DATE, INTEGER, or
NUMBER.
Summary
procedure  APP_ITEM.SIZE_WIDGET(         wid_name varchar2.    max_width number default 20);
Description
Arguments (input)
This procedure reads the current label for the specified widget and resizes the widget to fully show the label (used
to ensure proper size for a translated label). It will not make the widget any larger than the maximum width specified, to prevent overlapping or expansion beyond the edge of the screen. Call this procedure only for check boxes in single-record formats, buttons and radio groups.
wid_name
Name of the widget in block.field syntax
max_width
The maximum size to make the widget, in inches

APP_ITEM_PROPERTY: Property Utilities

These utilities help you control the Oracle Forms and Oracle Applications properties of
your items.

APP_ITEM_PROPERTY.GET_PROPERTY

Summary
function  APP_ITEM_PROPERTY.GET_PROPERTY(
       item_name varchar2,    property number)    return number; function  APP_ITEM_PROPERTY.GET_PROPERTY(
   item_id item,    property number)     return number;
Description
Arguments (input)
This function returns the current setting of an item property. It differs from the Oracle Forms's
get_item_property in that it returns PROPERTY_ON or PROPERTY_OFF instead of TRUE or FALSE.
item_name
Name of the item to apply the property attribute to. Specify both the block and item name. You can supply the item_ID instead of the name of the item.
property
The property to set.

APP_ITEM_PROPERTY.SET_PROPERTY

Summary
procedure  APP_ITEM_PROPERTY.SET_PROPERTY(
       item_name varchar2,    property varchar2,    value number); procedure  APP_ITEM_PROPERTY.SET_PROPERTY(
   item_id item,    property varchar2,    value number);
Description
This procedure sets the property of an item. You should
never use the Oracle Forms built-in SET_ITEM_PROPERTY
to set the field properties DISPLAYED, ENABLED, ENTERABLE, ALTERABLE, INSERT_ ALLOWED,
UPDATEABLE, NAVIGABLE, REQUIRED, and
ICON_NAME directly. Use
APP_ITEM_PROPERTY.SET_PROPERTY instead.
APP_ITEM_PROPERTY.SET_PROPERTY remaps some
properties to do other things like change visual attributes.
Also, there are some properties that
APP_ITEM_PROPERTY provides that native Oracle Forms
does not.
Arguments (input)

item_name
Name of the item to apply the property attribute to. Specify both the block and item name. You can supply the item_ID instead of the name of the item.
property
The property to set.
value
Either PROPERTY_ON or PROPERTY_OFF, or an icon name (to change the icon property).

APP_ITEM_PROPERTY.SET_VISUAL_ATTRIBUTE

Summary
procedure  APP_ITEM_PROPERTY.SET_VISUAL_ATTRIBUTE( item_name varchar2,    property number    value number);
Description
This procedure is no longer used. All colors are set as part
of the Oracle Look and Feel (OLAF).

APP_NAVIGATE: Open a Form Function

Use this utility instead of FND_FUNCTION.EXECUTE to open a form function where you want to reuse an instance of the same form that has already been opened. Use FND_FUNCTION.EXECUTE for all other cases of opening forms and functions.

APP_NAVIGATE.EXECUTE

Summary
procedure APP_NAVIGATE.EXECUTE(     function_name in varchar2,   o   pen_flag  in varchar2 default 'Y',     session_flag in varchar2 default 'SESSION',     other_params in varchar2 default NULL,     activate_flag in varchar2 default 'ACTIVATE',   pinned in boolean  default FALSE);
Description
This procedure is similar to FND_FUNCTION.EXECUTE,
except that it allows a form to be restarted if it is invoked a second time. For example, if form A invokes function B with this procedure, then at a later time invokes function B again, the same instance of form B will be reused (and form B would be restarted using any new parameters passed in the second call to APP_NAVIGATE.EXECUTE). This functionality is useful where you have a form B built to appear as a detail window of another form (A), and you
want the "detail window" to reflect changes in the "master window". In contrast, FND_FUNCTION.EXECUTE always starts a new instance of a form.
Only a function that was previously invoked using this call is a candidate for restarting; a function invoked with FND_FUNCTION.EXECUTE cannot be restarted if later a call is made to APP_NAVIGATE.EXECUTE.
Multiple forms can share the same target form. For example, if form A invokes function B with APP_NAVIGATE.EXECUTE, and then later form C also invokes function B, the current instance of form B will be restarted.
APP_NAVIGATE.EXECUTE and
FND_FUNCTION.EXECUTE store the position and size of the current (source) window in the following global variables so that the target form can access them:
       global.fnd_launch_win_x_pos
       global.fnd_launch_win_y_pos
       global.fnd_launch_win_width
       global.fnd_launch_win_height
The intended usage is so that the target form can be positioned relative to the current window of the calling form. When calling APP_NAVIGATE.EXECUTE, these values are available when the target form is opened the first time; it is not valid to refer to them during the RESTART event.
Using APP_NAVIGATE.EXECUTE requires special code in the target form (form B) to respond to the
APP_NAVIGATE.EXECUTE call appropriately. The target form must contain a user-named trigger called RESTART,
as well as the required calls to APP_STANDARD.EVENT in the WHEN-NEW-FORM-INSTANCE and WHEN-FORM-NAVIGATE triggers. When a form is reused with APP_NAVIGATE, APPCORE will:
1.      Issue a do_key('clear_form') in the target form. This fires the same logic as when the user does Edit->Clear->Form. This is done to trap the target form.
2.      If that succeeds, then all form parameters in the target form are repopulated (parameters associated with the function called by APP_NAVIGATE, as well as values in the other_params argument specifically passed in by APP_NAVIGATE).
3.      User-named trigger RESTART in the target form is executed.
A good coding technique is to place all logic that responds
to parameter values in a single procedure and have your WHEN-NEW-FORM-INSTANCE and RESTART triggers
both call it. You may also want to add code called from the WHEN-NEW-FORM-INSTANCE trigger in the target form
that checks the variables set by
FND_FUNCTION.EXECUTE or
APP_NAVIGATE.EXECUTE to indicate the position of the source form. You can then use these values to set the position of the target form relative to the source form.
Arguments (input)                   function_name - The developer name of the form function to execute.
open_flag - 'Y' indicates that OPEN_FORM should be used; 'N' indicates that NEW_FORM should be used. You should always pass 'Y' for open_flag, which means to execute the function using the Oracle Forms OPEN_FORM built-in rather than the NEW_FORM built-in.
session_flag - Passing 'Y' for session_flag (the default) opens your form in a new database session, while 'N' opens the form in the same session as the existing form. Opening a form in a new database session causes the form to have an independent commit cycle.
other_params - An additional parameter string that is appended to any parameters defined for the function in the Forms Functions form. You can use other_params to set some parameters dynamically. It can take any number of parameters.
activate_flag - Either ACTIVATE or NO_ACTIVATE (default is ACTIVATE). This flag determines whether the focus goes to the new form (ACTIVATE) or remains in the calling form (NO_ACTIVATE).
pinned - If set to TRUE will open a new instance of the function, never to be reused (the same as
FND_FUNCTION.EXECUTE). If set to FALSE will attempt to reuse an instance of the function if it is currently running and was launched via APP_NAVIGATE.EXECUTE; otherwise it will open a new instance.

APP_RECORD: Record Utilities

Following are utilities that interact with a block at the record level.

APP_RECORD.TOUCH_RECORD

Summary
procedure  TOUCH_RECORD(
  block_name  varchar2 default NULL,    record_number  NUMBER  default NULL);
Description
Arguments (input)
Sets the status of a NEW record to INSERT_STATUS. For a
QUERY record, the record is locked and the status is set to CHANGED_STATUS. In both cases this flags the record to be saved to the database.
block_name
The name of the block to touch
record_number
APP_RECORD.HIGHLIGHT
The record that will be touched
Summary
procedure  APP_RECORD.HIGHLIGHT(   value  varchar2/number);
Description
Arguments (input)
This call changes the visual attribute of the current record by calling the DISPLAY_ITEM built-in for each multirow TEXT_ITEM, LIST and DISPLAY_ITEM of the current record. It will do nothing for items in which the
RECORDS_DISPLAYED property is 1. To highlight data, pass 'SELECTED_DATA'. To turn off highlighting, pass 'DATA'. You can pass the name of any visual attribute you want to apply.
value
The name of the visual attribute you want to apply.
Tip: To improve performance for large blocks with many hidden fields,
position all hidden fields at the end of the block, and place a non-database item named "APPCORE_STOP" before the hidden items. When APP_RECORD.HIGHLIGHT reaches this field, it stops highlighting.

APP_RECORD.FOR_ALL_RECORDS

Summary
procedure  APP_RECORD.FOR_ALL_RECORDS(
  block_name      varchar2,   trigger_name     varchar2); procedure APP_RECORD.FOR_ALL_RECORDS(    trigger_name     varchar2);
Description
Arguments (input)
This call executes the specified trigger for every record of the current block or the specified block. If you specify a block, the GO_BLOCK built-in fires. When finished, the cursor returns to the original record and item.
If the trigger fails, FORM_TRIGGER_FAILURE is raised and the cursor is left in the record in which the failure occurred.
You can pass arguments to the specified trigger using global variables simply by setting the global variables before calling this routine.
APP_RECORD.FOR_ALL_RECORDS fires once when there are no queried records.
block_name
The name of the block to navigate to
trigger_name
APP_RECORD.DELETE_ROW
Name of the trigger to execute
Summary
procedure  APP_RECORD.DELETE_ROW(
   check_delete        BOOLEAN   default FALSE,    product_name        varchar2  default NULL,    message_name        varchar2  default NULL);
function  APP_RECORD.DELETE_ROW(
   check_delete        BOOLEAN   default FALSE,    product_name        varchar2  default NULL,    message_name        varchar2  default NULL)
   return BOOLEAN;
Description
This call provides a generic message to insure that the user
really intends to delete the row.
If the function version of this routine is called, it does not delete the row but returns TRUE if the user responds with a confirmation to delete the record and FALSE otherwise. If you have a complex delete, you can first confirm that the user wants to delete the record.
If the procedure version of this routine is called, the record is deleted if the user responds affirmatively. You should provide your own message when there is more than one block that allows delete.
Arguments (input)

check_delete
Forces block DELETE_ALLOWED to be checked (optional)
product_name
The product shortname needed if passing your own message. Otherwise a default message will be supplied (optional)
message_name
APP_RECORD.VALIDATE_RANGE
The name of the message if a product_name is supplied
(optional)
Summary
procedure  APP_RECORD.VALIDATE_RANGE(
  from_item     varchar2,   to_item       varchar2,
  range_name    varchar2  default NULL,   event_name    varchar2  default
'WHEN-BUTTON-PRESSED',
  dtype         varchar2  default 'DATE',   product_name  varchar2  default NULL,   message_name  varchar2  default NULL);
Description
This call validates a range to assure that the "from" value is
less than the "to" value. Call this routine from the
WHEN-BUTTON-PRESSED trigger of a Find button, or a WHEN-VALIDATE-RECORD trigger (for example) to verify that any range data entered by the user is valid.
If the range is invalid, the routine attempts to navigate to the beginning of the range. If you call VALIDATE_RANGE from a trigger that does not allow navigation, then provide a range name so that it can be displayed to the user when the default message is displayed.
You should define the range name in message dictionary and pass the message name to VALIDATE_RANGE. When you define your message, you should include a description that lets the translators know that it should be translated the same as the range title.
Arguments (input)

from_item
The block.item of the from value
to_item
The block.item of the to value
range_name
Name of the range (optional)
event_name
Trigger name, used to determine if navigation is possible
(optional)
dtype
Datatype of the range (NUMBER or DATE, defaults to
DATE) (optional)
product_name
The product shortname needed if passing your own message. Otherwise a default message will be supplied (optional)
message_name
The name of the message, if a product_name is supplied
(optional)

APP_REGION: Region Utilities

Following are utilities used with alternative regions (for backwards compatibility only; alternative regions have been replaced by tabs).

APP_REGION.ALT_REGION

Summary
function  APP_REGION.ALT_REGIONS(      poplist_name varchar2)         
    return BOOLEAN;
Description
Arguments (input)
Takes the values currently in the poplist identified by poplist_name and shows them in LOV 'appcore_alt_regions' (referenced in from APPSTAND automatically). If the user selects a row from the LOV, the corresponding poplist value will be updated and TRUE will be returned; otherwise no changes will be made to the poplist and this will return FALSE. Used for keyboard support of alternative region control.
poplist_name
The control poplist for an alternative region ('block.field' format).
Example if APP_REGION.ALT_REGIONS('CONTROL.LINE_REGIONS') then
    CONTROL.LINE_REGIONS('WHEN-LIST-CHANGED'); end if;

APP_STANDARD Package

APP_STANDARD.APP_VALIDATE

Summary
procedure  APP_STANDARD.APP_VALIDATE (scope NUMBER);
Description
Arguments (input)
This procedure acts similarly to Oracle Forms' built-in Validate, except that it navigates to the first item that caused the validation failure, and it provides support for the button standard. Use it instead of the Oracle Forms built-in.
scope
APP_STANDARD.EVENT
The scope of the validation. Valid values are
DEFAULT_SCOPE, FORM_SCOPE, BLOCK_SCOPE, RECORD_SCOPE, and ITEM_SCOPE.
Summary
procedure  APP_STANDARD.EVENT (   event_name        varchar2);
Description
Arguments (input)
This procedure invokes the standard behavior for the specified event. The TEMPLATE form contains all necessary calls to this trigger.
event_name
Name of the event or trigger

APP_STANDARD.SYNCHRONIZE

                                     Summary                                         procedure  APP_STANDARD.SYNCHRONIZE;
                                    Description            Dynamic changes to the form can affect which menu items
apply, although the state of the menu items is not re-evaluated automatically. If you make a change that affects which items in the toolbar and menu can be used, call this routine, and it re-evaluates the menu and toolbar. (For example, changing the INSERTABLE property of a block, changing the status of a record, etc.)

APP_STANDARD.PLATFORM

Summary
APP_STANDARD.PLATFORM varchar2(30);
Description
This package variable stores the name of the value returned by GET_APPLICATION_PROPERTY(USER_INTERFACE). Valid values include 'MACINTOSH', MSWINDOWS', MSWINDOWS32', and 'MOTIF'.
Example if APP_STANDARD.PLATFORM = 'MSWINDOWS' then
  MDI_height := get_window_property(FORMS_MDI_WINDOW,
              HEIGHT); end if; 

APP_WINDOW: Window Utilities

The following utilities operate at the window level.

APP_WINDOW.CLOSE_FIRST_WINDOW

Summary
procedure  APP_WINDOW.CLOSE_FIRST_WINDOW; 
Description
APP_WINDOW.PROGRESS
This call exits the form. It raises
FORM_TRIGGER_FAILURE if it fails.
Summary
procedure  APP_WINDOW.PROGRESS( percent   
number); 
Description
Arguments (input)
This call manages all aspects of the progress_indicator
object. If it is not already visible, the call opens and centers the window. When the percent >= 99.9, the window automatically closes. For any other percent, the progress bar resizes (with a four inch wide maximum).
percent
A number between 0 and 99.9, expressing the amount competed.

APP_WINDOW.SET_COORDINATION

Summary
procedure  APP_WINDOW.SET_COORDINATION(
  event           varchar2,   coordination    varchar2,   relation_name   varchar2);
Description
Arguments (input)
This call sets the deferred coordination attribute of a relation to ON or OFF based on the state of the
coordination check box. The check box is either "DEFERRED" or "IMMEDIATE."
For a closed window, the relation is always "DEFERRED."
When coordination is set to "DEFERRED," AutoQuery is turned on.
event
The name of the trigger event (either
WHEN-CHECKBOX-CHANGED,
WHEN-WINDOW-CLOSED, or OPEN-WINDOW)
coordination
IMMEDIATE or DEFERRED. Defaults to IMMEDIATE
relation_name
Name of the relation, which is listed in the Oracle Forms
Designer under the Block object in the Relation object

APP_WINDOW.SET_WINDOW_POSITION

Summary
procedure  APP_WINDOW.SET_WINDOW_POSITION(
  child          varchar2,   rel            varchar2,
  parent         varchar2     default  NULL);
Description
This call positions a window in the following styles:
       CASCADE
       RIGHT
       BELOW
       OVERLAP
       CENTER
       FIRST_WINDOW
If the window was open but obscured, this call raises the windows. If the window was minimized, the call normalizes it.
If system resources are low (especially on MS Windows), a warning message appears.
Arguments (input)

child
The name of the window to be positioned
rel
The style of the window's position
parent
Name of the window to relative to which you want to position the child window

APP_WINDOW.SET_TITLE

Summary
procedure  APP_WINDOW.SET_TITLE(
 window_name  varchar2,  session      varchar2,
 instance1    varchar2 default
'APP_ARGUMENT_NOT_PASSED',  instance2    varchar2 default
'APP_ARGUMENT_NOT_PASSED',  instance3    varchar2 default
'APP_ARGUMENT_NOT_PASSED');
Description
Arguments (input)
Use this utility to set the title of a window in the standard format.
window_name
The name of the window to set the title for
session
General session information (for example, Org, Set of
Books), no more than 64 characters
instance[1,2,3]
Context information from the master record (optional). The combined length should be no more than 250 characters.