Sunday, March 31, 2019
Query to View or Download Purchase Order PDF from Database in R12
As you all know, the “PO Output for Communication” is
responsible for generating the PO PDF based on the default template configured
at transaction types. Post generating the PO PDF, it get stored in database
like an attachment mapped to respective PO_HEADER_ID.
So,we can use the below query to check/download the PO PDF from database. This helps for debugging where we don't have access to front end.
I tested the query in R12.24 instance
Query:
SELECT a.media_id,A.ou_short_code,a.po_header_id,PR_NUM,po_num,'application/pdf' content_type,file_name po_pdf_file_name,revision_num po_revision_num,(SELECT l.file_dataFROM fnd_lobs lWHERE l.file_id = a.MEDIA_IDFROM (SELECT DISTINCThou.short_code ou_short_code,pha.po_header_id,prha.segment1 pr_num,pha.segment1 po_num,pha.revision_num,d.media_id,d.file_nameFROM po_headers_archive_all pha,hr_operating_units hou,po_line_locations_all pll,po_distributions_all pd,po_requisition_lines_all prla,po_requisition_headers_all prha,po_req_distributions_all prda,fnd_document_datatypes dat,fnd_documents d,fnd_attached_documents adWHERE hou.organization_id = pha.org_idAND pha.type_lookup_code = 'STANDARD'AND pha.po_header_id = pll.po_header_idAND pll.line_location_id = prla.line_location_idAND pd.po_header_id = pha.po_header_idAND pd.po_line_id = pll.po_line_idAND prha.requisition_header_id = prla.requisition_header_idAND prla.requisition_line_id = prda.requisition_line_idAND pd.req_distribution_id = prda.distribution_idAND d.document_id = ad.document_idAND d.datatype_id = dat.datatype_idAND dat.name = 'FILE'AND ad.pk1_value = pha.po_header_idAND ad.pk2_value = pha.revision_numAND ad.entity_name = 'PO_HEAD'AND D.file_name like '%'||pha.segment1||'%'AND dat.language = 'US'AND pha.org_id = 840) a;
Hope its helps!!
Do you think this Article is useful?
Subscribe to:
Post Comments (Atom)
Disclaimer
The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.
0 Responses to “Query to View or Download Purchase Order PDF from Database in R12”
Post a Comment