Tuesday 20 March 2012

GL Balance Query in Oracle Apps

GL Balance Query in Oracle Apps

SELECT   gb.period_name "Period Name", gb.period_year "Period Year",gb.period_Num "Period Num",
         gb.set_of_books_id "SOB ID",
            gcc.segment1
         || '-'
         || gcc.segment2
         || '-'
         || gcc.segment3
         || '-'
         || gcc.segment4 "Account",
         gb.currency_code "Currency", SUM (gb.period_net_dr) "Period Net Dr",
         SUM (gb.period_net_cr) "Period Net Cr",
         SUM ((gb.period_net_dr - gb.period_net_cr)) "PTD"
    FROM gl_balances gb, gl_code_combinations gcc
   WHERE gb.set_of_books_id = 10
--     AND gb.period_name = 'FEB-10-11'
     AND gb.currency_code = 'INR'
     AND gcc.segment4 = '13141'
     AND gb.code_combination_id = gcc.code_combination_id
GROUP BY gb.period_name,
         gb.period_year,
         gb.PERIOD_NUM,
         gb.set_of_books_id,
            gcc.segment1
         || '-'
         || gcc.segment2
         || '-'
         || gcc.segment3
         || '-'
         || gcc.segment4,
         gb.currency_code
Order by gb.PERIOD_YEAR, gb.PERIOD_NUM

No comments:

Post a Comment