Sunday, June 23, 2013

GL - XLA - AR Drill Down Query

/* GL - XLA - AR Drill Down Query */ 


SELECT   gjb.name,
         gjh.doc_sequence_value,
         gjl.ENTERED_DR,
         gjl.ENTERED_CR,
         (   gcc.segment1
          || '-'
          || gcc.segment2
          || '-'
          || gcc.segment3
          || '-'
          || gcc.segment4
          || '-'
          || gcc.segment5
          || '-'
          || gcc.segment6
          || '-'
          || gcc.segment7
          || '-'
          || gcc.segment8)
            Account,
         (SELECT   TRX_NUMBER
            FROM   xla_ae_lines xal,
                   xla_distribution_links xdl,
                   ra_customer_trx_all ract,
                   ra_customer_trx_lines_all ractl,
                   ra_cust_trx_line_gl_dist_all rctlgdl
           WHERE   xal.ae_header_id = xdl.ae_header_id
                   AND xal.GL_SL_LINK_ID = gir.gl_sl_link_id         --2621350
                   AND SOURCE_DISTRIBUTION_TYPE =  'RA_CUST_TRX_LINE_GL_DIST_ALL'
                   AND xal.application_id = xdl.application_id
                   AND xal.APPLICATION_ID = 222
                   AND ractl.customer_trx_id = ract.customer_trx_id
                   AND ractl.customer_trx_line_id =
                         rctlgdl.customer_trx_line_id
                   AND ract.customer_trx_id = rctlgdl.customer_trx_id
                   AND xdl.source_distribution_id_num_1 =
                         rctlgdl.CUST_TRX_LINE_GL_DIST_ID)
            TRX_NUMBER,
         gir.SUBLEDGER_DOC_SEQUENCE_VALUE
  FROM   gl_je_batches gjb,
         gl_je_headers gjh,
         gl_je_lines gjl,
         gl_code_combinations gcc,
         gl_import_References gir
 WHERE       gjb.je_batch_id = gjh.je_batch_id
         AND gjh.je_header_id = gjl.je_header_id
         AND gcc.code_combination_id = gjl.CODE_COMBINATION_ID
         AND gir.je_header_id = gjh.je_header_id
         AND gir.JE_LINE_NUM = gjl.JE_LINE_NUM
         AND gir.je_batch_id = gjh.je_batch_id
         AND gjb.DATE_CREATED LIKE SYSDATE

No comments:

Post a Comment