Tuesday, 10 May 2016

Query to Find GL Journal Line Based On Trial Balance

SELECT gld.short_name, gld.NAME, gjh.NAME je_name,
       gjl.description "DESCRIPTION LINE",
       gjh.doc_sequence_value "DOCUMENT NUMBER",
      
       --VERSION 2.04 CHANGES,ADDED COLUMN--
       DECODE (gjh.accrual_rev_status,
               '', 'NON REVERSED',
               'REVERSED'
              ) "STATUS",                --VERSION 2.04 CHANGES,ADDED COLUMN--
          gcc.segment1
       || '-'
       || gcc.segment2
       || '-'
       || gcc.segment3
       || '-'
       || gcc.segment4 "ACCOUNT",
       gcc.segment1, gcc.segment2, gcc.segment3, gcc.segment4,
      
       ----VERSION 2.04 CHANGES,REMOVED AGGREGATE FUNCTION----
       gjl.accounted_dr "DR", gjl.accounted_cr "CR",
       NVL (gjl.accounted_dr, 0) - NVL (gjl.accounted_cr, 0) "END BALANCE",
       gjl.period_name
  FROM gl_je_lines gjl,
       gl_je_headers gjh,
       gl_code_combinations gcc,
       gl_ledgers gld
 WHERE gjl.code_combination_id = gcc.code_combination_id
   AND gjl.je_header_id = gjh.je_header_id
   AND gld.ledger_id = gjh.ledger_id
--     AND GJL.PERIOD_NAME = 'DEC-05'                              --PERIOD NAME
--GROUP BY GLD.SHORT_NAME,
--         GLD.NAME,
--         GJH.NAME,
--         GJL.DESCRIPTION,
--            GCC.SEGMENT1
--         || '-'
--         || GCC.SEGMENT2
--         || '-'
--         || GCC.SEGMENT3
--         || '-'
--         || GCC.SEGMENT4,
--         GCC.SEGMENT1,
--         GCC.SEGMENT2,
--         GCC.SEGMENT3,
--         GCC.SEGMENT4,

--         GJL.PERIOD_NAME, GJH.DOC_SEQUENCE_VALUE,GJH.ACCRUAL_REV_STATUS;

No comments:

Post a Comment