忙裏偷閑

很多事情很多心情寫了也就記下了; 不寫,以後可能就忘了.
個人資料
正文

Form Customization using CUSTOM.pll.

(2010-03-11 08:08:10) 下一個

Customization of vanilla forms can be done by using the library CUSTOM.pll. Each vanilla Oracle forms is attached to this library.

For better control, CUSTOM.pll should be used to redirect to the form custom library. No actual coding should be done in the CUSTOM.pll. All required code for the specific form should be done in its own library.

CUSTOM.pll should be used to redirect to the form custom library. No actual coding should be done in the CUSTOM.pll. All required code for the specific form should be done in its own library. Creating a library for each form instead of putting all the code in CUSTOM.pll make it more readable and more structure.

procedure event(event_name varchar2) is

form_name varchar2(30) := name_in('system.current_form');
block_name varchar2(30) := name_in('system.cursor_block');

IF form_name = 'APXINWKB' THEN
   XX_APXINWKB_CUSTOM.event(event_name);
ELSE
   NULL;
END IF;

end event;


Where XX_APXINWKB_CUSTOM is the library for the form APXINWKB.fmb (AP Invoices).
The form custom library has to be attached to CUSTOM.pll. APPCORE2.pll should be attached too id it’s not yet.
In the library the form filed is referenced using the built in NAME_IN(‘BLOCK.FIELD’) and assigned using the built in COPY(values,’BLOCK.FIELD’).

Below is the example code in XX_APXINWKB_CUSTOM.pll to default the exchange date to invoice date instead of GL date in AP Invoices form when a new invoice is entered.

procedure event(event_name varchar2) is

vl_user_name varchar2(60) := fnd_profile.value('USERNAME');
vl_block_name varchar2(30) := name_in('system.current_block');
vl_item_name varchar2(60) := name_in('system.current_item');

begin
default_exchange_date(event_name);
exception
when FORM_TRIGGER_FAILURE then
raise FORM_TRIGGER_FAILURE;
when OTHERS then
message('Error in WHEN OTHERS in event ' ||SQLERRM);
raise;
end event;

procedure default_exchange_date(p_event varchar2) is
form_name VARCHAR2(30) := NAME_IN('system.current_form');
block_name VARCHAR2(30) := NAME_IN('system.cursor_block');
l_rate number;
begin
IF p_event = 'WHEN-NEW-ITEM-INSTANCE' and block_name = 'INV_SUM_FOLDER'
and name_in('INV_SUM_FOLDER.INVOICE_ID') is null --Vanilla condition only applied to unsave record
THEN
…………………………………………………
End IF;

Events Passed to the form CUSTOM Library
Generic Events are:
-WHEN-NEW-FORM-INSTANCE – initially entering a form
-WHEN-NEW-BLOCK-INSTANCE – entering a zone (or block) within a form
-WHEN-NEW-ITEM-INSTANCE – moving into a new field within the form
-WHEN-NEW-RECORD-INSTANCE - creating a new record
-WHEN-FORM-NAVIGATE – navigating through a form using the mouse
-WHEN-VALIDATE-RECORD – saving (committing) the information to the database
-EXPORT – triggered when using the Export feature
-ZOOM – Feature for moving to another form and querying up specific records
-SPECIALn - (where n is a number between 1 and 45) used to generate entries in Tools menu and the code is triggered by selecting that menu choice from the ‘Special’ option
-KEY-Fn – (where n is a number between 1 and 8) triggered by pressing the corresponding function key

Some events are application specific (Application Object Library):
-WHEN-LOGIN-CHANGED – when a user logs on as a different user
-WHEN-RESPONSIBILITY-CHANGED – when a user changes responsibilities
-WHEN-PASSWORD-CHANGED – when a user changes their password


[ 打印 ]
閱讀 ()評論 (0)
評論
目前還沒有任何評論
登錄後才可評論.