This section describes function security APIs you can use in your client-side PL/SQL procedures.
FND_FUNCTION.TEST and FND_FUNCTION_QUERY indicate whether a particular function is currently accessible. You can construct your code to test the availability of a particular function, and then take some action based on whether the function is available or not.
You can use FND_FUNCTION.EXECUTE to execute a particular form function or self-service function.
function FND_FUNCTION.TEST (function_name IN varchar2) return boolean;Description
Tests whether a particular function is currently accessible. Typically you would test for a function's availability at form startup (for example, to prevent certain buttons from being displayed or certain windows from being accessible).
Arguments (input)| function_name | The name of the function to test. |
IF (FND_FUNCTION.TEST('DEM_DEMXXEOR_PRINT_ORDER')) THEN
/* Put Print Order on the Special menu */
app_special.instantiate('SPECIAL1','&Print Order');
ELSE
/* hide the corresponding button on the form
(and the special menu is not instantiated) */
app_item_property.set_property('orders.print_order',
DISPLAYED, PROPERTY_OFF);
END IF;
procedure FND_FUNCTION.QUERY
(function_name IN varchar2,
accessible OUT varchar2,
function_type OUT varchar2,
form_path OUT varchar2,
arguments OUT varchar2);
Description
Checks whether a particular function is currently accessible, and if so, returns information about the function in function_type, form_path, and arguments. If the function is not accessible, function_type, form_path, and arguments are set to empty strings.
Arguments (input)| function_name | The name of the function to check. |
| accessible | Set to 'Y 'or 'N' to indicate whether the function can be accessed by the current responsibility. |
| function_type | The type of the function as specified in the Form Functions form. |
| form_path | The file system path to the form (or an empty string if there is no form associated with this function.) |
| arguments | The list of arguments specified for this function. |
procedure FND_FUNCTION.EXECUTE
(function_name IN varchar2,
open_flag IN varchar2 default 'Y',
session_flag IN varchar2 default 'SESSION',
other_params IN varchar2 default NULL,
activate IN varchar2 default 'ACTIVATE',
browser_target IN varchar2 default NULL);
Description
Executes the specified form function. Only executes functions that have a form attached. Displays a message to the end user if the function is not accessible.
Make sure that the function is defined with Oracle Application Object Library. Also, the function must be somewhere on the menu for the responsibility, though the form does not need to be accessible from the menu in the Navigator (do this by adding the function to the menu but leaving the prompt blank). Otherwise, the user will get a message saying that function is not available.
You should use FND_FUNCTION.EXECUTE instead of OPEN_FORM whenever you need to open a form programatically. 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.
FND_FUNCTION.EXECUTE is similar to APP_NAVIGATE.EXECUTE, except that APP_NAVIGATE.EXECUTE allows a form to be restarted if it is invoked a second time.
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 being opened 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.
APP_NAVIGATE.EXECUTE and FND_FUNCTION.EXECUTE allow you to open functions for Oracle Self-Service Applications (self-service functions) from Oracle Forms Developer-based forms and the Navigator window as well. The arguments require URL-style syntax instead of OPEN_FORM-style syntax. You cannot use APP_NAVIGATE.EXECUTE and FND_FUNCTION.EXECUTE to open functions from Oracle Self-Service Applications, however (because these routines are contained in Oracle Forms Developer-based libraries).
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. This argument is ignored if the function type is one of the following function types: WWW, WWK, JSP, or SERVELET. |
| session_flag | Passing 'NO_SESSION' or 'N' opens the form in the same session as the existing form; passing anything else opens your form in a new database session (including 'SESSION', the default). Opening a form in a new database session causes the form to have an independent commit cycle. You should always pass 'SESSION' or 'Y' (which has the same effect as 'SESSION' for backwards compatibility). This argument is ignored if the function type is one of the following function types: WWW, WWK, JSP, or SERVELET. |
| other_params | An additional parameter string that is appended to any parameters defined for the function in the Parameters field of the Form Functions form. You can use other_params to set some parameters dynamically. It can take any number of parameters. For calling forms: if there are multiple additional parameters, the values passed to those parameters must have double quotes around them. For example, suppose a form accepts two pieces of context information to perform a query when the form is accessed from a particular window. The concatenated string to pass should have the following syntax: FND_FUNCTION.EXECUTE(
FUNCTION_NAME=> function_name,
OPEN_FLAG=>'Y', SESSION_FLAG=>'Y',
OTHER_PARAMS=> 'CONTEXT1="'||:block.context1 || ' "
CONTEXT2=" || :block.context2 || ' " ');
For calling Oracle Self-Service Applications functions, anything in the other_params argument is appended to the URL as constructed from the function definition (with an ampersand & delimiter). The URL is constructed as follows: HTML_Call_field&Parameters_field&OTHER_PARAMS Use URL-style syntax for other_params if you are calling a self-service function. For example, your call might look like the following: FND_FUNCTION.EXECUTE(
FUNCTION_NAME=> function_name,
OPEN_FLAG=>'Y', SESSION_FLAG=>'Y',
OTHER_PARAMS=>'partyId='||
to_char(:cust.party_id));
|
| 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). This argument is ignored if the function type is one of the following function types: WWW, WWK, JSP, or SERVELET. |
| browser_target | Use this argument only for calling self-service functions. This argument allows you to specify which browser frame should be used. The NULL default means that the function opens in a new browser window. |
The following is an example of calling a form function (not a self-service function):
FND_FUNCTION.EXECUTE(FUNCTION_NAME=>'DEM_DEMXXEOR',
OPEN_FLAG=>'Y', SESSION_FLAG=>'Y',
OTHER_PARAMS=> 'ORDER_ID="'||param_to_pass1||
'" CUSTOMER_NAME="'||param_to_pass2||'"');
function FND_FUNCTION.USER_FUNCTION_NAME
(function_name IN varchar2)
return varchar2;
Description
Returns the user function name.
Arguments (input)| function_name | The developer name of the function. |
function FND_FUNCTION.CURRENT_FORM_FUNCTION return varchar2;Description
Returns the function name with which the current form was called.