Putting a Descriptive Flexfield
in a Form
1. Created a package in Program
Units called FLEXFIELDS:
PACKAGE FLEXFIELDS IS
PROCEDURE Define(p_insert
in varchar2, p_update in varchar2, p_read_only in varchar2);
PROCEDURE Define_dff_for_quotation_tab(p_insert
in varchar2, p_update in varchar2, p_read_only in varchar2);
PROCEDURE Define_dff_item_master(p_insert
in varchar2, p_update in varchar2, p_read_only in varchar2);
PROCEDURE Define_dff_item_master_org(p_insert
in varchar2, p_update in varchar2, p_read_only in varchar2);
END;
Package Body: (I purposely
left my commented code in so you can see what else can be added):
PACKAGE BODY FLEXFIELDS IS
PROCEDURE Define(p_insert in VARCHAR2,
p_update in VARCHAR2, p_read_only in VARCHAR2) IS
BEGIN
FND_DESCR_FLEX.DEFINE(block
=> 'QP_LIST_LINES_V',
field => 'DF',
appl_short_name => 'QP',
DESC_FLEX_NAME => 'QP_LIST_LINES'
--
,
--
code => 'COST',
--
num => Structure_Number,
--
description => 'DESC_FLEX_DESCRIPTION',
--
id => 'COST_ALLOCATION_KEYFLEX_ID',
--
data_field => 'CONCATENATED_SEGMENTS',
--
validate =>'FULL',
--
vdate => to_char(sysdate),
--
required => 'Y',
--
allownulls => 'N',
-- usedbflds => 'Y',
--
query_security => 'N',
--
where_clause => 'summary_flag != ''Y''',
--
insertable=>p_insert,
--
updateable=>p_update,
-- displayable=>'ALL\\09\\010\\011',
--
title=>'Additional Info for List Lines'
);
END;
PROCEDURE Define_dff_for_quotation_tab(p_insert
in VARCHAR2,
p_update in VARCHAR2,
p_read_only in VARCHAR2)
IS
BEGIN
FND_DESCR_FLEX.DEFINE(block
=> 'SUPPLIER_QUOTATION',
field => 'DF',
appl_short_name => 'PO',
DESC_FLEX_NAME => 'PO_LINES');
END;
PROCEDURE Define_dff_item_master(p_insert
in VARCHAR2,
p_update in
VARCHAR2,
p_read_only
in VARCHAR2) IS
BEGIN
FND_DESCR_FLEX.DEFINE(BLOCK=>'ITEM_FLEXFIELDS_GLO',
FIELD=>'DF',
APPL_SHORT_NAME=>'INV',
DESC_FLEX_NAME=>'MTL_SYSTEM_ITEMS'
);
END;
PROCEDURE Define_dff_item_master_org(p_insert
in VARCHAR2,
p_update in VARCHAR2,
p_read_only in VARCHAR2) IS
BEGIN
FND_DESCR_FLEX.DEFINE(BLOCK=>'ITEM_FLEXFIELDS_ORG',
FIELD=>'DF',
APPL_SHORT_NAME=>'INV',
DESC_FLEX_NAME=>'MTL_SYSTEM_ITEMS'
);
END;
END;
2. Added this code to form level
WHEN-NEW-FORM-INSTANCE trigger:
DECLARE
f_insert VARCHAR2(80);
f_update VARCHAR2(80);
f_read_only VARCHAR2(80);
BEGIN
f_insert := '';
f_update := '';
f_read_only := 'N';
flexfields.define(f_insert, f_update,
f_read_only);
flexfields.Define_dff_for_quotation_tab(f_insert,
f_update, f_read_only);
flexfields.Define_dff_item_master(f_insert,
f_update, f_read_only);
flexfields.Define_dff_item_master_org(f_insert,
f_update, f_read_only);
END;
3. Now the blocks and fields have
to match what you set up in your procedures.
Example – the last procedure from
above shows:
BEGIN
FND_DESCR_FLEX.DEFINE(BLOCK=>'ITEM_FLEXFIELDS_ORG',
FIELD=>'DF',
APPL_SHORT_NAME=>'INV',
DESC_FLEX_NAME=>'MTL_SYSTEM_ITEMS' (etc., etc.)
So In your data block, ITEM_FLEXFIELDS_ORG,
you have to have a field called DF. Add The following trigger to
this item:
WHEN-VALIDATE-ITEM (containing
this code à fnd_flex.event('WHEN-VALIDATE-ITEM');)
WHEN-NEW-ITEM-INSTANCE (containing
this code à fnd_flex.event('WHEN-NEW-ITEM-INSTANCE);)
4. Make the “DF” Item in your Data
Block(s) visible on appropriate canvas/tab page.
With Compliments from: Matt
Kelly
Have a Oracle Question
Do
you have an Oracle Question?
Oracle Books
Oracle
Certification, Database Administration, SQL, Application, Programming Reference
Books
Oracle Application
Oracle
Application Hints and Tips
Oracle Home
Oracle
Database, SQL, Application, Programming Tips
All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
All product names are trademarks of their respective
companies.
The site www.erpgreat.com is not affiliated with or endorsed
by any company listed at this site.
Every effort is made to ensure the content integrity.
Information used on this site is at your own risk.
The content on this site may not be reproduced
or redistributed without the express written permission of
www.erpgreat.com or the content authors.
|