All po's matched to an invoice

This forum is to discuss different features/issues of Oracle Financials modules ( GL - General Ledger, AP - Accounts Payable, AR - Accounts Receivable, FA - Fixed Assets & CM - Cash Management ).
Post Reply
Racleoay
Posts: 26
Joined: Thu May 08, 2008 8:20 am
Location: United Arab Emirates

All po's matched to an invoice

Post by Racleoay »

Hello

I would like to retrieve all po's matched to an invoice.

an invoice could be matched with multiple Po's, how can I retrieve that using a SQL query??

I would appreciate if someone guided me to the table names, i already tried AP_INVOICES_V but its not enough in case of multiple po's


thank u
imrankhan
Posts: 14
Joined: Sat Aug 09, 2008 2:21 pm
Location: India

Post by imrankhan »

<font face="Arial"></font id="Arial"><font color="red"></font id="red">
hi.............
if u want to match purchase order with invoice in ap_invoice_All table
there is one column po_header_id but if it will not work then go into the
ap_invoice_distributions_all see the column po_distribution_id and match with purchase order po_distribution_id it will work
ahmadbilal
Posts: 615
Joined: Mon Sep 18, 2006 1:32 am
Location: United Arab Emirates
Contact:

Post by ahmadbilal »

/* Formatted on 2008/11/09 11:07 (Formatter Plus v4.8.8) */
SELECT a.org_id "ORG ID", e.segment1 "VENDOR NUM",
e.vendor_name "SUPPLIER NAME",
UPPER (e.vendor_type_lookup_code) "VENDOR TYPE",
f.vendor_site_code "VENDOR SITE CODE", f.address_line1 "ADDRESS",
f.city "CITY", f.country "COUNTRY",
TO_CHAR (TRUNC (d.creation_date)) "PO Date", d.segment1 "PO NUM",
d.type_lookup_code "PO Type", c.quantity_ordered "QTY ORDERED",
c.quantity_cancelled "QTY CANCELLED", g.item_id "ITEM ID",
g.item_description "ITEM DESCRIPTION", g.unit_price "UNIT PRICE",
(NVL (c.quantity_ordered, 0) - NVL (c.quantity_cancelled, 0)
)
* NVL (g.unit_price, 0) "PO Line Amount",
(SELECT DECODE (ph.approved_flag, 'Y', 'Approved')
FROM po.po_headers_all ph
WHERE ph.po_header_id = d.po_header_id) "PO Approved?",
a.invoice_type_lookup_code "INVOICE TYPE",
a.invoice_amount "INVOICE AMOUNT",
TO_CHAR (TRUNC (a.invoice_date)) "INVOICE DATE",
a.invoice_num "INVOICE NUMBER",
(SELECT DECODE (x.match_status_flag,
'A', 'Approved'
)
FROM ap.ap_invoice_distributions_all x
WHERE x.invoice_distribution_id = b.invoice_distribution_id)
"Invoice Approved?",
a.amount_paid, h.amount, h.check_id, h.invoice_payment_id "Payment Id",
i.check_number "Cheque Number",
TO_CHAR (TRUNC (i.check_date)) "PAYMENT DATE"
FROM ap.ap_invoices_all a,
ap.ap_invoice_distributions_all b,
po.po_distributions_all c,
po.po_headers_all d,
po.po_vendors e,
po.po_vendor_sites_all f,
po.po_lines_all g,
ap.ap_invoice_payments_all h,
ap.ap_checks_all i
WHERE a.invoice_id = b.invoice_id
AND b.po_distribution_id = c.po_distribution_id(+)
AND c.po_header_id = d.po_header_id(+)
AND e.vendor_id(+) = d.vendor_id
AND f.vendor_site_id(+) = d.vendor_site_id
AND d.po_header_id = g.po_header_id
AND c.po_line_id = g.po_line_id
AND a.invoice_id = h.invoice_id
AND h.check_id = i.check_id
AND f.vendor_site_id = i.vendor_site_id
AND c.po_header_id IS NOT NULL
AND a.payment_status_flag = 'Y'
AND d.type_lookup_code != 'BLANKET'
Racleoay
Posts: 26
Joined: Thu May 08, 2008 8:20 am
Location: United Arab Emirates

Post by Racleoay »

Thank you guys, that was really helpfull :)
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests