How to Use Flexfields in Custom forms

Step 1: Create a FK Column
Step 2: Create a Flexfield hidden item

Step 3: Create a Flexfield display item

Step 4: Create the Flexfield definition
procedure initialize is cursor get_cao is select to_char(id_flex_num) from fnd_id_flex_structures where id_flex_structure_code = ‘ACCOUNTING_FLEXFIELD’ and id_flex_code = ‘GL#’; v_cao varchar2(1000); begin open get_cao; fetch get_cao into v_cao; if get_cao%notfound then v_cao := ‘101’; end if; close get_cao; app_standard.event(‘WHEN-NEW-FORM-INSTANCE’); fnd_key_flex.define( BLOCK=>’COMBO’, FIELD=>’ACCOUNT_FLEXFIELD’, APPL_SHORT_NAME=>’SQLGL’, CODE=>’GL#’, NUM=>v_cao, ID=>’CODE_COMBINATION_ID’, DESCRIPTION=>”, TITLE=>’____ Your nice user friendly title here _____’, VALIDATE=>’FULL’, QBE_IN=>’Y’, DERIVE_ALWAYS=>’Y’, updateable => ”, VRULE=>’\nSUMMARY_FLAG\nI\nAPPL=SQLGL;NAME=GL_NO_PARENT_SEGMENT_ALLOWED\nN’, where_clause => ‘summary_flag != ”Y”’, QUERY_SECURITY =>’Y’); end initialize;
Step 5: Code several event triggers
- WHEN-VALIDATE-ITEM
- WHEN-NEW-ITEM-INSTANCE
- POST-QUERY
- PRE-QUERY
- KEY-LISTVAL
Listing B: Event programming for the Flexfields.
WHEN-VALIDATE-ITEM if ( :system.mode = ‘NORMAL’ ) then fnd_flex.event( ‘WHEN-VALIDATE-ITEM’ ); end if;WHEN-NEW-ITEM-INSTANCE app_standard.event(‘WHEN-NEW-ITEM-INSTANCE’); fnd_flex.event(‘WHEN-NEW-ITEM-INSTANCE’ );POST-QUERY–Loads the flexfields (in our case, it populates–the concatenated field on execute query). FND_FLEX.EVENT(‘POST-QUERY’);PRE-QUERY–If you don’t do this, whatever query criteria you may enter in— the concatenated flex field, it is not taken into account. FND_FLEX.EVENT(‘PRE-QUERY’ );KEY-LISTVAL APP_STANDARD.EVENT(‘KEY-LISTVAL’); FND_FLEX.EVENT(‘KEY-LISTVAL’ );
Trackbacks & Pingbacks
[…] Learn how to use Custom Flexfields in Oracle Forms here. […]
Leave a Reply
Want to join the discussion?Feel free to contribute!