Sunday, 8 July 2018

Oracle Gl Balancing Segment Query based on Organization Profile

SELECT ffv.flex_value,ffvt.DESCRIPTION
           FROM
    fnd_flex_value_sets ffvs ,
            fnd_flex_values ffv ,
            fnd_flex_values_tl ffvt,
            gl_ledgers gl,
                hr_operating_units hou,
                gl_code_combinations_kfv gcck
            WHERE
            ffvs.flex_value_set_id = ffv.flex_value_set_id
            and ffv.flex_value_id = ffvt.flex_value_id
            AND ffvt.language = USERENV('LANG')
            and flex_value_set_name like 'AG_Circle/Branch'   ---  Add your Flexfield Valueset name of Company for that segment
            AND ffv.ENABLED_FLAG='Y'
            AND ffv.SUMMARY_FLAG !='Y'
            AND ffv.flex_value=gcck.segment1
            AND gl.ledger_id = hou.set_of_books_id
                AND gl.RET_EARN_CODE_COMBINATION_ID =
                       gcck.CODE_COMBINATION_ID
                and hou.organization_id=fnd_profile.VALUE('ORG_ID')
         
Order by ffv.flex_value                     
            ;   

2 comments: