2012-09-08 Created By BaoXinjian
一、摘要
Oracle Form Builder提供了提供了客制化custom.pll中zoom的功能,跳转页面的功能
编写Zoom
Zoom允许用户调用在每一个块中调用逻辑,例如,你可能希望在输入采购订单form时打开供应商form,你可以在这一个块上使用Zoom并且当用户调用它,你可以打开供应商form
11i版本Zoom的行为:
1. Oracle 应用程序提供一个菜单项和工具栏中的一个按钮,用户可以调用Zoom,只有当这个块在CUSTOM库Zoom逻辑定义后,菜单项和按钮才可用。
2. 当光标在form中改变到不同的块中,form调用CUSTOM库中的ZOOM_AVALIABLE 方法。如果这个方法返回TRUE,ZOOM条目和按钮可用,如果返回FALSE不可用。
3. 如果Zoom条目是可用的,这是当用户调用Zoom时调用CUSTOM中的ZOOM方法。你基于当前form和块编写这个事件的方法。
4. Zoom启动后,会在工具中通过Zoom按钮进行页面跳转
二、解析
1. Form Trigger Template Script
function zoom_available return boolean is
--
-- This function allows you to specify if zooms exist for the current
-- context. If zooms are available for this block, then return TRUE;
-- else return FALSE.
--
-- This routine is called on a per-block basis within every Applications
-- form from the WHEN-NEW-BLOCK-INSTANCE trigger. Therefore, any code
-- that will enable Zoom must test the current form and block from
-- which the call is being made.
--
-- By default this routine must return FALSE.
--
/* Sample code:
form_name varchar2(30) := name_in('system.current_form');
block_name varchar2(30) := name_in('system.cursor_block');
begin
if (form_name = 'DEMXXEOR' and block_name = 'ORDERS') then
return TRUE;
else
return FALSE;
end if;
end zoom_available;
*/
--
-- Real code starts here
--
begin
return FALSE;
end zoom_available;
2. 实际例子
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 = 'WIPDJMDF') then
return TRUE;
elsif (form_name = 'POXSCASL' and block_name = 'ASL_SUPPLIERS') then
return TRUE;
else
return FALSE;
end if;
end; --zoom_available;上段代码表示我们在form_name为:“WIPDJMDF”,“POXSCASL”的时候ZOOM按钮可用;
--然后在自己定义的pll文件中响应ZOOM按钮:
procedure event(event_name varchar2) is
form_name varchar2(30) := name_in('system.current_form');
block_name varchar2(30) := name_in('system.current_block');
item_name varchar2(30) := name_in('system.current_item');
form_status varchar2(30) := name_in('system.form_status');
l_record_status varchar2(30) := name_in('system.record_status');
v_stage varchar2(1000);
v_item_id number;
v_vendor_name varchar2(300);
begin/*when form instance*/
DEFAULT_VALUE(null,'GLOBAL.XXUTS_MFG_REVISION_MPN');
/*全局参数*/
if (event_name = 'ZOOM' and form_name = 'POXSCASL') then
v_item_id:=Name_In('ASL_ITEMS.ITEM_ID');
FND_FUNCTION.EXECUTE(/*调用另一Form*/
function_name=>'XXUTS_MFG_ITEM_REVISION',
other_params =>'INVENTORY_ITEM_ID ='||v_item_id);
end if;
if (form_name = 'POXSCASL') and (event_name = 'WHEN-NEW-ITEM-INSTANCE') then
if NAME_IN('GLOBAL.XXUTS_MFG_REVISION_MPN') is not null then
copy(name_in('global.XXUTS_MFG_REVISION_MPN'),'ASL_SUPPLIERS.PRIMARY_VENDOR_ITEM');
copy(null, 'global.XXUTS_MFG_REVISION_MPN');
end if;
end if;
end event;
3. 跳转Form Zoom按钮
Thanks and Regards
ERP技术讨论群: 288307890
技术交流,技术讨论,欢迎加入
Technology Blog Created By Oracle ERP - 鲍新建