Saturday, November 10, 2012

Query to derive AR Transaction details

Query to derive AR Transaction details:-

  SELECT sob.name sob_name,
         hou.name ou_name,
         l.customer_trx_line_id,
         t.customer_trx_id,
         l.line_number,
         l.line_type,
         l.reason_code,
         l.quantity_invoiced,
         l.inventory_item_id,
         l.description,
         l.uom_code,
         l.unit_selling_price,
         (d.amount) extended_amount,
         l.interface_line_context,
         l.interface_line_attribute1,
         l.interface_line_attribute2,
         l.interface_line_attribute3,
         l.interface_line_attribute4,
         l.interface_line_attribute5,
         l.interface_line_attribute6,
         l.interface_line_attribute7,
         l.interface_line_attribute8,
         l.interface_line_attribute9,
         gcc.segment1,
         gcc.segment2,
         gcc.segment3,
         gcc.segment4,
         gcc.segment5,
         gcc.segment6,
         gcc.segment7,
         gcc.segment8,
         d.account_class,
         d.gl_date,
         d.acctd_amount,
         d.attribute1,
         d.attribute2,
         d.attribute3,
         d.attribute4,
         sp.salesrep_number,
         s.revenue_percent_split,
         l.link_to_cust_trx_line_id
    FROM ra_customer_trx_all t,
         ar_payment_schedules_all p,
         gl_sets_of_books sob,
         hr_operating_units hou,
         ra_customer_trx_lines_all l,
         ra_cust_trx_line_gl_dist_all d,
         gl_code_combinations gcc,
         ra_cust_trx_line_salesreps_all s,
         jtf_rs_salesreps sp
   WHERE     t.customer_trx_id = p.customer_trx_id
         AND p.status = 'OP'
         AND t.set_of_books_id = sob.set_of_books_id
         AND t.org_id = hou.organization_id
         AND t.customer_trx_id = l.customer_trx_id
         AND d.customer_trx_id = l.customer_trx_id
         AND d.customer_trx_line_id = l.customer_trx_line_id
         AND d.code_combination_id = gcc.code_combination_id
         AND gcc.chart_of_accounts_id = sob.chart_of_accounts_id
         AND s.customer_trx_id(+) = t.customer_trx_id
         AND s.salesrep_id = sp.salesrep_id(+)
         AND s.org_id = sp.org_id(+)
ORDER BY customer_trx_id,
         line_number,
         line_type,
         customer_trx_line_id;

No comments:

Post a Comment