Descriptive Flex Field Sample Code

以Lot Entry中的两个DFF为例,一个是Maintain Lot Number DFF,另一个是Lot Attributes DFF


知道基表,查看对应DFF

SELECT * FROM FND_DESCRIPTIVE_FLEXS
WHERE application_table_name = 'MTL_LOT_NUMBERS';

FND_DESCRIPTIVE_FLEXS表中几个字段需要注意,

APPLICATION_TABLE_NAME:表明这个DFF是基于哪个表建立的

DESCRIPTIVE_FLEXFIELD_NAME:DFF的标识字符串,比如:“Lot Attributes”表示Lot Attributes DFF,“MTL_LOT_NUMBERS”表示Maintain Lot Number DFF

CONTEXT_COLUMN_NAME:DFF上下文存储字段,比如:Lot Attributes DFF使用LOT_ATTRIBUTE_CATEGORY作为上下文字段,Maintain Lot Number DFF使用ATTRIBUTE_CATEGORY作为上下文字段

CONCATENATED_SEGS_VIEW_NAME:DFF View,比如:Lot Attributes DFF使用MTL_LOT_NUMBERS1_DFV作为DFF View,Maintain Lot Number DFF使用MTL_LOT_NUMBERS_DFV作为DFF View。


注册DFF

DFF注册的代码一般写在When-New-Form-Instance或者WHEN-NEW-BLOCK-INSTANCE里

Maintain Lot Number DFF

FND_DESCR_FLEX.DEFINE(BLOCK =>'LOT_ENTRY',--Block

FIELD =>'LDF',--Block中的Field
APPL_SHORT_NAME =>'INV',

DESC_FLEX_NAME =>'MTL_LOT_NUMBERS');

MTL_LOT_NUMBERS为FND_DESCRIPTIVE_FLEXS表中的DESCRIPTIVE_FLEXFIELD_NAME字段值,这里MTL_LOT_NUMBERS表示"Maintain Lot Number" DFF


Lot Attributes DFF

fnd_descr_flex.define(BLOCK => 'LOT_ENTRY',
FIELD => 'DESC_FLEX',
appl_short_name => 'INV',
desc_flex_name => 'Lot Attributes');


Enable/Disable DFF

IF (contval > 1 OR gseg > 0) THEN
app_item_property.set_property('LOT_ENTRY.LDF', ENABLED, PROPERTY_ON);
FND_DESCR_FLEX.UPDATE_DEFINITION(BLOCK =>'LOT_ENTRY',
FIELD => 'LDF',
ENABLED =>'Y');
ELSE
app_item_property.set_property('LOT_ENTRY.LDF', ENABLED, PROPERTY_OFF);
FND_DESCR_FLEX.UPDATE_DEFINITION(BLOCK =>'LOT_ENTRY',
FIELD => 'LDF',
ENABLED =>'N');


Required

app_item_property.set_property('LOT_ENTRY.DESC_FLEX', required, property_on);

app_item_property.set_property('LOT_ENTRY.DESC_FLEX', required, property_off);


Read Only

fnd_descr_flex.update_definition(BLOCK => 'LOT_ENTRY', FIELD => 'LDF', read_only => 'Y');

fnd_descr_flex.update_definition(BLOCK => 'LOT_ENTRY', FIELD => 'LDF', read_only => 'N');


FND_DESCR_FLEX.UPDATE_DEFINITION Syntax

FND_DESCR_FLEX.UPDATE_DEFINITION(

/* Arguments that specify the flexfield location */

BLOCK=>'block_name',

FIELD=>'field_name',

/* Argument to enable or disable flexfield */

[ENABLED=>'{Y|N}',]

/* Other optional parameters */

[VDATE=>'date',]

[TITLE =>'Title',]

[AUTOPICK=>'{Y|N}',]

[USEDBFLDS=>'{Y|N}',]

[READ_ONLY=>'{Y|N}',]

[LOCK_FLAG=>'{Y|N}',]

[HELP=>'APPL=application_short_name;

TARGET=target_name',]

[CONTEXT_LIKE=>'WHERE_clause_fragment'}

);


转载请注明出处:http://blog.csdn.net/pan_tian/article/details/7840025

===EOF===

你可能感兴趣的:(script)