Thursday, June 17, 2021

Query to get Journal Details in fusion

 Here we have query to get the journal details in fusion 

SELECT gjb.NAME                  batch_name,
       gjh.period_name,
       gjh.status                je_header_status,
       gjh.NAME                  je_header_name,
       gjh.creation_date         je_header_creation_date,
       gjh.description           je_header_description,
       gjh.je_category,
       gjh.je_source,
       gjh.posted_date           je_posted_date,
       gjh.post_currency_code,
       gl.NAME                   ledger_name,
       gjl.je_line_num,
       gjl.effective_date        accounting_date,
       gjl.creation_date         line_creation_date,
       Nvl (gjl.entered_dr, 0)   entered_dr,
       Nvl (gjl.entered_cr, 0)   entered_cr,
       Nvl (gjl.accounted_dr, 0) accounted_dr,
       Nvl (gjl.accounted_cr, 0) accounted_cr,
       gjl.description           line_description,
       gcc.segment1              legal_entity,
       gcc.segment3              account,
       gl_flexfields_pkg.Get_description_sql (gcc.chart_of_accounts_id,
       --- chart of account id
       1, ----- Position of segment
       gcc.segment1 ---- Segment value
       )                         legal_entity_desc,
       gl_flexfields_pkg.Get_description_sql (gcc.chart_of_accounts_id,
       --- chart of account id
       3, ----- Position of segment
       gcc.segment3 ---- Segment value
       )                         account_desc,
       (SELECT DISTINCT display_name
        FROM   gl_je_action_log gja,
               per_users pu,
               per_person_names_f panf
        WHERE  gja.je_batch_id = gjb.je_batch_id
               AND panf.person_id = pu.person_id
               AND gja.user_id = pu.username
               AND panf.name_type = 'GLOBAL'
               AND rownum = 1)   entered_by
FROM   gl_je_headers gjh,
       gl_je_batches gjb,
       gl_ledgers gl,
       gl_je_lines gjl,
       gl_code_combinations gcc
WHERE  1 = 1
       --         AND gjh.name = 'Jan-19 Purchase Invoices'
       --         AND gjb.name = 'Payables A 23468000001 23468 N'
       AND gjh.je_batch_id = gjb.je_batch_id
       AND gl.ledger_id = gjh.ledger_id
       AND gjl.je_header_id = gjh.je_header_id ---POSTED
       AND gcc.code_combination_id = gjl.code_combination_id
       AND gjh.je_source = Nvl (:p_je_source, gjh.je_source)
       AND gl_flexfields_pkg.Get_description_sql (gcc.chart_of_accounts_id,
           --- chart of account id
           1, ----- Position of segment
           gcc.segment1 ---- Segment value
           ) IN ( :p_legal_entity )
       AND gjh.NAME = Nvl (:p_journal_name, gjh.NAME)
       AND gjh.creation_date BETWEEN :p_from_date AND :p_to_date
ORDER  BY gjh.creation_date,
          gjh.NAME,
          gjl.je_line_num 

No comments:

Post a Comment