Total Pageviews

September 22, 2016

9/22/2016 02:44:00 AM
Customizing Oracle Applications with the CUSTOM Library
The CUSTOM library allows extension of Oracle Applications without modification of Oracle Applications code.

You can use the CUSTOM library for customizations such as

Ø Zoom (such as moving to another form and querying up specific records),
Ø Enforcing business rules (vendor name must be in uppercase letters),
Ø  Disabling fields that do not apply for your site.

When to Use the CUSTOM Library

There are several main cases for which you can code logic using the CUSTOM library. Each of these cases must be coded differently.

Zoom—The addition of user–invoked logic on a per–block basis.
A Zoom typically consists of opening another form and (optionally) passing parameter values to the opened form through the Zoom logic.

Logic for generic events—Augment Oracle Applications logic for certain generic form events such as WHEN–NEW–FORM–INSTANCE or WHEN–VALIDATE–RECORD. You can use generic events to change field prompts and other properties, hide fields, add validation, and more.

Logic for product–specific events—Augment or replace Oracle Applications logic for certain product–specific events that enforce business rules.

Custom entries for the special menus—Add entries to the special menus for Oracle Applications forms, such as an entry that opens a custom form.

Setting visual attributes —Use the CUSTOM library to change the visual attributes of Oracle Applications fields at runtime. Use the Oracle Forms built–in SET_VA_PROPERTY to set the properties of the CUSTOM1–CUSTOM5 visual attributes, and then use APP_ITEM_PROPERTY2.SET_PROPERTY to apply the visual attribute to an item at runtime.

  
CUSTOM Package

The CUSTOM package contains the following functions and procedure:

Ø CUSTOM.ZOOM_AVAILABLE
Ø CUSTOM.STYLE
Ø CUSTOM.EVENT

CUSTOM.ZOOM_AVAILABLE

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.

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


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. 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).

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.

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

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;”.

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.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;






0 comments:

Post a Comment