Pages

Friday, January 31, 2014

GL Query for Payables(source) - Purchase Invoice(category)

SELECT  aia.invoice_num, aia.doc_sequence_value, aia.invoice_date,
         gjl.period_name, xal.accounting_class_code,
         gcc.concatenated_segments transaction_acc_code,
         xal.accounted_dr, xal.accounted_cr, gjh.je_source, gjh.je_category
    FROM apps.gl_je_headers gjh,
         apps.gl_je_lines gjl,
         apps.gl_je_batches gjb,
         apps.gl_import_references gir,
         xla.xla_ae_lines xal,
         xla.xla_ae_headers xah,
         xla.xla_transaction_entities xte,
         apps.ap_invoices_all aia,
         apps.gl_code_combinations_kfv gcc
   WHERE gjh.je_header_id = gjl.je_header_id
     AND gjh.je_header_id = gir.je_header_id
     AND gir.je_header_id = gjl.je_header_id
     AND gir.je_line_num = gjl.je_line_num
     AND gjb.je_batch_id = gir.je_batch_id
     AND gir.gl_sl_link_id = xal.gl_sl_link_id
     AND xal.ae_header_id = xah.ae_header_id
     AND gjl.code_combination_id = gcc.code_combination_id
     AND xal.application_id = '200'
     AND xah.application_id = '200'
     AND xah.entity_id = xte.entity_id
     AND xte.source_id_int_1 = aia.invoice_id
     AND gjl.period_name in (select distinct period_name from apps.gl_periods where start_date between :p_from_per and :p_to_per)
     AND gcc.segment4 in (3021000, 3021100)--, 3021700, 3023000, 3023100)
     AND gcc.segment3 in (100603)
     AND gcc.segment2 not in (102)  

No comments:

Post a Comment