Here is the query to find link of Sales Orders with their corresponding Invoices
/**************************************************************************
*PURPOSE: To find link of Sales Orders with their corresponding Invoices *
*AUTHOR: Shailender Thallam *
**************************************************************************/
SELECT ooh.order_number, ool.line_number, ool.ordered_item,
ool.ordered_quantity * ool.unit_selling_price,
rcta.trx_number invoice_number, rcta.trx_date, rctl.line_number,
rctl.unit_selling_price, ooh.org_id
FROM oe_order_headers_all ooh,
oe_order_lines_all ool,
ra_customer_trx_all rcta,
ra_customer_trx_lines_all rctl
WHERE ooh.header_id = ool.header_id
AND rcta.interface_header_context = 'ORDER ENTRY'
AND rctl.interface_line_context = 'ORDER ENTRY'
AND rctl.interface_line_attribute1 = TO_CHAR (ooh.order_number)
AND rctl.interface_line_attribute6 = TO_CHAR (ool.line_id)
AND rctl.customer_trx_id = rcta.customer_trx_id
AND ooh.order_number = NVL (:p_order_number, ooh.order_number)
--AND ooh.org_id=nvl(:p_org_id,ooh.org_id)
;