Wednesday, 3 June 2015

GL Trial Balance Query -Detail

This is Trial balance detail query which will gives you detail for balance against each code combination with journal, category , batch name and source detail. Trial balance total should be always zero for any period.

select
gjh.name Journal_name,
gjh.je_category category_name,
gjh.je_source source_name,
gjb.name batch_name,
GCC.SEGMENT1,   -- comapny
GCC.SEGMENT2,  --cost center
GCC.SEGMENT3,  -- account
GCC.SEGMENT4,  ---Project
GCC.SEGMENT5, --Product
GCC.SEGMENT6, --Others
SUM(NVL(GJL.ACCOUNTED_DR,0))ACCOUNTED_DR,
SUM(NVL(GJL.ACCOUNTED_CR,0))ACCOUNTED_CR,
SUM(NVL(GJL.ACCOUNTED_DR,0)-NVL(GJL.ACCOUNTED_CR,0))BALANCE
from gl_je_headers gjh,
gl_je_lines gjl,
gl_ledgers gl,
gl_code_combinations gcc,
GL_JE_BATCHES GJB
where gjl.je_header_id = gjh.je_header_id
AND gjh.je_batch_id=gjb.je_batch_id
and gjl.code_combination_id=gcc.code_combination_id
and gjh.ledger_id=gl.ledger_id
and gjh.status='P'         --This will pick all posted journal entry
AND gjh.actual_flag='A'  -- This is for Actual entry A-Actual, B-Budget
AND gjh.period_name='MAY-2015'
AND GL.name='US Vision Operation'   --Ledger Name for organization
GROUP BY
GCC.SEGMENT1,
GCC.SEGMENT2,
GCC.SEGMENT3,
GCC.SEGMENT4,
GCC.SEGMENT5,
GCC.SEGMENT6,
GCC.SEGMENT7,
gjh.je_category ,
gjh.je_source ,
gjb.name,

gjh.name ;

5 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Plz give me solution for From_Period and To_Period. Between operator is not working due to Period is Varchar2 datatype.

    ReplyDelete
    Replies
    1. You can use gl_periods table where period_num column can help you to achieve your requirement.

      Delete

  3. Thanks for sharing this great information I am impressed by the information that you have on this blog. Same as your blog i found another one Oracle Fusion Financials . Actually, I was looking for the same information on internet for
    Oracle Fusion Manufacturing and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject, you can learn more about Oracle Fusion Supply Chain Management Cloud .

    ReplyDelete


  4. I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here.Same as your blog i found another one Oracle Fusion Financials.Actually I was looking for the same information on internet for Oracle Financials Cloud and came across your blog. I am impressed by the information that you have on this blog. Thanks once more for all the details.

    ReplyDelete

Oracle Fusion SQL Queries to get Sales Person/Sales Representative information for an Order

1) Get sales person details if the Sales Person ID is known SELECT  jrs.SALESREP_NUMBER  ,         jrs.status           ,         jrs.START_...