GL Journal Extraction SQL Query in Oracle EBS and Oracle Fusion
Introduction
Extracting General Ledger (GL) journal data is one of the most common and essential tasks in both Oracle E-Business Suite (EBS) and Oracle Fusion environments. Whether you're supporting reconciliation, audit reporting, or building a custom data integration, this detailed SQL helps you fetch journal entries, ledger information, accounting amounts, project attributes, and line-level details in one go.
Use Case
This GL journal extraction query is helpful when:
-
Users want detailed journal information including batch, header, line, and segment details.
-
Auditors or finance teams request transactional history within a specific ledger or period.
-
Custom reporting or reconciliation processes are being built in BI Publisher, OTBI, or any third-party reporting tools.
SELECTgl.ledger_id,TO_CHAR(gjh.default_effective_date,'YYYY/MM/DD') default_effective_date,gjh.je_source,gjh.je_category,gjh.currency_code Currency_Code,TO_CHAR(gjh.date_created,'YYYY/MM/DD') Creation_Date,gjh.actual_flag Actual_Flag,gcc.segment1,gcc.segment2,gcc.segment3,gcc.segment4,gcc.segment5,gcc.segment6,gcc.segment7,gcc.segment8,gcc.segment9,ROUND(gjl.ENTERED_DR,2) Entered_Debit_Amount,ROUND(gjl.ENTERED_CR,2) Entered_Credit_Amount,ROUND(gjl.accounted_dr,2) Converted_Debit_Amount,ROUND(gjl.accounted_cr,2) Converted_Credit_Amount,gjb.name REFERENCE1_Batch_Name,gjb.description REFERENCE2_Batch_Description,gjl.description REFERENCE10_Line_Description,gjh.currency_conversion_type,gjh.currency_conversion_date,gjh.currency_conversion_rate,gjl.attribute11 DOC_SEQUENCE_VALUE,gjl.attribute12 attribute_currency_type,gjl.attribute13 project_segment,gjl.attribute14 project_desc,gl.name Ledger_Name,gjh.ENCUMBRANCE_TYPE_ID Encumbrance_Type_ID,gjl.period_name Period_Name,gjb.je_batch_id,gjh.je_header_id,gjl.je_line_num
--add columns needed
FROMgl_je_batches gjb,gl_je_headers gjh,gl_je_lines gjl,gl_code_combinations gcc,gl_ledgers gl,gl_periods gp
--add tables needed
WHERE1 = 1AND gjb.je_batch_id = gjh.je_batch_idAND gjh.status = 'P'AND gjh.je_header_id = gjl.je_header_idAND gjh.actual_flag = 'A'AND gjl.code_combination_id = gcc.code_combination_idAND gjl.ledger_id = gl.ledger_idAND gjl.period_name = gp.period_nameAND gp.period_set_name = 'give set name here'AND gp.adjustment_period_flag = 'N'AND gl.name = :p_ledger_nameAND gjh.je_source = NVL(:p_source, gjh.je_source)AND gcc.segment1 = :p_companyAND gp.period_year = NVL(:p_year, gp.period_year)AND (gjl.period_name IN (:p_period) OR 'All' IN ('All' || :p_period))AND TRUNC(gjl.effective_date) BETWEEN NVL(:p_from_date, gjl.effective_date) AND NVL(:p_to_date, gjl.effective_date)ORDER BYgjh.je_header_id,gjl.je_line_num
Comments
Post a Comment