Report to link invoices with attached documents
994926Mar 5 2013 — edited Mar 8 2013I am trying to spool a report from the oracle back end, for some senior staff at my organisation. The report would contain approved invoices along with their electronically attached documents. I have a similar query that works( see below) the problem is this query only accurately ties invoice ID's(PK1_Value) for invoices that were created using "AP_INVOICES" enitity_name, but majority of our users dont have the payables responsibility and hence can only create using the "AP_INVOICES_INTERFACE" enitity_name, and I cant tie the PK1_VALUE in the fnd_attached_documents table to the invoice ID, Please I need urgent help to locate (a) what PK1_VALUE is being used by AP_INVOICES_INTERFACE (b) How I can reference INVOICE_ID with that value.
SELECT SUP.vendor_name SUPPLIER, INV.invoice_num INVOICE,
INV.invoice_amount AMOUNT, INV.remit_to_supplier_name,
INV.description, APVL.approval_history_id, APVL.approver_name, DOC.url
FROM ap_suppliers SUP, ap_invoices_all INV, ap_inv_aprvl_hist_all APVL,
fnd_documents DOC, fnd_attached_documents ATCH
WHERE SUP.vendor_id = INV.vendor_id
AND INV.invoice_id = APVL.invoice_id
AND INV.invoice_id = ATCH.pk1_value
AND DOC.document_id = ATCH.document_id
AND INV.wfapproval_status = 'WFAPPROVED'
AND ATCH.entity_name = 'AP_INVOICES'
AND APVL.response = 'APPROVED'
AND INV.cancelled_by IS NULL
ORDER BY SUPPLIER, INVOICE, APVL.approval_history_id
Thanks in anticipation.