Posted on August 23rd, 2007 by Sanjit Anand |
Print This Post
|
Email This Post
These are the steps required to implement KFF in customization.
- Define KFF fields in your database tables.
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.
- Register the table with Oracle AOL.
- Register the KFF with Oracle AOL
Logon as
Application Developer -> Flex fields -> Key -> Register
Existing KFF can also be used. Ex. Accounting FF
- Create KFF in the custom form
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).
- Add KFF standard built-ins in the form to invoke KFF
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.
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:
-
PRE-QUERY
-
POST-QUERY
-
PRE-INSERT
-
PRE-UPDATE
-
WHEN-VALIDATE-RECORD
-
WHEN-NEW-ITEM-INSTANCE
-
WHEN-VALIDATE-ITEM
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}’,]
-
This is used only for Key FlexFields only
-
“For_Insert†used in a block where the code_combinations table is the base table
-
“Full†used where the code_combination_id is a foreign key in the base table
-
“None†when any value is allowed, such a range flexfield for query purposes
-
“Partial†validates segment values but not the full combination
-
“Partial_If_Possible†only used when the flexfield has dependent segments
2.[Vdate => ‘date’,]
-
Validation date compared to segment value start/end dates
3.[Required=>’[Y|N’,]
-
This is applicable only in the case for key flexfields only
-
‘Y’ requires user to enter a valid value for every required segment, even if the flexfield is never navigated to
-
‘N’ only requires required segments to be entered when the flexfield has been updated
4.[Displayable => ‘{ALL | flexfield_qualifier | segment_number} [\0{ALL|flexfield_qualifier|segment_number}]’,]
-
Key Flexfields only. Default is “ALLâ€
-
Naming flexfield qualifier or segment number causes only those segments to appear.
-
Toggle this parameter by specifying more than one value separated with \0
-
Display all but the first segment by specifying:
-
DISPLAYABLE=>’ALL\01’
-
Same parameters for Updateable and Insertable
5.[COPY=>’block.field\n{ALL|flexfield qualifier|segment number} [\0block.field\n{ALL|flexfield qualifier|segment number}]’,]
-
Again, key flexfields only.
-
Copy a form field value into the segment indicated by flexfield qualifier or segment number
-
Value must be valid for segment or it will be erased
-
Copy works in reverse when flexfield pop-up window closes
-
Example copies a form global variable into the natural account segment of the Accounting Flexfield:
-
COPY=>’GLOBAL.default_expense_obj\nGL_ACCOUNT’
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
…
-
Key or range flexfields
-
Impose additional validation
-
‘\n’ is delimiter between parameters
-
‘\0’ is delimiter between groups of parameters

