Monday, March 21, 2011

How to list down all the attachments attached to a vendor or party

Here is a way to find out all the attachments attached to a specific vendor or specific customer/party etc.

#1. To list down all the attachments attached to each supplier/vendor, following query can be used.

select segment1 vendor_num, vendor_name,
fdoc.title file_title, fdoc.file_name
from ap_suppliers sup, fnd_attached_documents doc, fnd_documents_vl fdoc
where
doc.pk1_value = sup.vendor_id and doc.entity_name = 'PO_VENDORS'
and doc.document_id =  fdoc.document_id
order by vendor_name

See the screenshot for  sample attachment for one vendor.


#2. In a similar way, to find out attachments for parties..

 select hzp.party_name Owner_name, hzp.party_number Owner_number, hzp.party_type, docs.creation_date doc_created_date , fdoc.title file_title, fdoc.file_name
from FND_ATTACHED_DOCUMENTS docs, hz_parties hzp,  fnd_documents_vl fdoc
where entity_name like 'HZ_PARTIES' and  pk1_value = hzp.party_id
and docs.document_id =  fdoc.document_id
order by 1

Thanks,
Chandra.

No comments: