Tuesday 6 March 2012

Working With Key Flex Filed In OAF

                                                               Working With Key Flex Filed In OAF

Step 1: Create one Work Space and Project.
Step 2: Create one VO and AM under .server package.
Step 3: Query: SELECT CODE_COMBINATION_ID FROM GL_CODE_COMBINATIONS_KFV;
Step 4: Shuffle the VO to the AM.
Step 5: Create page and set the mandatory properties to the page Layout Region.
Step 6: Create one Stack Layout Region under the Page Layout Region.
Step 7: Create item of type Flex under the Stack Layout Region.
Step 8: Set the below proper ties to the flex Item

Item Id
KeyFlexItem
prompt
Accounting Key Flex Field
Application Short Name
SQLGL
Name
GL#
Type
Key
View Instance
codeCombinationsVO1


Step 9: Create one Controller Class and write the below code in the Process Request Method
    //get the Key flex Field Bean Id
    OAKeyFlexBean kffId = (OAKeyFlexBean)webBean.findIndexedChildRecursive("KeyFlexItem ");
    System.out.println("Key Flex Filed Bean Id is--->"+kffId);
     // set the code combination lov
    kffId.useCodeCombinationLOV(true);
     //set the structure code for the item key flex
    kffId.setStructureCode("Expert_AFF"); //Expert_AFF, ACCOUNTING_FLEXFIELD
    //kffId.setStructureCode("ARGENTINA_ACCOUNTING_FLEX");
     //Set the attribute name to the item
    kffId.setCCIDAttributeName("CodeCombinationId");
    //merging segments with key flex fields
   // CCIDlovEnabledKFF.mergeSegmentsWithParent(pageContext);
    //Execute the Query
    sampleAMImpl am = (sampleAMImpl)pageContext.getApplicationModule(webBean);
    KeyFlexFieldVOImpl vo = (KeyFlexFieldVOImpl)am.findViewObject("KeyFlexFieldVO1");
    if(!vo.isPreparedForExecution())
    {
      vo.executeQuery();
    }
Step 10: Now run the page see the output.

Step 11: Click on Search for segments.
Step 12: If you don’t  want to see the key flex field is merging one then change the code in the controller class as below.
kffId.useCodeCombinationLOV(false);


Step 13: Use the below Query to find the Structure Code
select  FIF.APPLICATION_ID  , 
        FIF.ID_FLEX_CODE    , 
         FIF.ID_FLEX_NAME    , 
         FIF.APPLICATION_TABLE_NAME , 
         FIF.DESCRIPTION     , 
         FIFS.ID_FLEX_NUM    , 
         FIFS.ID_FLEX_STRUCTURE_CODE  , 
         FIFSE.SEGMENT_NAME, 
         FIFSE.SEGMENT_NUM, 
         FIFSE.FLEX_VALUE_SET_ID 
 from    FND_ID_FLEXS FIF    , 
         FND_ID_FLEX_STRUCTURES FIFS , 
         FND_ID_FLEX_SEGMENTS FIFSE 
 where   FIF.APPLICATION_ID = FIFS.APPLICATION_ID 
 and     FIF.ID_FLEX_CODE   = FIFS.ID_FLEX_CODE 
 and     FIFSE.APPLICATION_ID = FIF.APPLICATION_ID 
 and     FIFSE.ID_FLEX_CODE = FIF.ID_FLEX_CODE 
 and     FIFSE.ID_FLEX_NUM = FIFS.ID_FLEX_NUM 
 and     FIF.ID_FLEX_CODE LIKE 'GL#'
 and     FIF.ID_FLEX_NAME LIKE 'Accounting Flexfield';

1 comment:

  1. hi can u send me the answer for to develop the oaf form addition subtraction buttons with code

    ReplyDelete