March 7, 2010

CUSTOM Package

The CUSTOM package contains the following functions and procedure:


 CUSTOM.ZOOM_AVAILABLE

 CUSTOM.STYLE

 CUSTOM.EVENT

CUSTOM.ZOOM_AVAILABLE

Summary: function custom.zoom_available return BOOLEAN;

Description:

If Zoom is available for this block, then return TRUE; otherwise return FALSE. Always test for the form and block name. Refer to the SYSTEM variables for form name and block name in your code and branch accordingly. The module name of your form must match the form file name. By default this routine must return FALSE.

Example:

The following example enables Zooms in the following places:

Form: FNDSCAUS, Block USER and
Form: FNDCPMCP, Block PROCESS
FUNCTION zoom_available RETURN BOOLEAN IS
form_name VARCHAR2(30) := NAME_IN(’system.current_form’);
block_name VARCHAR2(30) := NAME_IN(’system.cursor_block’);
BEGIN
IF (form_name = ’FNDSCAUS’ AND block_name = ’USER’) OR
(form_name = ’FNDCPMCP’ AND block_name = ’PROCESS’)THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END zoom_available;

CUSTOM.STYLE


Summary: function custom.style(event_name varchar2) return integer;

Description:

This function allows you to determine the execution style for a product–specific event if custom execution styles are supported for that product–specific event (many product–specific events do not support custom execution styles).

You can choose to have your code execute before, after, or in place of the code provided in Oracle Applications. See the User’s Guide for your Oracle Applications product for a list of events that are available through this interface. Note that some product–specific events may not support all execution styles. CUSTOM.STYLE does not affect generic form events or Zoom. Any event that returns a style other than custom.standard must have corresponding code in custom.event which will be executed at the time specified.


The following package variables should be used as return values:

 custom.before
 custom.after
 custom.override
 custom.standard

By default this routine must return custom.standard (which means that there is no custom execution style code).

Attention:

Oracle Corporation reserves the right to pass additional values for event_name to this routine, so all code must be written to branch on the specific event_name passed.

Example:

The following example sets up the MY_PRICING_EVENT event to have the Override execution style.

Begin

if event_name = ’MY_PRICING_EVENT’ then
return custom.override;
else
return custom.standard;
end if;
end style;

CUSTOM.EVENT

Summary: procedure custom.event(event_name varchar2);

Description

This procedure allows you to execute your code at specific events. Always test for event name, then for form and block name within that event. Refer to the SYSTEM variables for form name and block name in your code and branch accordingly. The module name of your form must match the form file name. By default, this routine must perform ”null;”.

Attention:

Oracle Corporation reserves the right to pass additional values for event_name to this routine, so all code must be written to branch on the specific event_name passed.

Example:

The following example contains logic for a Zoom, a product–specific event, and a generic form event. The Zoom event opens a new session of a form and passes parameter values to the new session. The parameters already exist in the form being opened, and the form function has already been defined and added to the menu (without a prompt, so it does not appear in the Navigator).

procedure event(event_name varchar2) is
form_name varchar2(30) := name_in(’system.current_form’);
block_name varchar2(30) := name_in(’system.cursor_block’);
param_to_pass1 varchar2(255);
param_to_pass2 varchar2(255);
begin
if (event_name = ’ZOOM’) then
if (form_name = ’DEMXXEOR’ and block_name = ’ORDERS’) then
/* The Zoom event opens a new session of a form and
passes parameter values to the new session. The
parameters already exist in the form being opened:*/
param_to_pass1 := name_in(’ORDERS.order_id’);
param_to_pass2 := name_in(’ORDERS.customer_name’);
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’”’);

/* all the extra single and double quotes account for any spaces that might be in the passed values */

end if;
elsif (event_name = ’MY_PRICING_EVENT’) then
/*For the product–specific event MY_PRICING_EVENT, call a custom pricing routine */
get_custom_pricing(’ORDERS.item_id’, ’ORDERS.price’);
elsif (event_name = ’WHEN–VALIDATE–RECORD’) then
if (form_name = ’APXVENDR’ and block_name = ’VENDOR’) then

/* In the WHEN–VALIDATE–RECORD event, force the value of a Vendor Name field to be in uppercase letters */

copy(upper(name_in(’VENDOR.NAME’)), ’VENDOR.NAME’);
end if;
else
null;
end if;
end event;
end custom;

Always use FND_FUNCTION.EXECUTE to open a new session of a form. Do not use CALL_FORM or OPEN_FORM. The form function must already be defined with Oracle Application Object Library and added to the menu (without a prompt, if you do not want it to appear in the Navigator).

No comments:

Post a Comment

Thanks for your comments submitted.,will review and Post soon! by admin.

COALESCE-SQL

Coalesce- return the null values from the expression. It works similar to a case statement where if expression 1 is false then goes to expr...