Saturday, January 2, 2010

Complex Service PO

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.


31 comments:

Anonymous said...

Oracle Purchasing Document Printing and Communication
--
387670.1

Unknown said...

Hello Chandra,

Could you please explain, from where do I get the new .xml

Chandra R Matta said...

Hi Srirupa,
If your question is "How to get/generate XML file after doing changes to the data source ?" then here is the way...

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.
===
All these steps explained in original post. Please go through it.

Thanks,
Chandra

Unknown said...

In case of RFQ (in R12), we didn't find any in-line view.
We need to understand the mechanism how it works and how to change base XML file for new fields/DFFs?

Please send-in your nputs/pointers.

Regards
Rohit

Unknown said...

Hello Chandra,

Thank you very much for your response.
Here I face another issue, would appreciate your help on this.

The company logo is not getting displayed in my report, when I check it from the Purchase Order form.
I have placed the image in OA_MEDIA and is calling

When I preview my report from the Template, I can see the logo though.

Thanks
Srirupa

Chandra R Matta said...

Hi Srirupa, Good to hear for you.

Reg. your new question on Logo display ..
For my understanding,
- you created your own BIP template, may be .rtf
- you placed desired logo on the template.
- when you see preview on your desktop, you are able to generate report, with the logo.
- when you deploy the template generate report from Application, Logo is not coming along.
Is this correct?

If you are following above steps, you don't need any logo in OA_MEDIA folder.

However, to display logo as you want(from OA_MEDIA), follow these mail convesations.. with my friend.


Hi Chandra,
Working for ABC Client , have an requirement with respect to XML Publisher..
Need to call the logo from file server...
the logo file will be placed in the custom top, input parameter value is custom folder name .
can you help me out..

Regards,
Fred

===
Hi fred,
You can call server side logo into your BI/XML Publisher as follows ..
----
XML Publisher supports including images in your published document:
OA Media Directory Reference
1. Insert a dummy image in your template.
2. In the Format Picture dialog box select the Web tab. Enter the following syntax
in the Alternative text region to reference the OA_MEDIA directory: url:{’${OA_MEDIA}/image name’}
For example, enter: url:{’${OA_MEDIA}/ORACLE_LOGO.gif’ }
-----

Having said this, I worked on one example to display image, which is available at server side.
See attached RTF template and generated PDF for your reference.
You may need to modify this solution as per your requirement.

Hope this helps.

Regards,
Chandra Matta
====
Hi Chandra
I tried your hardcoing the path method, it worked... thanks
but when i was using as below it is not working , can you explain where i went wrong..
according to your example, you suggested to use as below
url:{'${DCOM_TOP}/reports/US/Monkey_1.JPG' }
i was using as below
url:{'${OA_HTML}/DHL_LOGO.GIF' }


Regards
Fred
======

Hi Fred,

Here are other alternatives..
1. Move your logo into $OA_MEDIA folder and try to print logo from there..! OA_MEDIA is the ideal place to keep all your logos.
example: url:{'${OA_MEDIA}/logo.gif' }
I used this method and able to print logo successfully.
Go through my RTF template and Output generated out of this template
This way you don't need to hard-code path. So it should work with all environments.

2. With the help of HTML like URL.
Syntax: url:{'http://:/OA_MEDIA/logo.gif'}
for my client above URL will look like this.. url:{'http://cndadcoaapzt04.datacomsolutions.in:8015/OA_MEDIA/logo.gif' }
Hope this helps. let me know if you still have issues.
Regards,
Chandra.
======
Hi Chandra
Thanks it is working fine...

Regards
Fred.
====

Unknown said...

Hi Chandra,

Actually I have modified the .xsl file and when i upload the .xsl to my template from XML Publisher Administrator , I can see the logo in the preview. But when I run the PO Output for Communication program to generate my report, I cannot see the logo there.

Regards
Srirupa

Chandra R Matta said...

