Thursday, May 8, 2008

HOW TO USE KFF IN FORMS

How to use Key Flex Fields (KFF) in forms
August 23rd, 2007 by Anand
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 -> RegisterExisting 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 THENFND_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_INSERTFULLPARTIALNONEPARTIAL_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=>’[YN’,]
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{ALLflexfield_qualifiersegment_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{ALLflexfield qualifiersegment number} [\\0block.field\\n{ALLflexfield qualifiersegment 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\\nsegment qualifier\\n{I[nclude] E[xclude]}\\nAPPL=application_short_name;NAME=Message Dictionary message name\\nValidation value1\\nValidation value2…[\\0flexfield qualifier\\n…
Key or range flexfields
Impose additional validation
‘\\n’ is delimiter between parameters
‘\\0’ is delimiter between groups of parameters

FNDLOAD

FNDLOAD

The Generic Loader (FNDLOAD) is a concurrent program that can transfer Oracle Application entity data between database and text file. The loader reads a configuration file to determine which entity to access. In simple words FNDLOAD is used to transfer entity data from one instance/database to other. for example if you want to move a concurrent program/menu/valuesets developed in DEVELOPMENT instance to PRODUCTION instance you can direct use this command.


Steps to Move a Concurrent program from one instance(Database) to other

· Define your concurrent program and save it in first instance(for how to register a concurrent program click
here)
· Connect to your UNIX box on first instance and run the following command to download the .ldt file
FNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct file_name.ldt PROGRAM APPLICATION_SHORT_NAME="Concurrent program application short name" CONCURRENT_PROGRAM_NAME="concurrent program short name"

· Move the downloaded .ldf file to new instance(Use FTP)
· Connect to your UNIX box on second instance and run the following command to upload the .ldt file

FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/afcpprog.lct
file_name.ldt


Note: Make sure you are giving proper .lct file in the commands and don’t confuse with .lct and .ldt files


These following are the other entity data types that we can move with FNDLOAD
1 - Printer StylesFNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afcppstl.lct file_name.ldt STYLE PRINTER_STYLE_NAME="printer style name"
2 - LookupsFNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/aflvmlu.lct file_name.ldt FND_LOOKUP_TYPE APPLICATION_SHORT_NAME="FND" LOOKUP_TYPE="lookup name"
3 - Descriptive Flexfield with all of specific ContextsFNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct file_name.ldt DESC_FLEX P_LEVEL=’COL_ALL:REF_ALL:CTX_ONE:SEG_ALL’ APPLICATION_SHORT_NAME="FND" DESCRIPTIVE_FLEXFIELD_NAME="desc flex name" P_CONTEXT_CODE="context name"
4 - Key Flexfield StructuresFNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct file_name.ldt KEY_FLEX P_LEVEL=’COL_ALL:FQL_ALL:SQL_ALL:STR_ONE:WFP_ALL:SHA_ALL:CVR_ALL:SEG_ALL’ APPLICATION_SHORT_NAME="FND" ID_FLEX_CODE="key flex code" P_STRUCTURE_CODE="structure name"
5 - Concurrent ProgramsFNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct file_name.ldt PROGRAM APPLICATION_SHORT_NAME="FND" CONCURRENT_PROGRAM_NAME="concurrent name"
6 - Value SetsFNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct file_name.ldt VALUE_SET_VALUE FLEX_VALUE_SET_NAME="value set name"
7 - Value Sets with valuesFNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct file_name.ldt VALUE_SET FLEX_VALUE_SET_NAME="value set name"
8 - Profile OptionsFNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afscprof.lct file_name.ldt PROFILE PROFILE_NAME="profile option" APPLICATION_SHORT_NAME="FND"
8 - Request GroupsFNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afcpreqg.lct file_name.ldt REQUEST_GROUP REQUEST_GROUP_NAME="request group" APPLICATION_SHORT_NAME="FND"
10 - Request SetsFNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afcprset.lct file_name.ldt REQ_SETAPPLICATION_SHORT_NAME="FND" REQUEST_SET_NAME="request set"
11 - ResponsibilitiesFNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afscursp.lct file_name.ldt FND_RESPONSIBILITY RESP_KEY="responsibility"
12 - MenusFNDLOAD apps/apps O Y DOWNLOAD $FND_TOP/patch/115/import/afsload.lct file_name.ldt MENU MENU_NAME="menu_name"
13 - Forms PersonalizationFNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/affrmcus.lct file_name.ldt FND_FORM_CUSTOM_RULES function_name=FUNCTION_NAME
Note: UPLOAD command is same for all except replacing the .lct and passing any extra parameters if you want to pass
FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/corresponding.lct
upload_file.ldt