--- Find the Script for Invoice Number, Receipt Number and PO Number Using SQL Query in Oracle Apps EBS R12 ---
SELECT pha.segment1 po_number, aia.invoice_num invoice_number, rsh.receipt_num receipt_number
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 rsh
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 = rsh.shipment_header_id
AND pha.segment1 = NVL (:p_po_num, pha.segment1)
AND aia.invoice_num = NVL (:p_invoice_num, aia.invoice_num)
AND rsh.receipt_num = NVL (:p_receipt_num, rsh.receipt_num)
GROUP BY pha.segment1, aia.invoice_num, rsh.receipt_num
SELECT pha.segment1 po_number, aia.invoice_num invoice_number, rsh.receipt_num receipt_number
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 rsh
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 = rsh.shipment_header_id
AND pha.segment1 = NVL (:p_po_num, pha.segment1)
AND aia.invoice_num = NVL (:p_invoice_num, aia.invoice_num)
AND rsh.receipt_num = NVL (:p_receipt_num, rsh.receipt_num)
GROUP BY pha.segment1, aia.invoice_num, rsh.receipt_num
No comments:
Post a Comment