Saturday 22 November 2014

GL Account Analysis Query for Multiple sources

SELECT  xga.period_name,
                    xga.ledger_name,
                    xga.ledger_id,
                    xga.account,
                    xga.project,
                    xga.resource_org,
                    xga.work_location,
                    xga.client_vertical,
                    xga.product,
                    xga.entity,
                    xga.inter_entity,
                    xga.spare1,
                    xga.spare2,
                    xga.combinations,
                    xga.je_source,
                    xga.je_category,
                    pv.vendor_name party_name,
                    pv.segment1 party_number,
                    NULL transaction_type,
                    xal.currency_code transaction_currency,
                    xte.transaction_number,
                    TO_CHAR (xe.transaction_date, 'DD-Mon-YYYY') transaction_date,
                    xga.gl_date,
                    gir.subledger_doc_sequence_value subledger_doc_no,
                    xga.doc_sequence_value,
                    xal.description transaction_description,
                    xal.currency_code entered_currency,
                    NVL (xal.entered_dr, 0) entered_dr,
                    NVL (xal.entered_cr, 0) entered_cr,
                    xga.ledger_currency accounted_currency,
                    NVL (xal.accounted_dr, 0) accounted_dr,
                    NVL (xal.accounted_cr, 0) accounted_cr,
                    xga.code_combination_id
            FROM    gl_code_combinations xga,
                    gl_import_references gir,
                    xla_ae_lines xal,
                    xla_ae_headers xah,
                    xla_events xe,
                    xla.xla_transaction_entities xte,
                    po_vendors pv
            WHERE   xga.je_batch_id = gir.je_batch_id
            AND xga.je_header_id = gir.je_header_id
            AND xal.ledger_id = xah.ledger_id
            AND (xga.accounted_dr != 0 OR xga.accounted_cr != 0)
            AND xga.je_header_id = gir.je_header_id
            AND xga.je_line_num = gir.je_line_num
            AND gir.gl_sl_link_id = xal.gl_sl_link_id
            AND gir.gl_sl_link_table = xal.gl_sl_link_table
            AND xal.ae_header_id = xah.ae_header_id
            AND xal.application_id = xah.application_id
            AND xah.event_id = xe.event_id
            AND xah.application_id = xe.application_id
            AND xe.entity_id = xte.entity_id
            AND xe.application_id = xte.application_id
            AND (xal.accounted_dr != 0 OR xal.accounted_cr != 0)
            AND xal.party_id = pv.vendor_id(+)
            AND UPPER (xga.je_source) in ( 'PAYABLES','RECEIVABLES','ASSETS')

3 comments:

  1. Prasad, is this xga table name correct?

    ReplyDelete
    Replies
    1. Hi Kiran! Were you able to fix this query? XGA was also giving me issues.

      Delete
  2. This comment has been removed by the author.

    ReplyDelete