Vous êtes sur la page 1sur 14

An Oracle White Paper October 2011

Procedure for Designing XMLP Report Templates

Oracle White Paper - Procedure for Designing XMLP Report Templates

Disclaimer
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracles products remains at the sole discretion of Oracle.

Oracle White Paper - Procedure for Designing XMLP Report Templates

Table of Contents
Introduction ......................................................................................... 1 Designing XMLP Report Templates .................................................... 2 Example .............................................................................................. 2 1. Create and upload schema and sample data. ......................... 2 2. Define the report by associating a data source with the layout template file. .................................................... 4 3. Create an application engine program using XMLP PeopleCode APIs. ........................................................ 6 4. Create an XML Publisher-type process definition for the AE program and link to the run control for the report. ............. 9 5. Navigate to the report component and run the report.............. 9 Conclusion ........................................................................................ 10

Oracle White Paper - Procedure for Designing XMLP Report Templates

Introduction
This white paper describes the process used to create common global report templates for use with XML Publisher (XMLP). The common global report templates are intended for use by Oracles PeopleSoft and Oracle R12 eBusiness Suite (EBS), as well as Oracles Fusion. The example shown here outlines the steps for using an EBS report template as the basis for designing a common report template for both EBS and PeopleSoft using XML Publisher. See also PeopleSoft Global Options and Reports 9.1 PeopleBook Update: Introducing Standardized Global XMLP Reports for PeopleSoft and EBS, available on Oracles My Oracle Support website. Related software changes are posted in Global Components 9.1 Bundle #8 on Oracles My Oracle Support website.

Oracle White Paper - Procedure for Designing XMLP Report Templates

Designing XMLP Report Templates


The following example shows steps followed to design XMLP common templates for use by PeopleSoft and EBS, using XML Publisher. In this example, an existing EBS report layout in rtf format is converted into an XMLP report template. For more information about each of the required steps, refer to PeopleTools 8.51 PeopleBook: XML Publisher for PeopleSoft Enterprise.
TABLE 1. ADDITIONAL INFORMATION FOR CREATING XML TEMPLATES AND REPORTS

STEP

REFERENCE

Create and upload schema and sample data.

See PeopleTools 8.51 PeopleBook: XML Publisher for PeopleSoft Enterprise, Creating Data Sources.

Download sample data from the appropriate data source to facilitate template design. Define reports by associating data sources with layout template files. Create an application engine program using XMLP PeopleCode APIs. View XML Publisher reports in the Report Manager.

See PeopleTools 8.51 PeopleBook: XML Publisher for PeopleSoft Enterprise, Defining Reports. See PeopleTools 8.51 PeopleBook: XML Publisher for PeopleSoft Enterprise, Defining Reports. See PeopleTools 8.51 PeopleBook: XML Publisher for PeopleSoft Enterprise, Running Reports Using PeopleCode. See PeopleTools 8.51 PeopleBook: XML Publisher for PeopleSoft Enterprise, Viewing Reports.

Example
For your reference, the following example steps through the design process.

1. Create and upload schema and sample data.


First, create an XMLP data source as an XML file and upload the sample XML file into the data source definition. Access the Data Source page (Reporting Tools, XML Publisher, Data Source, Data Source).

Oracle White Paper - Procedure for Designing XMLP Report Templates

Figure 1. Example of Populated Fields on the Data Source Page

Requirements for the structure of XML sample data file include: Must consist of a root node with one repeating group.

Elements should have textual content. Element should not be empty. All expected elements must be included. All text elements should contain default values. All defined elements can be used for mapping.

Oracle White Paper - Procedure for Designing XMLP Report Templates

This is an example of a sample XML file used as a data source:


