This query will help you to get Payable Invoice Number against PO and Receipt number in Oracle R12 Application
SELECT DISTINCT aia.invoice_id, aia.invoice_num, rs.receipt_num, pha.segment1 po_num FROM po_headers_all pha ,po_distributions_all pda ,ap_invoice_distributions_all aid ,ap_invoices_all aia ,rcv_shipment_lines rsl ,rcv_shipment_headers rs WHERE pha.po_header_id=pda.po_header_id AND aid.po_distribution_id=pda.po_distribution_id AND aia.invoice_id=aid.invoice_id AND rsl.po_header_id=pha.po_header_id AND rsl.shipment_header_id=rs.shipment_header_id; AND pha.segment1='500197' -- AND aia.invoice_num=nvl(:P_INVOICE_NUM,aia.invoice_num) AND rs.receipt_num= '1502311';