/*Query to Find Out the RMA Order associated with Sales Order*/
SELECT DISTINCT rma.order_number "RMA Number"FROM oe_order_headers_all rma,
oe_order_headers_all orders,
oe_order_lines_all rmal
WHERE rma.header_id = rmal.header_id
AND rmal.reference_header_id = orders.header_id
AND rmal.return_context = 'ORDER'
AND rma.org_id = rmal.org_id
AND rmal.org_id = orders.org_id
AND orders.order_number = &order_number;
/*Query to Find Out the RMA Order associated with AR Invoice*/
SELECT DISTINCT rma.order_number "RMA Number"
FROM oe_order_headers_all rma,
oe_order_lines_all rmal,
ra_customer_trx_lines_all ctl,
ra_customer_trx_all ct
WHERE rma.header_id = rmal.header_id
AND rma.org_id = rmal.org_id
AND rmal.reference_customer_trx_line_id = ctl.customer_trx_line_id
AND ct.customer_trx_id = ctl.customer_trx_id
AND ctl.org_id = ct.org_id
AND rmal.return_context = 'INVOICE'
AND ct.trx_number = &invoice_number;
No comments:
Post a Comment