fnd_attached_documents query in Oracle Apps
In this post , I will share the SQL query to fetch the Oracle apps Attachment Information's.'fnd_attached_documents' is the Key table which store all the Attachment related Information's in the Oracle Apps. In this below Example I am sharing the example to find the AP Invoice Attachments in Oracle Payables Application. Please find below the Tables and fnd_attached_documents query in Oracle Apps.
2 Important Tables of fnd_attached_documents query
1.fnd_attached_documents2.fnd_documents
SQL query to Fetch Oracle apps Attachment Information's
SELECT d.url,
i.invoice_num,
v.vendor_name,
v.segment1,
ps.vendor_site_code,
ab.batch_name batch_name,
TO_CHAR (i.invoice_amount, '999999999.99')
inv_amt,
i.invoice_date,
ad.accounting_date,
glc.segment3 dept,
glc.segment4 acct
FROM ap_invoices_all i,
ap_suppliers v,
ap_supplier_sites_all ps,
ap_batches_all ab,
ap_invoice_distributions_all ad,
gl_code_combinations glc,
fnd_attached_documents fad,
fnd_documents d,
fnd_documents_tl dtl
WHERE i.vendor_id = v.vendor_id
AND i.vendor_site_id = ps.vendor_site_id
AND i.batch_id = ab.batch_id
AND ad.dist_code_combination_id = glc.code_combination_id
AND ad.invoice_id = i.invoice_id
AND i.invoice_id = fad.pk1_value
AND fad.document_id = dtl.document_id
AND dtl.document_id = d.document_id
AND fad.entity_name = 'AP_INVOICES'
AND d.datatype_id = 5
2 comments:
is this sql is right?
No its not, its missing a number of joins and works on the basis that your org is using invoice batches.
Post a Comment