Monday, April 30, 2012

Generation of GL code combinations by Sql

Here is workaround for automatic/mass CCID generation or insertion of new CCID’s in GL_CODE_COMBINATIONS Table, when new values in Accounting Flexfield Segment are created, EXCEPT “Dynamic Insert” option activated .

you can use the api (function) -> fnd_flex_ext.get_ccid to create the ccid.

If the combination already exists, it returns the existing ccid else creates a new one and returns the id. Explicit commit command needs to be executed after calling this function.
 
Use below function which returns the CCID if it is exist and create the CCID if it doesn't exist in the application.

fnd_flex_ext.get_ccid(application_short_name ='SQLGL', key_flex_code ='GL#', structure_number =l_coa_id, 
validation_date =to_char(SYSDATE,apps.fnd_flex_ext.date_format)
concatenated_segments =l_account)


Initialize the mandatory parameter if you are running the code in SQL Plus/TOAD
 
BEGIN
    FND_GLOBAL.APPS_INITIALIZE(l_user_id, l_resp_id, l_appl_id);
 END;
 
Query to Find the Flex Structure 
 
SELECT fifst.STRUCTURE_VIEW_NAME,
fifst.CONCATENATED_SEGMENT_DELIMITER,
fifs.application_column_name,
fifs.segment_name,
fifs.segment_num,
ffs.flex_value_set_name
FROM fnd_id_flex_structures_vl fifst,
fnd_id_flex_segments fifs,
fnd_flex_value_sets ffs
WHERE fifst.id_flex_structure_code = 'ACCOUNTING_FLEXFIELD'
AND fifst.application_id = 101
AND fifst.id_flex_code = 'GL#'
AND fifs.application_id = fifst.application_id
AND fifs.id_flex_code = fifst.id_flex_code
AND fifs.id_flex_num = fifst.id_flex_num
AND ffs.flex_value_set_id = fifs.flex_value_set_id;
 

No comments:

Post a Comment