Hi Srirupa,
So you are modifying standard template "PO_STANDARD_XSLFO.xls" as per your requirements is it.?
If this is the case, you need to modify following code area in xls to display your logo.
- Search for "image at top left" in your xls.
- then you can identify the code, which displays logo on left corner.
- there put your server url and own logo name.
In my case it was something like this..


Hope this helps..

Alternatively you can design your own RTF template and register this template for your PO generation..
I explained this in my original post.
Regards,
Chandra.

Chandra R Matta said...

Rohit,
Could you explain your question again. I am not quite clear about your requirement

Regards,
Chandra

Anonymous said...

Hi Chandra,
First of all thanks for you article.
We have already customized the XSL files and views for our new data sources. Now our requirement is to translate the template into Spanish.
As you know this reports gets the field labels dynamically ie., Boilerplate Source
-- Variable for holding boilerplate messages --
xsl:variable name="BOILER_PLATE_MESSAGES_OBJ" select="($ROOT_OBJ/MESSAGE/MESSAGE_ROW)"/

So Could you please tell me where could I get the source for all the boilerplates?

Or is there another way to translate the template....??

Regards.
Kota Naresh
kotanaresh2003@gmail.com
+919975701226

Chandra R Matta said...

Hi Naresh,
Not sure about your requirement, but BI Publisher support the translations right.
Take a look at the demos, that comes with your BI Installation.

Thanks,
Chandra

Waseem said...

Hi Chandra,

I modified PO_LINES_XML but i m not able to see that field in XML output as you suggested how to check xml file i checked in log file.

Could you pls help here

Thanks

Chandra R Matta said...

Hi Waseem,

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.

Let me know.

vijay said...

Hi Chandra,

Article on PO Output for Communication posted by you is very helpful.
I copied PO_STANDARD_XSLFO.xsl code and added printing logo on the report. But still have following requirements and need you support to achive:-
1. Print Logo's org specific.
(Added LOGO1 and How can we get the OU name in xsl code and write an IF statement by checking the OU and displaying the Logo).
2. Add respective label names in Arabic beside English. (Ex: Po Type {Arabic word XXXXX}, PO Number {Arabic word XXXXX}, etc)
3. Currently the report output is shown in Portrait and it has to be changed to Landscape. (Tried by change Landscape options in Concurrent Program definition and SRS window but no luck)

Thanks,
Vijay

Chandra R Matta said...

Hi Vijay,
Hope you are working on RTF template instead of oracle provided XSL for your changes.
If it is RTF, adding logo and changing it dynamically is covered in a chapter - "Inserting Images and Charts" of XDOUserGuide.pdf. Search in google.

Once you design RTF template completely, then export into XSL format(if required).

2. . This you can control n RTF template. Use "Conditional Region" functionality.
3. . You need to change on RTF template.
Goto "Page Layout" , "Orientation" and choose as per your requirement.

hope this helps.

vijay said...

Thank You Chandra,

Now my Customized report is ready and report output is as expected.

How can we send the customized PO report? Since after approving the PO, standard po report is sent to the supplier instead of my customized.

Awaiting for your inputs.

Thanks,
Vijay.

Anonymous said...

Hello!

Really nice tutorial, I'm following it now and didn't found any problems yet.

Altough, I have a question, what do you mean with:
- remove complete text under the tag , as this is not correctly formatted.

I think you missed what tag to search for...

Chandra R Matta said...

Hi Renan,
Those steps are to prepare one sample XML data file, and this xml data file will be used to design your RTF(or any other) template.

What I meant is, when you open log file, you will see lot of other text message along with the XML data in it.
So just remove other unwanted text and extract a valid xml file out of log file.

Hope this helps.

Thx.

Unknown said...

Hi Chandra,

Congratulation for your blog It's very useful for all us.

I need your help.

I need to develop a new layout to purchasing document.

I've followed the steps that you provided.
- Get XML
- Open the XML on XML Publisher (MS-Word)
- Designed the new layout in the MS-WORD based on XML and Save it in .RTF