<myroot> <REPORTING_MODE>RPRN</REPORTING_MODE> <LE_PERIOD_START_DATE>1900-01-01</LE_PERIOD_START_DATE> <LE_PERIOD_END_DATE>2010-08-27</LE_PERIOD_END_DATE> <LE_COMPANY_NAME>SPN01V</LE_COMPANY_NAME> <LE_REGISTRATION_NUM>A08124000</LE_REGISTRATION_NUM> <LE_TAX_PAYER_ID>A08124000</LE_TAX_PAYER_ID> <LE_FUNC_CURR>ESP</LE_FUNC_CURR> <ENTITY_IDENTIFIER>SPN01V</ENTITY_IDENTIFIER> <P_START_INV_SEQUENCE>1</P_START_INV_SEQUENCE> <REC_COUNT>5</REC_COUNT> <G_JEESRPVP_INVOICE> <DS_NAME_CT_DOC_SEQUENCE_VALUE>200006000002</DS_NAME_CT_DOC_SEQ UENCE_VALUE> <INVOICE_DATE>2000-06-20</INVOICE_DATE> <INVOICE_NUM>APS04</INVOICE_NUM> <VENDOR_NAME>Nishimura Industries</VENDOR_NAME> <G_JEESRPVP_INVOICE_AMOUNT> <NAME_SUP>SP7</NAME_SUP> <NET_AMT1_FMT>11920</NET_AMT1_FMT> <TAX_RATE>0</TAX_RATE> <TAX_AMT_REC_FMT>0</TAX_AMT_REC_FMT> <TAX_AMT_NON_REC_FMT>0</TAX_AMT_NON_REC_FMT> <GROSS_AMOUNT_FMT>11920</GROSS_AMOUNT_FMT> </G_JEESRPVP_INVOICE_AMOUNT> </G_JEESRPVP_INVOICE> <G_JEESRPVP_INVOICE> <DS_NAME_CT_DOC_SEQUENCE_VALUE>200006000003</DS_NAME_CT_DOC_SEQ UENCE_VALUE> <INVOICE_DATE>2000-06-15</INVOICE_DATE> <INVOICE_NUM>APS05</INVOICE_NUM> <VENDOR_NAME>Grobeurt Computers</VENDOR_NAME> <G_JEESRPVP_INVOICE_AMOUNT> <NAME_SUP>SP1</NAME_SUP> <NET_AMT1_FMT>555519</NET_AMT1_FMT> <TAX_RATE>16</TAX_RATE> <TAX_AMT_REC_FMT>88883</TAX_AMT_REC_FMT> <TAX_AMT_NON_REC_FMT>0</TAX_AMT_NON_REC_FMT> <GROSS_AMOUNT_FMT>644402</GROSS_AMOUNT_FMT> </G_JEESRPVP_INVOICE_AMOUNT> </G_JEESRPVP_INVOICE> </myroot>

2. Define the report by associating a data source with the layout template file.
First, create the XMLP report definition based on data source shown in the previous step. Access the Report Definition page (Reporting Tools, XML Publisher, Report Definition, Definition).

Oracle White Paper - Procedure for Designing XMLP Report Templates

Figure 2. Example of the Report Definition Page

Next, attach the EBS report template. Access the Report Definition Template page (Reporting Tools, XML Publisher, Report Definition, Template).

Figure 3. Example of the Report Definition - Template Page

Oracle White Paper - Procedure for Designing XMLP Report Templates

Notice that the template file, SpanishInputVatJournalReport.rtf has been uploaded and the Upload button is no longer available.

3. Create an application engine program using XMLP PeopleCode APIs.


Create a new application engine (AE) program to generate the XML file required by the EBS report template. You can use the following steps to generate an XML file in the AE program: a. Use PeopleCode function CreateXmlDoc to instantiate the new XML file: &inXMLDoc = CreateXmlDoc("<?xml version='1.0'?><myroot/>");
b. Create new SQL objects to retrieve data from tables: &SqlQry1 = GetSQL(SQL.VATX700, &Prcs_Instance, VATX_XMLP_ AET.RUN_CNTL_ID.Value);

This is the sample SQL definition:


SELECT DISTINCT TO_CHAR (A.RPT_FROM_DT, 'YYYY-MM-DD'), TO_CHAR (A.RPT_THRU_DT, 'YYYY-MM-DD'), VE.DESCRSHORT, VR.VAT_RGSTRN_ID, VR.LOC_RGSTRN_ID, C.CURRENCY_RPTG, CR.VAT_RPT_TYPE_CD, C.VAT_ENTITY FROM PS_VAT_RPT_INST1 A, PS_VAT_RPT_INST2 B, PS_VAT_TXN_TBL C, PS_VAT_ENTITY VE, PS_VAT_ENT_RGSTRN VR, PS_VAT_RPT_INST_CR CR WHERE A.PROCESS_INSTANCE = :1 AND A.PROCESS_INSTANCE = B.PROCESS_INSTANCE AND C.VAT_ENTITY = VE.VAT_ENTITY AND A.VAT_RPT_ID = B.VAT_RPT_ID AND B.VAT_ENTITY = C.VAT_ENTITY AND A.VAT_ENTITY = C.VAT_ENTITY AND C.VAT_ENTITY = VR.VAT_ENTITY AND VR.COUNTRY = 'ESP' AND B.COUNTRY_VAT_RPTG = C.COUNTRY_VAT_RPTG AND B.VAT_RPT_LINE_NBR <> 7 AND CR.ORIG_PROC_INSTANCE = A.PROCESS_INSTANCE AND A.VAT_RPT_ID = CR.VAT_RPT_ID AND A.COUNTRY_VAT_RPTG = CR.COUNTRY_VAT_RPTG AND A.VAT_ENTITY = CR.VAT_ENTITY AND CR.OPRID = %OperatorId AND CR.RUN_CNTL_ID = :2

Oracle White Paper - Procedure for Designing XMLP Report Templates

c. Create XML tags with EBS fieldnames and link data retrieved in the previous step

to corresponding EBS fields:


