|
|
Re: relation b/w purchase order and ap invoices [message #317160 is a reply to message #314181] |
Tue, 29 April 2008 14:03 |
Steve Corey
Messages: 336 Registered: February 2005 Location: RI
|
Senior Member |
|
|
Hi Anwer,
For database structure questions, your best bet to find these connections are located on the eTRM's on metalink.oracle.com (requires registration). If you log into metalink, click the Knowledge tab, scroll down to the bottom of the page, under the heading ONLINE DOCUMENTATION you can find the eTRM link: Applications Electronic Technical Reference Manuals (eTRM). You simply provide your version of E-Business Suite, search under DBA Data for the schema (AP, PO, HR, etc.) in question.
To answer your question:
Invoices and PO's are matched at the distribution level of the respective documents. Here is a query you may find useful:
SELECT
ai.invoice_num,
ai.vendor_id,
ph.segment1, -- if this is your PO NUMBER field, depends on setup
pl.line_num,
ps.shipment_num,
pd.distribution_num
FROM
ap_invoices_all ai,
ap_invoice_distributions_all ad,
po_distributions_all pd,
po_line_locations_all ps,
po_lines_all pl,
po_headers_all ph
WHERE
ai.invoice_id = ad.invoice_id
AND ad.po_distribution_id = pd.po_distribution_id -- here is the link you are searching for
AND pd.line_location_id = ps.line_location_id
AND ps.po_line_id = pl.po_line_id
AND pl.po_header_id = ph.po_header_id
AND ai.invoice_num = :invoice_number
Of course, you can play around with the selected fields and provide the necessary amount of information needed for whatever it is that you are doing.
|
|
|