Here is a summary of what I have learnt of PO Output for Communication report on my recent engagement.
What is PO Output for Communication?
PO Output for Communication usually called as PO Print Report is one of the most important and standard report in Purchasing to communicate Purchase order information to supplier through an email in the format of PDF or text.
How to run PO Output for Communication report?
- This reports gets triggered as soon as a PO is approved. An email is sent to the supplier with PO information as an attachment and a copy of email is sent to the email address configured in the profile option “PO: Secondary Email address” as a backup.
- We can also view this report output by opening an Approved Purchase Order and then navigating to “Inquire –> View Document” through menu option.
- We can also run “PO Output for Communication” manually as a concurrent request.
How does PO Output for Communication report work?
PO Output for Communication is a Java concurrent program which is triggered through a PO Approval workflow. This java program generates XML data whose XSD(XML Schema Definition) is defined as XML Publisher Data definition and output layout is defined in XSL-FO format as a template in XML Publisher.
Data Definition Name: Standard Purchase Order Data Source
Template Name: Standard Purchase Order Stylesheet
PO Approval workflow uses standard package “PO_COMMUNICATION_PVT.POXMLGEN” to generate XML Data. The XML data generated contains all the columns of the below SQL views
- PO_HEADERS_XML
- PO_LINES_XML
- PO_LINE_LOCATIONS_XML
- PO_DISTRIBUTION_XML
- PO_PRICE_ADJUSTMENTS_XML
- PO_RELEASE_XML
How to create a custom layout for PO Output for Communication report?
To customize the layout of this report one must make a copy of seeded XSLFO stylesheet and modify it. But modifying XSLFO is not that easy as many of us dont know XSLFO markup language. The other way is to create traditional rtf layout. Below are the steps to apply rtf layout for this report.
- Navigate to Purchasing Super user responsibility –> Setup –> Organizations –> Purchasing Options
under Document Control section set value for “PO Output Format” field as PDF - Create a custom rtf layout “XX Test PO Print” with data source as “Standard Purchase Order Data Source”
Note: Application of template should be “Purchasing” not the custom application - Navigate to Purchasing Super user responsibility –> Setup –> Purchasing –> Document Types
Find for document type “Purchase Order Standard” and update it with “XX Test PO Print” rtf layout as “Document Type Layout”. - If mail_status is MAIL, it means the email delivery is pending for workflow mailer to send the notification.
- If mail_status is SENT, its means mailer has sent email
- If mail_status is NULL & status is NULL or OPEN, its means that no need to send email as notification preference of user is “Don’t send email” or the Workflow mailer is not Up and Running
How to see XML tags generated by PO Output for Communication report?
Usually we can see data in XML format in diagnostics form but for this report “View XML” option will be disabled.
To get the XML data we need to run the report with parameter “Test” value as “Debug” which generates a log file with XML Data along with some debug information. We need to save log file and remove content apart from XML Data and save the file with .xml as extension which can be used for rtf layout development.
PO should not be in “Approved” status to generate XML data
Note: To reflect the changes made on rtf layout, we need to run the report on the newly approved PO. Or to run the report for already approved PO run the concurrent program “PO Output for Communication” with ‘Regenerate Document‘ parameter as ‘Yes’.
How to add additional columns to PO Output for Communication Report?
As a seeded functionality we can add only the fields which are generated by seeded package “PO_COMMUNICATION_PVT.POXMLGEN” which lists all the columns of below SQL Views:
PO_HEADERS_XML
PO_LINES_XML
PO_LINE_LOCATIONS_XML
PO_DISTRIBUTIONS_XML
To add any additional field, we need to customize “PO_COMMUNICATION_PVT.POXMLGEN” package as well as POAPPR workflow, but this is very herculean task which involves lot of effort and it is not upward compatible, means the customizations may go away on applying patches.
The easiest way is to populate the additional values in attributes of underlying tables of above views, so that we can easily reference them in rtf layout without any customization.
Query to find if the Purchase Order information is sent to Supplier through email or not
SELECT segment1,
approved_date,
supplier_notif_method,
polc.displayed_field po_status,
print_count,
printed_date,
from_user,
to_user,
status,
mail_status,
original_recipient
FROM po_headers_all poh, wf_notifications wn,po_lookup_codes polc
WHERE 1=1
AND polc.lookup_type(+)= 'AUTHORIZATION STATUS'
AND poh.authorization_status = polc.lookup_code(+)
AND wn.user_key(+) = poh.segment1
AND wn.item_key(+) = poh.wf_item_key
AND supplier_notif_method = 'EMAIL'
AND NVL (edi_processed_flag, 'N') <> 'Y'
AND NVL(xml_flag,'N') <> 'Y'
AND message_name(+) = 'AME_EMAIL_PO'
and displayed_field='Approved'
order by poh.po_header_id desc;
Note: XML tag names are changed in R12 when compared with 11i