键弹性域的开发例子:
/***************************在客户化的用户下*******************************/
/* 键应用表 */
create table hek_om_pop_validity_all(
line_id number,
inventory_item_id number,
number_of_day number,
start_date date,
end_date date,
--=================扩展字段================================
created_by number,
creation_date date,
last_updated_by number,
last_update_date date,
last_update_login number,
org_id number,
attribute_category varchar2(30),
attribute1 varchar2(50),
attribute2 varchar2(50),
attribute3 varchar2(50),
attribute4 varchar2(150),
attribute5 varchar2(150)
);
/* 创建存放键弹性域的结构表 */
CREATE TABLE FLEX_LN_KEY
(
KEY_FLEX_STRUCTURE_ID NUMBER ,
KEY_FLEX_ID NUMBER ,
SUMMARY_FLAG VARCHAR2(1) , /* 必须有此字段 */
ENABLED_FLAG VARCHAR2(1) , /* 必须有此字段 */
START_DATE_ACTIVE DATE , /* 必须有此字段 */
END_DATE_ACTIVE DATE , /* 必须有此字段 */
LAST_UPDATED_BY NUMBER , /* 必须有此字段 */
LAST_UPDATE_DATE DATE , /* 必须有此字段 */
SEGMENT1 VARCHAR2(30) ,
SEGMENT2 VARCHAR2(30) ,
SEGMENT3 VARCHAR2(30) ,
SEGMENT4 VARCHAR2(30) ,
SEGMENT5 VARCHAR2(30) ,
SEGMENT6 VARCHAR2(30) ,
SEGMENT7 VARCHAR2(30) ,
SEGMENT8 VARCHAR2(30) ,
SEGMENT9 VARCHAR2(30) ,
SEGMENT10 VARCHAR2(30) ,
SEGMENT11 VARCHAR2(30) ,
SEGMENT12 VARCHAR2(30) ,
SEGMENT13 VARCHAR2(30) ,
SEGMENT14 VARCHAR2(30) ,
SEGMENT15 VARCHAR2(30)
);
/* 必须要创建一个与键结构表对应的序列 */
CREATE SEQUENCE FLEX_LN_KEY_S START WITH 1; --创建存放键弹性域表的对应序列(键弹性域表名+"_S")
grant all on T_KEY_FLEX to apps;
grant all on FLEX_LN_KEY to apps;
grant all on flex_ln_key_s to apps;
/***************************在公共用户APPS下*******************************/
conn apps/apps
/* 创建同义词 */
CREATE SYNONYM FLEX_LN_KEY FOR HEKFLEX_LN_KEY ;
CREATE SYNONYM FLEX_LN_KEY_S FOR HEK.FLEX_LN_KEY_S;
/* 注册键结构表和字段 */
BEGIN
ad_dd.register_table('HEK', 'FLEX_LN_KEY', 'T');
ad_dd.register_column('HEK', 'FLEX_LN_KEY', 'KEY_FLEX_STRUCTURE_ID', 1, 'NUMBER', 38, 'Y','N' );
ad_dd.register_column('HEK', 'FLEX_LN_KEY', 'KEY_FLEX_ID', 2, 'NUMBER', 38, 'Y', 'N' );
ad_dd.register_column('HEK', 'FLEX_LN_KEY', 'SEGMENT1', 3, 'VARCHAR2', 30, 'Y', 'N' );
ad_dd.register_column('HEK', 'FLEX_LN_KEY', 'SEGMENT2', 4, 'VARCHAR2', 30, 'Y', 'N' );
ad_dd.register_column('HEK', 'FLEX_LN_KEY', 'SEGMENT3', 5, 'VARCHAR2', 30, 'Y', 'N' );
ad_dd.register_column('HEK', 'FLEX_LN_KEY', 'SEGMENT4', 6, 'VARCHAR2', 30, 'Y', 'N' );
ad_dd.register_column('HEK', 'FLEX_LN_KEY', 'SEGMENT5', 7, 'VARCHAR2', 30, 'Y', 'N' );
ad_dd.register_column('HEK', 'FLEX_LN_KEY', 'SEGMENT6', 8, 'VARCHAR2', 30, 'Y', 'N' );
ad_dd.register_column('HEK', 'FLEX_LN_KEY', 'SEGMENT7', 9, 'VARCHAR2', 30, 'Y', 'N' );
ad_dd.register_column('HEK', 'FLEX_LN_KEY', 'SEGMENT8', 10, 'VARCHAR2', 30, 'Y', 'N' );
ad_dd.register_column('HEK', 'FLEX_LN_KEY', 'SEGMENT9', 11, 'VARCHAR2', 30, 'Y', 'N' );
ad_dd.register_column('HEK', 'FLEX_LN_KEY', 'SEGMENT10',12, 'VARCHAR2', 30, 'Y', 'N' );
ad_dd.register_column('HEK', 'FLEX_LN_KEY', 'SEGMENT11', 13, 'VARCHAR2', 30, 'Y','N' );
ad_dd.register_column('HEK', 'FLEX_LN_KEY', 'SEGMENT12', 14, 'VARCHAR2', 30, 'Y','N' );
ad_dd.register_column('HEK', 'FLEX_LN_KEY', 'SEGMENT13', 15, 'VARCHAR2', 30, 'Y','N' );
ad_dd.register_column('HEK', 'FLEX_LN_KEY', 'SEGMENT14', 16, 'VARCHAR2', 30, 'Y','N' );
ad_dd.register_column('HEK', 'FLEX_LN_KEY', 'SEGMENT15',17, 'VARCHAR2', 30, 'Y', 'N' );
COMMIT;
END;
FORM的PRE-FORM:
FND_KEY_FLEX.DEFINE (
BLOCK => 'HEK_OM_POP_VALIDITY_V', -- 操作的BLOCK
FIELD => 'KEY_FLEXITEM', -- 创建的ITEM,用来容纳键弹性域
ID => 'LINE_ID', --保存KEY弹性域的唯一值(block的表)
APPL_SHORT_NAME => 'HEK',
CODE => 'TEST', -- 键弹性域的注册代码 fnd_id_flex_structures.id_flex_code
NUM => '101' --fnd_id_flex_structures.id_flex_num
);
KEY_FLEXITEM属性:itemclass - TEST_ITEM, LOV选择ENABLE_LIST_LAMP,检查有效性否。
分别在BLOCK级别加入如下的触发器(可参考说明性弹性域的应用代码).
PRE-QUERY
PRE-UPDATE
PRE-INSERT
POST-QUERY
WHEN-NEW-ITEM-INSTANCE
WHEN-VALIDATE-ITEM
WHEN-VALIDATE-RECORD
其触发器的代码分别对应
FND_FLEX.EVENT('PRE-QUERY ');
FND_FLEX.EVENT('PRE-UPDATE ');
FND_FLEX.EVENT('PRE-INSERT ');
FND_FLEX.EVENT('POST-QUERY ');
FND_FLEX.EVENT('WHEN-NEW-ITEM-INSTANCE');
FND_FLEX.EVENT('WHEN-VALIDATE-ITEM');
FND_FLEX.EVENT('WHEN-VALIDATE-RECORD');
注册键弹性域
应用:选择注册的应用
代码:填写注册键弹性域的CODE(必须唯一,最多四个字符,在调用键弹性域必须使用的值)
标题:键弹性域的标题,在今后的应用中,此键弹性域将会在窗口标题上显示在此定义的标题内容
说明:
表应用:在注册表,列时指定的应用(appl_short_name)
表名: 选择注册的表名称
结构列:必须也是存在于注册过的列,结构列的意义就是存放键弹性域使用的是哪个段结构的代码
唯一标识列:是记录键弹性域唯一的值,要找到健弹性域的具体含义,必须通过此唯一标识列
定义键弹性域的段结构
备注说明:
/******************
键弹性域的数据字典
******************/
SELECT * FROM FND_ID_FLEXS where id_flex_code='TEST';
SELECT * FROM FND_ID_FLEX_SEGMENTS_TL where id_flex_code='TEST';
SELECT * FROM FND_ID_FLEX_SEGMENTS WHERE id_flex_code='TEST';
SELECT * FROM Fnd_Id_Flex_Structures where id_flex_code='TEST';
SELECT * FROM FND_ID_FLEX_STRUCTURES_TL where id_flex_code='TEST';
/*************************
完全删除键弹性域的语法
*************************/
--删除键弹性域的结构段
DELETE FND_ID_FLEX_SEGMENTS_VL WHERE ID_FLEX_CODE = ?;
--删除键弹性域的结构
DELETE FND_ID_FLEX_STRUCTURES_VL WHERE ID_FLEX_CODE = ?;
--删除键弹性注册
DELETE FND_ID_FLEXS WHERE ID_FLEX_CODE = ?;
效果:
-----------------------------------------------------------------------------------
补充:
PRE-FORM
--会计科目
SELECT chart_of_accounts_id
INTO :parameter.chart_of_accounts_id
FROM org_organization_definitions
WHERE organization_id = :parameter.org_id;
FND_KEY_FLEX.DEFINE(BLOCK=>'CUX_INV_BCP_GANOH',
FIELD=>'TO_ACCOUNT',
ID=>'TO_ACCOUNT_ID',
APPL_SHORT_NAME=>'SQLGL',
CODE=>'GL#',
NUM=>':PARAMETER.CHART_OF_ACCOUNTS_ID',
VRULE=> '\\nSUMMARY_FLAG\\nI\\nAPPL=SQLGL;NAME=GL_NO_PARENT_SEGMENT_ALLOWED\\nN\\0GL_GLOBAL\\nDETAIL_POSTING_ALLOWED\\nE\\nAPPL=INV;NAME=INV_VRULE_POSTING\\nN',
USEDBFLDS=> 'N',
VALIDATE=>'FULL',
REQUIRED=>'N');
FND_KEY_FLEX.UPDATE_DEFINITION(BLOCK=>'CUX_INV_BCP_GANOH',
FIELD=>'TO_ACCOUNT',
ENABLED=>'N');
来源:https://www.cnblogs.com/benio/archive/2009/12/08/1619452.html