Question: How to customize Complex Service PO in R12.
Answer:
Let's try to discuss about this report in our random walk through.
Below is the query to listdown all the "complex service POs' in the system. Of course you need to set org profile for this query by "begin mo_global.set_policy_context('S',
) ; end ; "
==
select * from po_headers ph, po_doc_style_lines_tl psl
where psl.style_id = ph.style_id
and psl.document_subtype(+) = ph.type_lookup_code
and psl.language(+) = userenv('LANG')
and psl.display_name = 'Complex Service Purchase Order'
==
For many reasons Standard template(provided by Oracle) "PO_STANDARD_XSLFO" alone is not sufficient for your requirement.
Example:
- company logo need to be added.
- layout need to be changed
- hide/show additional columns/information
- show registration number of your company. etc
For minor customizations, standard template can be modified and used. But remember standard template is XSL. So it requires some specialized skill to work on XSL.
I had huge amount customizations and all these customizations can not done using standard template. So I had to design and use my own template.
You can visit my template here.
How to design custom template ?
If you decided to proceed with your own template, then the total process(design, define, attach template) is no different with any other BI Publsiher reports.
To design RTF(or any other) template, you need to have XML file.
Getting XML file/data for this customization is not an easy task.
Oracle posted few notes on this report, but none of them discussed how to get XML datafile.
"PO Output for Communication" - is a Java concurrent program.
When you create complex purchase order, PO workflow will trigger "PO Output for Communication" program. This program generates XML file and apply this XML file to template and generate required PDF as output.
In the process described above, system will not save XML file anywhere.
To get XML data file, you need to follow the steps mentioned below.
- Goto PO Responsibility.
- Goto SRS(Conc. program submission) Window
- Enter program "
PO Output for Communication"
- Parameters
- PO Number ->
- Test -> Debug
- Template Name -> Standard Purchase Order Stylesheet.
- Submit.
After a while, this program will be completed in error. Don't worry about why it errored out. Just go through the logfile and find XML file in there.
Along with the XML data, there will be lot of other information, which you don't need.
Save the log file in your machine and remove complete text which is outside XML file. That means the text outside of XML tags
and . Save this edited file as new file with .XML as extension.
Do following changes to your XML file now.
- Add "xml version="1.0" encoding="UTF-8"
?>" as a first line.
- remove complete text under the tag
, as this is not correctly formatted.
Now your XML data file is ready and you can proceed for creating custom template.
Once done with the template design, here are the steps to register and use custom template.
Log in as "XML Publisher Administrator"
- create XML Template for the data definition: Standard Purchase Order Data Source.
- Note: Select Application as “Purchasing’.
- Nav: Purchase Order Super User
- Setup/Purchasing/Document types/
- Locate “Purchase Order Standard” and then Set the Document Type Layout to your new custom template.
Now you are ready test your customizations.
- Create complex service Purchase orde r.
- View PDF. You should be able to see your customizations now.
How to change/modify Data Definition ?
So far so good..
We have seen how to customize RTF template to produce desired output as per your requirements.
How about having additional information, which is not even available in your XML data file.?
Or in other words, how do you change/customize data definition itself, so that your new XML file come up with additional information you want.
Well, there is no direct way to change data definition as concurrent program is of JAVA type.
So you cannot customize this JAVA program(at least, I couldn't ).
In my case, I had to show "Project Code" for each PO distribution, if the procurement is project related.
Another requirement was - Legal Entity Name
Now - my requirements are clear ..show
- Project Code
- Regd Number and Regd. Legal Entity Name on the header portion of the report.
Since I could not alter the data definition( PO Output for Communication), I did following.
Some how I figured out following views are being used by "PO Output for Communication" to produce XML data file
- PO_HEADERS_XML
- PO_LINES_XML
- PO_LINE_LOCATIONS_XML.
- PO_DISTRIBUTION_XML .. etc
Altered "PO_DISTRIBUTION_XML" view to include project information.
eg:
--
CREATE OR REPLACE FORCE VIEW APPS.PO_DISTRIBUTION_XML
(
AMOUNT_ORDERED,
PA.SEGMENT1 PROJECT_CODE
FROM PER_ALL_PEOPLE_F PAP,
PO_DISTRIBUTIONS_ALL PD
,
PA_PROJECTS_ALL PA,
WHERE GCD.CODE_COMBINATION_ID(+) = PD.CODE_COMBINATION_ID
AND PAP.PERSON_ID(+) = PD.DELIVER_TO_PERSON_ID
AND PD.PROJECT_ID = PA.PROJECT_ID(+)
AND SYSDATE BETWEEN PAP.EFFECTIVE_START_DATE(+)
AND PAP.EFFECTIVE_END_DATE(+);
---
Now my new XML datafile comes with Project code, which can be displayed in my output/pdf.
PS: To see your changes to the view, it is better to create new PO and generate XML for that PO.
This is because, system caches XML data and reuses that.. thats the reason it is better to create brand new POs and test it.
Following few screenshots are to view your PDF for PO from SRS window.
This way, you don't need to regenerate your PO or revise your PO.
Without increasing revision numbers, you can see all your PO updates in your PDF.
PS: I am updating this post, as and when I get some free time.
So information could be assorted and zig-zag.