Search This Blog

Thursday, March 7, 2013

API TO CREATE CODE COMBINATIONS:

API TO CREATE CODE COMBINATIONS:

It may not always be the case that Account codes will be created by user from the front end. There may be scenarios sometimes where we need to have programs that will be creating the code combinations.

Oracle has provided the API's that can be used to create code combinations , we will be discussing a couple of them here.

Pre-requisits

  1. When trying to create the code combinations via the API is that in the Key Flexfields setup , for the KFF defined for your Accounting segments the check box Allow Dynamic Inserts need to be enabled, then only will the code combination be created else the API will never create the accounting segments.
  2. User needs to do initialization
  3. The Accounting flex-filed Value sets need to be populated with the values being used in the account being created


Now we will discuss the API's:

  1. fnd_flex_ext.get_ccid , this API will take in the input parameters and return the code combination id of the account segment created. In case the API is not able to create the account segmewnts for any reason or in case of an error the API will return 0.
            API syntax:
            fnd_flex_ext.get_ccid
     (application_short_name      => 'SQLGL',
      key_flex_code               => 'GL#',
      structure_number            => p_chart_of_accounts_id,
      validation_date             => SYSDATE
      concatenated_segments       => allsegments
      );

The API takes in all these parameters as input:
   application_short_name : this is the short name of the General Ledger  Application
   key_flex_code : this is to be hardcoded as GL#
   structure_number : this is to be the chart of account id in which the account
   is to be created
   validation_date : Pass SYSDATE
   concatenated_segments : the account code segments in concatenated format

Once the API is run , if the account creation is successful then the CCID of the account is returned else the program will return 0.

    2. FND_FLEX_KEYVAL.VALIDATE_SEG , the API will take in the input parameters based
         on which the account code will be created , the API returns a BOOLEAN message of
         TRUE : signifying success or FALSE : in case API was not successful 
         API syntax:
         FND_FLEX_KEYVAL.VALIDATE_SEGS(
                                        ‘CREATE_COMBINATION’,
                                        ‘SQLGL’,
                                        ‘GL#’,
                                        chart_of_accts_id,
                                         concatenated_segments,
                                         ‘V’,
                                         SYSDATE,
                                         ‘ALL’, NULL, NULL, NULL, NULL,
                                         FALSE,FALSE, NULL, NULL, NULL);


       If the API is successful the the account segment will be created and the API will
       return a status TRUE , in case any error occurs he the account code creation will 
       fail and the API will return a status FALSE, In case of any error the API will
       populate the Error in the fnd_message queue.
  
       The user will have to retrieve the error message from there to see the error
       occurred:
       l_chr_error_msg := fnd_flex_keyval.error_message

No comments:

Post a Comment