编译
-
form
cd $AU_TOP/forms/ZHS # 12.x frmcmp_batch Module=$CGL_TOP/forms/ZHS/CUXWOIPWOI.fmb Userid=apps/apps Module_Type=FORM output_file=$CGL_TOP/forms/ZHS/CUXWOIPWOI.fmx # 11i f60gen Module=$CGL_TOP/forms/ZHS/CGLGLXJEENT.fmb Userid=apps/casarp00 Module_Type=FORM Output_File=$CGL_TOP/forms/ZHS/CGLGLXJEENT.fmx
-
pll
# 12.x frmcmp_batch userid=apps/apps module=$AU_TOP/resource/INVLTENT.pll module_type=library # 11i f60gen userid=apps/casarp00 module=$AU_TOP/resource/CUSTOM.pll module_type=library
组件
LOV
移动事务处理-"任务"LOV
-- 1. 在Form级的WHEN-NEW-FORM-INSTANCE中调用了
wiptxsfm.event('WHEN-NEW-FORM-INSTANCE');
-- 2. 在wiptxsfm package中调用
wip_common.initialize_block(
p_block_name => MOVE_TRANSACTIONS.BLOCK_NAME,
p_field_profile => 'WIP_MOVE_TXNS_1ST_FIELD',
p_jobs_lov => 'WIPTXSFM_JOBS_LOV',
p_lines_lov => 'WIPTXSFM_LINES_LOV',
p_order_lines_lov => 'WIPTXSFM_ORDER_LINES_LOV');
-- 3. 在wip_common中调用
wip_common_initialize.initialize_block(
p_block_name => upper(p_block_name),
p_field_profile => p_field_profile,
p_jobs_lov => p_jobs_lov,
p_lines_lov => p_lines_lov,
p_order_lines_lov => p_order_lines_lov);
-- 4. 在wip_common_initialize中调用
wip_common_globals.set_value(
p_value => p_jobs_lov,
p_block => p_block_name,
p_index1 => wip_common_globals.JOBS_LOV);
-- 5. 在wip_common_globals中
PROCEDURE set_value(p_value IN VARCHAR2,
p_block IN VARCHAR2,
p_index1 IN NUMBER,
p_index2 IN NUMBER DEFAULT NULL) IS
x_rec_group VARCHAR2(30);
x_index number;
BEGIN
IF (p_index1 = old_rg) THEN
x_rec_group := get_group_char_cell(find_rg(p_block) ||
'.' || wip_common_value, p_index1) ||
'.' || wip_common_value;
x_index := p_index2;
ELSE
x_rec_group := find_rg(p_block) || '.' ||
wip_common_value;
x_index := p_index1;
END IF;
set_group_char_cell(x_rec_group, x_index, p_value);
END set_value;
-- <http://www.itpub.net/thread-338959-1-1.html>
自动跳离
Folder
-
定义(WHEN-NEW-FORM-INSTANCE)
app_folder.define_folder_block(object_name => 'CUX_FOLDER', folder_block_name => 'CUX_FOLDER', prompt_block_name => 'CUX_PROMPT', folder_canvas_name => 'CUX_STACKED', folder_window_name => 'CUX_FOLDER', disabled_functions => '', tab_canvas_name => '', fixed_canvas_name => ''); app_folder.event('INSTANTIATE'); SYNCHRONIZE;
Flex
-- 说明性弹性域
fnd_descr_flex.define(BLOCK => 'HEADER'
,field => 'DF'
,appl_short_name => 'CGL'
,desc_flex_name => 'CUX_IMP_IFACE_SYSTEM_DEF');
-- 键弹性域
fnd_key_flex.define(BLOCK => 'CUX_GL_JE_LINES'
,field => 'ACCOUNT_DSP'
,appl_short_name => 'SQLGL'
,code => 'GL#'
,num => ':PARAMETER.CHART_OF_ACCOUNTS_ID'
,id => 'CODE_COMBINATION_ID'
,description => 'ACCOUNT_DESCRIPTION'
,validate => 'FULL'
,updateable => 'ALL'
,insertable => 'ALL'
,displayable => 'ALL'
,longlist => 'YES' required => 'Y'
,vrule => '\\nSUMMARY_FLAG\\nI\\nAPPL=SQLGL;NAME=GL_NO_PARENT_SEGMENT_ALLOWED\\nN',
where_clause => 'category_id IN (SELECT fcb.category_id
FROM fa_category_books fcb
WHERE fcb.book_type_code = :MAIN.BOOK_TYPE_CODE)',
WHERE_CLAUSE_MSG =>'APPL=CUX;NAME=FA-MSG-0026');
日历
-- 范围设置
calendar.setup('WEEKEND') -- 禁止选择周末
calendar.setup(<30l name>, <low_date>, <high_date>); -- 禁止选择某一日期段,可重复使用
calendar.setup(<30l name>, null, null, <SQL>); -- 禁止选择SQL提取出的日期清单
FORM日期格式显示,通过一个标准的配置文件控制的
登录首选项都是配置文件,只不过是通过界面展现
窗口
--1. 打开/关闭
app_custom.open_window(window_name)
app_custom.close_window(window_name)
-- 2. 位置
app_window.set_window_position(SUB_WINDOW, POSITION, PARENT_WINDOW)
/*POSITION: CASCADE, //多个窗口从坐上向右下排列
RIGHT, //子窗口在父窗口右边,且父窗口不会覆盖子窗口
BELOW, //子窗口在父窗口下边,且父窗口不会覆盖子窗口
OVERLAP, //子窗口与父窗口重叠,对其父窗口左边,但向下位移0.3
CENTER //子窗口在父窗口中间显示R
FIRST_WINDOW //显示在toolbar下方,通常为主窗口
*/
-- 3. 标题
app_window.set_title(WINDOW_NAME, TITLE)
List
-
删除空白行
CTRL + SHIFT + < (小于号)
Timer
-- 设置触发器
PROCEDURE filtered_subinv(event IN VARCHAR2) IS
l_timer_id timer;
BEGIN
IF event = 'WHEN-VALIDATE-ITEM' THEN
--设置计时器选择之后跳转DOC_LINES块执行查询
l_timer_id := find_timer('FILTERED_SUBINV');
IF id_null(l_timer_id) THEN
l_timer_id := create_timer('FILTERED_SUBINV', 500, no_repeat);
synchronize;
ELSE
set_timer(l_timer_id, 500, no_repeat);
synchronize;
END IF;
ELSE
app_exception.invalid_argument('DOC_HEADERS', 'FILTERED_SUBINV', event);
END IF;
END filtered_subinv;
-- FORM级触发器 WHEN-TIMER-EXPIRED,捕捉触发器
DECLARE
l_timer_name VARCHAR2(240);
l_commit BOOLEAN;
BEGIN
l_timer_name := get_application_property(timer_name);
IF l_timer_name = 'OPERATION_SEQ_NUM' THEN
l_commit := app_form.quietcommit;
go_block('DOC_LINES');
execute_query;
END IF;
END;
JavaBean
WebUtil配置
-
@$ORALCE_HOME/forms/create_webutil_db.sql
-
将WEBUTIL的pll库文件拷贝到$AU_TOP/resource 并编译pll
webutil.olb
webutil.pll
frmcmp_batch Module_Type=LIBRARY Module=$AU_TOP/resource/webutil.pll Userid=apps/apps -
复制frmwebutil.jar到$JAVA_TOP/webutil
cp $ORACLE_HOME/forms/java/frmwebutil.jar $JAVA_TOP/webutil
-
修改模板文件forms_web_1012_cfg.tmp:
$ cd $FND_TOP/admin/template
$ cp forms_web_1012_cfg.tmp custom/
"archive1=,/OA_JAVA/oracle/apps/fnd/jar/fndlist.jar"一行后面添加",/OA_JAVA/webutil/frmwebutil.jar" -
执行autoconfig
-
重启应用
签名
# Windows端开发编译
set CLASS_PATH=%CLASS_PATH%C:\Programs\DevSuiteHome\forms\java\frmall.jar;
C:\Programs\java\jdk1.6.0_45\bin\javac -classpath %CLASS_PATH% dfscn\forms\print\PrintToPrinter.java
C:\Programs\java\jdk1.6.0_45\bin\jar cvf dfscnclientprint.jar dfscn\forms\print\PrintToPrinter.class
#EBS APP Server
export PATH=$ORACLE_HOME/bin:$PATH
$ORACLE_HOME/forms/webutil/sign_webutil.sh dfscnclientprint.jar
# sign_webutil.sh会添加key到$HOME/.keysotre,若忘记密码,可更换此脚本中的store名字
错误
ClassNotFound
Exception in thread "AWT-EventQueue-7" java.lang.NoClassDefFoundError: FormJavaBeanTest (wrong name: oracle/forms/fd/FormJavaBeanTest)
at java.lang.ClassLoader.defineClass1(Native Method)...临时修改方法:
修改$FORMS_WEB_CONFIG, 在archive1/2/3任一行最后添加开发的java路径(相对于$JAVA_TOP).永久方法:
参考WebUtil修改forms_web_1012_cfg.tmp
SecurityException
java.lang.SecurityException: trusted loader attempted to load sandboxed resource from http://pch-erp.doverfs.com/OA_JAVA/webutil/formjavabeantest.jar
签名客制化java
零散功能点
遍历
GO_BLOCK('BLOCK_NAME');
LAST_RECORD;
FIRST_RECORD;
LOOP
EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
BALABALA;
NEXT_RECORD;
END LOOP;
保存
-- 无提示提交
app_form.quietcommit -- (返回 boolean)
功能
-- 调用请求界面
FND_FUNCTION.EXECUTE(FUNCTION_NAME => 'FND_FNDRSRUN',
OPEN_FLAG => 'Y',
SESSION_FLAG => 'Y',
OTHER_PARAMS => 'DODT_REQ_ID="' || TO_CHAR(ln_request_id)|| '"');
-
建立快码功能(限制只能取一种快码)
- 表单:定义代码
- 参数:VIEW_APPLICATION="AU" LOOKUP_TYPE="CUX_OM_COMPANY_CONTRAST"
-
建立请求功能
- 表单:Run Reports
- 参数:CONCURRENT_PROGRAM_NAME="ARITXI" PROGRAM_APPL_SHORT_NAME="AR" TITLE="AR:AR_SRS_TITLE_TAX_INTERFACE"
失效菜单图标
失效保存按钮
1.在WHEN-NEW-FORM-INSTANCE中加入
set_menu_item_property('FILE.SAVE', enabled, property_off);
如果想在保存按钮失效后保存记录,可以在自己设计的按钮触发器中写DO_KEY('COMMIT_FORM');
注意:请失效保存快捷键Ctrl+S
KEY-COMMIT
NULL;
2.与此类似的还有。
set_menu_item_property('Edit.delete', enabled, property_off); 失效"Deletes Recode"
set_menu_item_property('Edit.Clear', enabled, property_off); 失效"Clear Recode"
3.也可以隐藏掉
set_menu_item_property('Edit.delete', displayed, property_off);
set_menu_item_property('FILE.NEW', displayed, property_off);
列举:
set_menu_item_property('FILE.NEW', ENABLED, PROPERTY_OFF);
set_menu_item_property('FILE.SAVE', ENABLED, PROPERTY_OFF);
set_menu_item_property('FILE.ACCEPT', ENABLED, PROPERTY_OFF);
set_menu_item_property('FILE.SAVE_AND_ADVANCE', ENABLED, PROPERTY_OFF);
set_menu_item_property('FILE.SMARTBAR_SHOW_NAVIGATOR', ENABLED, PROPERTY_OFF);
set_menu_item_property('FILE.SMARTBAR_FIND', ENABLED, PROPERTY_OFF);
set_menu_item_property('FILE.EXPORT', ENABLED, PROPERTY_OFF);
set_menu_item_property('FILE.CLOSE_FORM', ENABLED, PROPERTY_OFF);
set_menu_item_property('EDIT.UNDO_TYPING', ENABLED, PROPERTY_OFF);
set_menu_item_property('EDIT.DUPLICATE', ENABLED, PROPERTY_OFF);
set_menu_item_property('EDIT.CLEAR', ENABLED, PROPERTY_OFF);
set_menu_item_property('EDIT.DELETE', ENABLED, PROPERTY_OFF);
set_menu_item_property('EDIT.EDIT_FIELD', ENABLED, PROPERTY_OFF);
set_menu_item_property('VIEW.SHOW_NAVIGATOR', ENABLED, PROPERTY_OFF);
set_menu_item_property('VIEW.ZOOM', ENABLED, PROPERTY_OFF);
set_menu_item_property('VIEW.FIND', ENABLED, PROPERTY_OFF);
set_menu_item_property('VIEW.FIND_ALL', ENABLED, PROPERTY_OFF);
set_menu_item_property('VIEW.QUERY', ENABLED, PROPERTY_OFF);
set_menu_item_property('VIEW.RECORD', ENABLED, PROPERTY_OFF);
set_menu_item_property('VIEW.ATTACHMENTS', ENABLED, PROPERTY_OFF);
set_menu_item_property('FNDMENU.FOLDER', ENABLED, PROPERTY_OFF);
set_menu_item_property('HELP.DIAGNOSTICS', ENABLED, PROPERTY_OFF);
set_menu_item_property('HELP.RECORD_HISTORY', ENABLED, PROPERTY_OFF);
set_menu_item_property('PROPERTIES_MENU.FOLDER', ENABLED, PROPERTY_OFF);
set_menu_item_property('FILE.SWITCH_RESPONSIBILITY', ENABLED, PROPERTY_OFF);
set_menu_item_property('FILE.CHANGE_LOG_ON', ENABLED, PROPERTY_OFF);
set_menu_item_property('FNDMENU.VIEW', ENABLED, PROPERTY_OFF);
set_menu_item_property('FNDMENU.SPECIAL', ENABLED, PROPERTY_OFF);
set_menu_item_property('FNDMENU.EDIT', ENABLED, PROPERTY_OFF);
set_menu_item_property('FNDMENU.VIEW', ENABLED, PROPERTY_ON);
set_menu_item_property('FNDMENU.EDIT', ENABLED, PROPERTY_ON);
set_menu_item_property('EDIT.CUT', visible, property_false);
set_menu_item_property('EDIT.APPTREE_CUT', visible, property_true);
set_menu_item_property('EDIT.COPY', visible, property_false);
set_menu_item_property('EDIT.APPTREE_COPY', visible, property_true);
set_menu_item_property('EDIT.PASTE', visible, property_false);
set_menu_item_property('EDIT.APPTREE_PASTE', visible, property_true);
set_menu_item_property('EDIT.CUT', visible, property_true);
set_menu_item_property('EDIT.APPTREE_COPY', visible, property_false);
set_menu_item_property('EDIT.COPY', visible, property_true);
set_menu_item_property('EDIT.APPTREE_PASTE', visible, property_false);
set_menu_item_property('EDIT.PASTE', visible, property_true);
调出库存组织选择
-- 1. parameter中加上CHART_OF_ACCOUNTS_ID, ORG_NAME,ORG_CODE,ORG_ID
-- 2. PRE-FORM中加入:
FND_ORG.CHOOSE_ORG;
查询
添加条件
-- 触发器 QUERY_FIND(加在查询结果BLOCK, 控制手电筒显示界面)
APP_FIND.QUERY_FIND(<results block window>, <Find window>, <Findwindow block>);
-- 查询块:允许查询:yes
-- 添加查询条件
app_query.reset('BLOCK_NAME');
app_query.append('BLOCK_NAME', user_where_clause);
-- (用 app_query.append时候,where语句里面字节必须 <= 2000,当大于这个字节数就会发生溢出)
-- 添加范围条件
app_find.query_date_range(value_from, value_to, dest_item);
app_find.query_range(value_from, value_to, dest_item);
禁用F11查询
- BLOCK级触发器KEY-ENTQRY、KEY-EXEQRY置为空
块操作
清除块
CLEAR_BLOCK(PAR)
功能:
该内置子程序用于清空当前数据块中的所有记录
类型:
受限过程
参数:
ask_commit:提示用户提交数据
do_commit:校验并提交数据
no_commit:校验数据、清空当前数据块,但是不提交数据,也不提示用户。
no_validate:直接清空当前数据块,但是不对数据进行校验和提交,也不提示用户
消息
-- 1. Question
FND_MESSAGE.question
FUNCTION question(button1 IN VARCHAR2 DEFAULT 'YES',
button2 IN VARCHAR2 DEFAULT 'NO',
button3 IN VARCHAR2 DEFAULT 'CANCEL',
default_btn IN NUMBER DEFAULT 1,
cancel_btn IN NUMBER DEFAULT 3,
icon IN VARCHAR2 DEFAULT 'question') RETURN NUMBER;
-- 2. Warn
FND_MESSAGE.SET_STRING('未输入单据号,请确定是否保存');
IF NOT FND_MESSAGE.WARN THEN
RAISE FORM_TRIGGER_FAILURE;
END IF;
-- 3. 通用空消息
FND_GENERIC_MESSAGE
-- 4. 设置消息
fnd_message.set_name('FND', 'FND_GENERIC_MESSAGE');
fnd_message.set_token(...);
属性设置
金额:FM99G999G999G999G999G990D00
-- 关联参数自动清除(WHEN-VALIDATE-ITEM)
app_field.clear_dependent_fields('QUERY_FIND.ORG_NAME','QUERY_FIND.ORG_ID');
-- 实现:如果master_field为空,则清空后续所有fieldn
app_field.clear_dependent_fields(master_field VARCHAR2,
field1 VARCHAR2,
field2 VARCHAR2 DEFAULT NULL,
field3 VARCHAR2 DEFAULT NULL,
field4 VARCHAR2 DEFAULT NULL,
field5 VARCHAR2 DEFAULT NULL,
field6 VARCHAR2 DEFAULT NULL,
field7 VARCHAR2 DEFAULT NULL,
field8 VARCHAR2 DEFAULT NULL,
field9 VARCHAR2 DEFAULT NULL,
field10 VARCHAR2 DEFAULT NULL);
-- 设置FOLDER距窗口右边框距离
-- 添加自定义块触发器 FOLDER_RETURN_ACTION
DECLARE
l_win_width NUMBER;
BEGIN
IF :global.folder_action = 'VIEW-SIZE' THEN
l_win_width := GET_WINDOW_PROPERTY('MAIN', WIDTH);
:global.folder_view_size_margin := l_win_width - 4.6;
END IF;
END;
-- 无效参数报错
app_exception.invalid_argument('CUXINVDLBL', 'event_handler', event);
历史记录
启用:app_standard.event('WHEN-NEW-BLOCK-INSTANCE');
提示音
begin
bell;
synchronize;
dbms_lock.sleep(0.5);
bell;
synchronize;
end;
诊断
Please kindly replicate the issue
issue and collect
- Enable FRD log
=====How to get FRD log=====
1. Login to your Instance .
2. Copy the value for the profile 'ICX: Forms Launcher' from Site level.
3. Append the copied value with the "?record=collect" and paste it at the user level field.
(Eg):http://celalnx20.us.oracle.com:10106/forms/frmservlet?record=collect
4. Logout and Log back in again, for this profile to take effect. When you login again, a message box pops up, which alerts you that Diagnostics is enabled.
5. Go to Help->About Oracle Applications, go to the section 'Forms Server Environment Variables'
There you should see a value in FORMS_TRACE_DIR. Note down the value.
6. Reproduce the Issue.
7. Now you get the FRD trace from the file located in the directory noted in FORMS_TRACE_DIR.
Note: By default, this directories named as forms_<pid>.trc where pid is the process identifier.
Collect_<form_process_id>
- Enable FND Log
====How to get fnd log====
#1. Run the query:
select max(log_sequence) from fnd_log_messages;
Note this log_seq.
#2. Set the following profiles at the user level:
FND: Debug Log Enabled = YES
FND: Debug Log Filename = NULL
FND: Debug Log Level = STATEMENT
FND: Debug Log Module = %
#3. reproduce the test case.
#4. run the following sql:
select * from fnd_log_messages
where log_sequence > &log_seq_noted_above
order by log_sequence;
#5.Upload the data in an xls file.
- Please have customer collect a new FRD log after ensuring no custom code is involved (disable it if needed) and by setting Menu > Help > Diagnostics > Custom code > Core code only
- Replicate and collect step-by-step screenshots
- Upload screenshots, FRD Log, FND log here.
个性化
内置-执行过程
-
调用的参数不可为空
-
当调用的程序参数为定值(不是引用的界面字段值),可以直接填写,不带等号,如:
当传递的参数需要引用变量时,使用单引号包含(先在plsql中输出变元的值, 格式为正确的程序调用即可), 如:
内置-调用自定义程序库
调用的是CUSTOM.pll,程序event,参数event_name传递的值是 变元
局部变量
值引用:${VAR.PAR_NAME}
遇见错误
FRM-99999
发生1412错误,有关错误的详细请参阅版本信息文件
原因:FOLDER主块上没有设滚动条
CTR+F11无结果,无报错
CREATE VIEW XX_NAME AS
SELECT 1 id
,NULL NAME
FROM dual;
原因:以视图XX_NAME作为form的数据来源,'NAME'所对应的的字段在FORM BUILDER中数据长度会被默认为长度0,这会导致执行查询的时候没有任何数据返回
从这个可以看出如果某个字段以NULL来作为默认值需要注意长度为0,必须手动在form builder中修改该字段的长度为大于0的值
ORA-00918
明确定义列 FRM-40502 不能读取值列表
原因:Lov的Filter Before Display(选择前过滤)设置为Y,且这个lov使用的record group的SQL中用了别名. 因为Filter Before Display设置为Y的话,它会以 where 原列名 like %% 去筛选。distinct也是不行。
可以在原SQL外嵌套一层select
ORA-01446
无法使用DISTINCT,GROUP_BY等子句从视图中选择ROWID或采样
ORA-01445:无法从不带保留关键字的表的联接视图中选择ROWID或采样
原因:数据块补足ON_INSERT、ON_UPDATE、ON_LOCK、ON_DELETE触发器
ROS ERROR: -200
Segmentation fault
原因:高版本form builder中开发的fmb文件,在低版本EBS中无法编译
Value Entered Is Not Valid
Error - Value Entered Is Not Valid For Current Field. Please reenter
返回的字段类型不一致,如返回字符串,接收字段却是Number类型
Frm-40831
报错:Truncation occured: value too long for field <>
背景:使用app_find.query_range设置查询范围。查看last_query发现值被截断
解决方法:增大查询目标字段的长度(2~3倍)
FRM-32086
编译报错:Bind Variable :PARAMETER.XXX parse failed at
1) Make a copy of the form.
2) Open the original form.
3) Remove all program units (be careful in case there are some object groups or subclassed objects that could be dependent on other Program Units or Parameters)
4) Remove the parameter or coding change that is causing the problem.
5) VERY IMPORTANT: Save and close the form without compiling or generating. Without saving and closing the form, the problem persists.
6) Open the original form and the copy. Copy all program units from copy to original (drag the entire 'program units' from the copy and drop on original form).
7) Save the form and compile.
开发小技巧
非法操作GO_BLOCK
-- 在POST-QUERY、WHEN-NEW-RECORD-INSTANCE等触发器中,不可使用GO_BLOCK、GO_ITEM等内置功能,可设置定时器来触发。
-- 详细使用方法参考Timer一节
FRM错误拦截
-- 当查询无结果时,不想弹出错误消息框FRM-40350,可在FROM级触发器ON-MESSAGE做拦截
IF MESSAGE_CODE = 40350 AND :system.trigger_block = 'HEADER' THEN
fnd_message.set_string((MESSAGE_TYPE || '-' || MESSAGE_CODE || ':' || MESSAGE_TEXT));
fnd_message.hint;
END IF;
头行-头未保存,行不可查
-- 设置了主从关系,头为新建时,行数据自动初始化,此时因为头未保存,行不会自动查询出数据。
-- 方法:取消主从关系,在头WHEN-NEW-RECORD-INSTANCE触发器中,添加定时器来查询行块
按钮不可置自身状态
-- 某个按钮操作后,需要失效自身,直接操作会失败。
-- 方法:重新查询块,触发状态变更
其他
-
6i 版本下载
Patch 2798050(Metalink)
-
工具--关闭其它表单