I have some doubts:
- How translate the labels of the report in another language ?
- How add the flexfields that are on PO Header and Line in the report?
- How add the attachment in the report?
- Do I need really export my report in RTF to XSL ?

Sorry by doubts.

I really appreciate your help.

Cid.
Oracle Consultant at ITC

Chandra R Matta said...

Answers..
1.You need work with XLIFF option for language conversion. Search in the internet for the approach.

2.Do "desc PO_HEADERS_XML" - see if your required flexfields are in the view or not.
If not available you need to modify view definition to include the columns you required. If you read my post again, you will notice that I modified one view to include project details.

For the FFs at line level, you may need to modify line level view - PO_LINES_XML

3. Not sure. Check the package "PO_COMMUNICATION_PVT" in the DB.

4. XSL conversion is no more required it seems. Right now system is supporting RTF templates also.

thanks,

Unknown said...

I followed all the steps suggested by you to customize a new Standard Purchase Order Stylesheet.
My issue now is that some Standard PO are been displayed in this new template and others are not - PO Output for Communication terminate with the error below:

Before setting the bind variables for the default layout in getPOXSL()
Document Template Code :XXPOS_TEMPLATE_OC_PADRAO
Language Code :PTB
Document XSL Contents Tue Jan 22 09:16:52 BRST 2013
Retrieved the Document XSL Tue Jan 22 09:16:52 BRST 2013
Calling the getPOXml method
GenerateDocument::getPOXml() : l_exists 1
GenerateDocument::getPOXml() : m_whichTables MAIN
GenerateDocument::getPOXml()- Calling the POXMLGEN method Tue Jan 22 09:16:52 BRST 2013
GenerateDocument::getPOXml() - Exception
genDoc() : PoPDFExceptionoracle.apps.po.communicate.PoPDFException: PO_PDF_XML_FAILED
oracle.apps.po.communicate.PoPDFException: PO_PDF_XML_FAILED
rolling back the complete program


I changed Data Definition by altering PO_HEADERS_XML and PO_LINES_XML
Could you, please help me with this issue?

Regards
Alessandro Chaves

Chandra R Matta said...

Do you have valid reason to change above views.?
I changed it because I had to incorporate PA related information in it.

Let me know.

Naveen said...

Chandra,

The views behind the Standard PO modification process helped me a lot.

I could accomplish what I started out to, by these views.

Thanks a lot for that.

I have one quick question though, are there any standard views for the Blanket release too.

I need to change the need_by_date format in the PO line locations for the Blanket Release.

Any help on this front would be greatly appreciated.

Thanks.
Lalith

Chandra R Matta said...

@Naveen, Glad to know that it worked for you.
For your question - there is XML view/table called -
PO_LINE_LOCATIONS_XML.

You may try to modify this view and check if it works.

Thanks

Unknown said...

I am running "PO output for communication" report with test = debug, but the report is completing normally, I am not seeing any xml data in log file.
Please suggest

Chandra R Matta said...

Hi Ravi,
Not sure what went wrong in your case, but it should generate XML tags for you.
This XML data will at very last of the log file.
I just executed it from my side and its giving me XML data.

Have you selected all the parameters that are mentioned in the post.?

Have you verified if it generated any XML file by clicking on "Diagnostics" button.
Just have a look at it too.

Also you may try to retrieve the log file from Unix box and verify.

Let me know.

Anonymous said...

How to replace seeded report to custom report.In Po Screen.
Clicking: Inquire-->view document

Unknown said...

Hi

I need to add PREPARER of the Requisition in PO Output Communication PDF.
Can you please help me how to add PREPARER Details.


Thanks
Lohitha

Nith said...

your post helped me. Thanks a ton.

Chandra R Matta said...

You are welcome Marsi.

oracle financials Training said...

Hi,
It's a very nice article,Surely this blog will help to people of oracle Community. I Appreciate for your work,Keep move on with new articles providing useful information like this. Oracle EBS training
Thank you.