While &SqlQry1.Fetch(&LE_PERIOD_START_DATE, &LE_PERIOD_END_DATE, &LE_COMPANY_NAME, &LE_REGISTRATION_NUM, &LE_TAX_PAYER_ID, &LE_FUNC_CURR, &REPORTING_MODE, &ENTITY_IDENTIFIER) &HDNode = &inXMLDoc.DocumentElement.AddElement("REPORTING_MODE"); &textNode = &HDNode.AddText(&REPORTING_MODE); &HDNode = &inXMLDoc.DocumentElement.AddElement("LE_PERIOD_START_DATE"); &textNode = &HDNode.AddText(&LE_PERIOD_START_DATE); &HDNode = &inXMLDoc.DocumentElement.AddElement("LE_PERIOD_END_DATE"); &textNode = &HDNode.AddText(&LE_PERIOD_END_DATE); &HDNode = &inXMLDoc.DocumentElement.AddElement("LE_COMPANY_NAME"); &textNode = &HDNode.AddText(&LE_COMPANY_NAME); &HDNode = &inXMLDoc.DocumentElement.AddElement("LE_REGISTRATION_NUM"); &textNode = &HDNode.AddText(&LE_REGISTRATION_NUM); &HDNode = &inXMLDoc.DocumentElement.AddElement("LE_TAX_PAYER_ID"); &textNode = &HDNode.AddText(&LE_TAX_PAYER_ID); &HDNode = &inXMLDoc.DocumentElement.AddElement("LE_FUNC_CURR"); &textNode = &HDNode.AddText(&LE_FUNC_CURR); &HDNode = &inXMLDoc.DocumentElement.AddElement("ENTITY_IDENTIFIER"); &textNode = &HDNode.AddText(&ENTITY_IDENTIFIER); End-While; &HDNode = &inXMLDoc.DocumentElement.AddElement("P_START_INV_SEQUENCE"); &textNode = &HDNode.AddText(1); &HDNode = &inXMLDoc.DocumentElement.AddElement("P_PERIOD"); &textNode = &HDNode.AddText(""); &HDNode = &inXMLDoc.DocumentElement.AddElement("P_TAX_TYPE"); &textNode = &HDNode.AddText(""); &HDNode = &inXMLDoc.DocumentElement.AddElement("P_REGISTER_TYPE"); &textNode = &HDNode.AddText(""); &HDNode = &inXMLDoc.DocumentElement.AddElement("C_INVOICES_PRINTED"); &textNode = &HDNode.AddText(""); &HDNode = &inXMLDoc.DocumentElement.AddElement("REC_COUNT"); d. Provide the generated XML file as input for the report definition created in Step

2.

Oracle White Paper - Procedure for Designing XMLP Report Templates

&FilePath = "VATX0700" | VATX_XMLP_AET.PROCESS_INSTANCE | ".xml"; &result = &inXMLDoc.GenXmlFile(&FilePath); &REPORT_DEFN = create PSXP_RPTDEFNMANAGER:ReportDefn("VATX0700S"); &REPORT_DEFN.Get(); &REPORT_DEFN.SetRuntimeDataXMLFile(&FilePath); &REPORT_DEFN.ProcessReport("VATX0700S_1", VATX_XMLP_AET.LANGUAGE_CD, %Date, &REPORT_DEFN.GetOutDestFormatString(%OutDestFormat)); If %OutDestType = 6 Then &REPORT_DEFN.Publish("", "", "", VATX_XMLP_AET.PROCESS_INSTANCE); Else If %OutDestType = 3 Then &REPORT_DEFN.PrintOutput(%FilePath); End-If; End-If;

Oracle White Paper - Procedure for Designing XMLP Report Templates

4. Create an XML Publisher-type process definition for the AE program and link to the run control for the report.

Access the Process Definitions Options page (PeopleTools, Process Scheduler, Processes, Process Definition Options).

Figure 4. Example of the Process Definition Options Page

5. Navigate to the report component and run the report.

For example, access the VAT Reports page (VAT and Intrastat, Value Added Tax, VAT Reports, Return and Other Reports, VAT Reports).

Figure 5. Example of the VAT Reports Run Control Page

Run the report and review results.

Oracle White Paper - Procedure for Designing XMLP Report Templates

Conclusion
Report layouts can be easily designed by copying existing templates and customizing them, as shown in this example, or by creating new templates. PeopleSoft 9.1 delivers 15 newly standardized global XMLP templates to help align Oracle products. Users can implement this design process for creating and customizing additional report layouts.

10

Procedure for Designing XMLP Report Templates October 2011 Author: Venkat Ramana Reddy Basireddy Contributing Authors: Venkatesh Balakrishna, Howard Gee, Praveen Kumar, Gerhard Schmidt Oracle Corporation World Headquarters 500 Oracle Parkway Redwood Shores, CA 94065 U.S.A. Worldwide Inquiries: Phone: +1.650.506.7000 Fax: +1.650.506.7200 oracle.com

Copyright 2011, Oracle and/or its affiliates. All rights reserved. This document is provided for information purposes only and the contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or fitness for a particular purpose. We specifically disclaim any liability with respect to this document and no contractual obligations are formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without our prior written permission. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. UNIX is a registered trademark licensed through X/Open Company, Ltd. 1010