Tuesday, 4 March 2014

Query GL & SLA

SELECT b.NAME batch, h.NAME journal_entry, h.je_source journal_source,
       h.currency_code entered_currency, h.je_category CATEGORY,
       sla.description, lines.je_line_num line,
       lines.entered_dr entered_dr_account_inquery,
       lines.entered_cr entered_cr_account_inquery, sla.gl_date,
       sla.ae_line_num line_num, sla.accounting_class_code, sla.currency_code,
       sla.entered_dr, sla.entered_cr, sla.accounted_dr, sla.accounted_cr
  FROM gl_period_statuses ps,
       gl_je_lines lines,
       gl_je_headers h,
       gl_je_batches b,
       gl_ledger_relationships lr,
       gl_import_references gir,
       gl_code_combinations_kfv gcc,
       (SELECT xal.gl_sl_link_table, xal.gl_sl_link_id,
               xal.accounting_date gl_date, xal.ae_line_num,
               gcc1.concatenated_segments ACCOUNT, xal.accounting_class_code,
               xal.currency_code, xal.entered_dr, xal.entered_cr,
               xal.accounted_dr, accounted_cr, xah.description
          FROM xla_ae_headers xah,
               xla_ae_lines xal,
               xla_events xe,
               gl_code_combinations_kfv gcc1
         WHERE xah.ae_header_id = xal.ae_header_id
           AND xah.application_id = xal.application_id
           AND xah.event_id = xe.event_id
           AND xah.application_id = xe.application_id
           AND xal.code_combination_id = gcc1.code_combination_id) sla
 WHERE lr.source_ledger_id = lr.target_ledger_id
   AND b.je_batch_id = h.je_batch_id
   AND h.je_header_id = lines.je_header_id
   AND h.ledger_id = lr.source_ledger_id
   AND lines.period_name = ps.period_name
   AND ps.ledger_id = lines.ledger_id
   AND gir.je_batch_id = b.je_batch_id
   AND gir.je_header_id = h.je_header_id
   AND gir.je_line_num = lines.je_line_num
   AND gcc.code_combination_id = lines.code_combination_id
   AND gir.gl_sl_link_id = sla.gl_sl_link_id
   AND gir.gl_sl_link_table = sla.gl_sl_link_table

No comments:

Post a Comment