- OracleApps Epicenter - http://www.oracleappshub.com -

How to use Key Flex Fields (KFF) in forms

These are the steps required to implement KFF in customization.

The custom table should contain a field named as XXX_ID (where XXX means the entity. For ex. PART_ID, CODE_COMBINATION_ID etc) to capture the selected code combination ID.

Logon as

Application Developer -> Flex fields -> Key -> Register
Existing KFF can also be used. Ex. Accounting FF

1. Create a form based on the custom table.

2. In the block, create two non-base table text items of data type CHAR (2000). One text item is to store the code combinations (Say BTL_KFF ) and other one is to store description of the code (Say BTL_KFF_DESC. Make this item as non-updateable).

this is typical registration of KFF. For Customization in custom development here are the steps:

1. Write a form level trigger WHEN-NEW-FORM-INSTANCE to invoke the KFF as

Fnd_Key_Flex.Define(
Block => ‘block_name’,
Field => ‘concatenated_segments_field_name’,
[Description => ‘description_field_name’,]
[ID => ‘Unique_ID_field’
Appl_Short_Name => ‘application_short_name’,
Code => ‘key_flexfield_code’,
Num => ‘structure_number’,

In above defination take a note,

  • These arguments specify location
  • All fields must reside in same block
  • ID is for Key Flexfields only
  • These arguments indicate which flexfield is being used
  • Short name is application where flexfield is registered
  • SQLGL is Oracle General Ledger
  • SQLAP is Oracle Payables
  • Code identifies Key Flexfield
  • GL# is Accounting Flexfield
  • Num is Key Flexfield structure number. Default is 101

Usage

FND_KEY_FLEX.DEFINE(
block => 'Custom block',
Field => 'BTL_KFF',
Description => 'BTL_KFF_DESC',
ID => 'XXX_ID',
Appl_short_name => 'SQLGL',
Code => 'GL#',
Num => '101',
Vrule => 'GL_GLOBAL\nDETAIL_POSTING_ALLOWED \nE\nAPPL=''SQLGL'';
name=Parent Values are not allowed\nN'
);

2. XXX_ID will store the code combination ID for each selection.

3.Invoke Flexfield functionality by calling FND_Flex.Event(event) from:


3. Write an item level trigger WHEN-NEW-ITEM-INSTANCE on BTL_KFF as

FND_FLEX.EVENT('WHEN-NEW-ITEM-INSTANCE')

4. Write an item level trigger KEY-EDIT on BTL_KFF as

FND_FLEX.EVENT('KEY-EDIT');

5. Write an item level trigger WHEN-VALIDATE-ITEM on BTL_KFF as

FND_FLEX.EVENT('WHEN-VALIDATE-ITEM');

IF :CUSTOM_BLOCK.XXX_ID = -1 THEN
FND_MESSAGE.SET_STRING('You Have Selected An Undefined Code Combination !');
FND_MESSAGE.SHOW;
RAISE FORM_TRIGGER_FAILURE;
END IF;

These steps makes you flexfield enable in your form.

A NOTE FOR FLEX FIELD DEFINATION

Lets take a close scan to understand some of the paramater used in Flex Field defination.

1. [Validate=> ‘{FOR_INSERT|FULL|PARTIAL|NONE|PARTIAL_IF_POSSIBLE}’,]

2.[Vdate => ‘date’,]

3.[Required=>’[Y|N’,]

4.[Displayable => ‘{ALL | flexfield_qualifier | segment_number} [\0{ALL|flexfield_qualifier|segment_number}]’,]

5.[COPY=>’block.field\n{ALL|flexfield qualifier|segment number} [\0block.field\n{ALL|flexfield qualifier|segment number}]’,]

6.[VRULE => ‘flexfield qualifier\n
segment qualifier\n
{I[nclude] | E[xclude]}\n
APPL=application_short_name;
NAME=Message Dictionary message name\n
Validation value1\n
Validation value2…
[\0flexfield qualifier\n
…

2 Comments (Open | Close)

2 Comments To "How to use Key Flex Fields (KFF) in forms"

#1 Comment By seo company On August 31, 2009 @ 3:47 am

Nice one.. thanks for sharnig

#2 Comment By flowers delivery uk On August 31, 2009 @ 3:49 am

Excellent, This is what I was looking for.

Thanks