You are on page 1of 129

BI Publisher for PeopleSoft Enterprise

XML Publisher Overview

Separate data/ layout/ translation

More flexibility
Data Logic
Reduced maintenance

Layout Template XML Publisher

Translation Report Output


Reporting Tools

Reporting Tools When to consider XMLP instead:

Crystal Reports Close in functionality.


Consider XMLP for new reports.
XML Publisher is not dependent on windows.
nVision Consider XMLP instead of nVision tabular
layouts.
Excel is a supported output type.
SQR Using application engine for data logic and
XMLP for publishing, you can take
advantage of bursting capabilities.
Examples

Some examples of when to use XML Publisher include:


General Ledger an alternative to Crystal for reports containing
chartfields, no customization is required after chart of accounts
configuration.
Billing provides a third print option for invoices.
CRM provides improvements to correspondence management.
HCM Government forms, paychecks, offer letter generation.
XML Publisher Integration

Microsoft Word
Adobe Acrobat
PDF RTF with Plug-in

Template Manager

Template

PSQuery/Co XML Email


nnected qry
HTML
Printer
Data XML XMLP Process
PeopleCode
Handler Engine Scheduler
PDF Repository
Web
Services RTF e-commerce
XML Publisher Phases

Set up XML Publisher

Create and Register Data Sources

Create and Upload Templates

Create XML Publisher Reports

Run and View XML Publisher Reports


Bursting

<PayChecks>
<PayCheck> Bursting by EMPLID
<EmpId>1000</Empld>
<DeptId>01</DeptId>
<Salary>1000</Salary>
</PayCheck>
<PayCheck>
<EmpId>1001</Empld>
<DeptId>01</DeptId>
<Salary>1000</Salary> 1000 1001 1002
</PayCheck>
<PayCheck>
<EmpId>1002</Empld>
<DeptId>02</DeptId> Bursting by DeptID
<Salary>1000</Salary>
</PayCheck>
</PayChecks>
EmpID:
1000 EmpID:
1001 1002

DeptID: 01 DeptID: 02
Translation

Report Definition

Layout 1

Template File
En 01/01/07

XLIFF de

XLIFF es

Layout 2

Template File
En 01/01/07

XLIFF jp
Creating and Registering Data Sources

XML Publisher for PeopleSoft Enterprise


Objectives

By the end of this lesson, you will be able to:


Describe data sources.
Identify or create the source of your report data.
Register schema and sample schema files.
Data Sources

XML Publisher supports the following data sources:

Data Source Description

PeopleSoft Query Queries designed to be used by another reporting


tool.
Connected Query Parent child queries

XML File The Extended Markup Language (XML) is a method


for putting structured data in a text file.
XML uses tags only to delimit data. The
interpretation of that data is entirely up to the
application.
Data Generation

Data Extraction Data Source

PS/Query PS/Query

Application
Engine

Extract
Database SQR
Data

PeopleCode

File Layout XML file


XML File

Data Source

PS/Query XMLP
Internally
Rowset converted formatting engine

XMLDoc
Performance Considerations

Lower Performance

XML File DS XMLDoc DS Rowset DS PSQuery DS

PeopleCode
XML File XMLDoc Rowset
string

PeopleCode
XML File XMLDoc
string

PeopleCode
XML File
string

XML File
PS Query

PS Query provides the following benefits:


Metadata-driven, easiest to maintain.
Empower business users for self-service.
Query security is enforced when the report is run.
A sample xml file and schema are automatically generated.
Demo: Creating Query Data Source

In this demo, we will create a new public query for course listings, name the
query XMLP_TEST.
Use the following information to create the query:

Definition Type Name

Record Sample Table

Fields Sample Fields

Labels Labels
XML File

XML files can be generated using various means, including:


Application Engine programs
SQR Programs
File Layouts
XML File

XML declaration <?xml version="1.0"?>


<root>
Root element <ITEMS> Start tag
<ITEM_CD>PSU001</ITEM_CD>
Data Content <DESCR>Laptop Computer</DESCR>
<PRICE>500.00</PRICE>
</ITEMS>
<ITEMS> End tag
<ITEM_CD>PSU033</ITEM_CD>
<DESCR>Marker - Orange</DESCR>
<PRICE>2.95</PRICE>
</ITEMS>
</root>
Well-Formed XML Document

The XML File can be any well-formed XML file, such that:
An XML document must have one root element
An element must have matching start and end tags names, unless
they are empty elements
Elements can be nested, but can not overlap
All attributes values must be quoted
Attribute names must be unique in the start tag of an element
Comments and processing instructions do not appear inside tags
The < or & special characters cannot appear in the character data of
an element or attribute value
Rowset

A rowset is a data structure used to describe hierarchical data and


consists of a collection of rows.
A scroll area is a rowset that contains the contents of any lower level
scroll plus all of its subordinate buffer data.
Level 0 rowset contains all the data for the entire component.
A rowset object is instantiated from a Rowset class.
Component

Rowset

Row

Fields

Row
Rowset Sample Data XML File

Rowset <?xml version="1.0"?>


rs_ <rs_PO>
<row_PSU_PO_HDR>
<fld_BUSINESS_UNIT>NAM01</fld_BUSINESS_UNIT>
row <fld_ORDER_NBR>00000053</fld_ORDER_NBR>
row_ <row_PSU_PO_DTL>
<fld_ORDER_NBR>00000053</fld_ORDER_NBR>
field <fld_ORDER_LINE_NBR>1</fld_ORDER_LINE_NBR>
fld_ <fld_ITEM_CD>PSU001</fld_ITEM_CD>
<fld_QTY>1</fld_QTY>
<fld_PRICE>1000</fld_PRICE>
</row_PSU_PO_DTL>
</row_PSU_PO_HDR>
</rs_PO>
XMLDoc

The XmlDoc class is used to create and manipulate XML data.


Each XML document has both a physical and a logical structure.
Physically, the XML document is composed of units called entities. A
document begins in a "root" or document entity.
Logically, the XML document is composed of declarations, elements,
comments, character references, and processing instructions .
Data Source

A data source stores the sample XML file and optionally the schema file in
the database.

Sample
XML File
.xml
Preview Report in database

Schema
.xsd

Ability to burst reports


Use PDF template
Data Source Registration

Benefits of data source registration include the ability to:


Reuse the data source with multiple report definitions.
Perform iterative template development.
Preview the template.
Take advantage of built-in bursting functionality when the data
schema file is registered.
Related Files

Related File Sample Data File Schema File

RTF Template Form Field Tag Form Field Tag


insertion insertion Preview

PDF Template Mapping Preview

eText N/A Preview

XSL Template N/A Preview


Generating PS Query Data Source

Use the Register Data Source page with PS Query data source to:
Generate the sample data file.
Download the sample data file to facilitate RTF template creation.
Reporting Tools, XML Publisher, Data Source, Add a New Value

Default Data
Source Type

Select existing
query
Generate Sample Data and Schema

You can generate a sample


data file and schema
Uploading Data Source

For non-query data sources the related sample data and schema files
must be uploaded into the database.
Reporting Tools, XML Publisher, Data Source, Add a New Value, enter
data source type and name, Add

Upload links
Demo: Creating Data Sources

In this activity, we will create new data sources.

Use this table to create the data sources:

Data Source Data Source Sample Data File Schema File


Name Type
COURSE_LIST PS Query COURSE_LIST.xml COURSE_LIST.xsd

CUST_ROWSET Rowset Cust_rowset.xml Cust_rowset.xsd

CUST_DOC XMLDoc Customer_doc.xml Customer_doc.xsd


Review

In this lesson, you learned that:


Data sources can be PeopleSoft queries, rowset objects, XML
document objects, or XML files.
Sample data files and schema are generated for PS Query. All other
data sources, you must first create the sample data file and schema if
necessary.
A data source registers the schema and sample data design files.
Creating Templates

XML Publisher for PeopleSoft Enterprise


Objectives

By the end of this lesson, you will be able to:


Describe template types.
Create RTF template.
Design RTF template.
Create reusable sub-template definitions.
Work with PDF templates.
Template Types

The following template types are supported:


RTF (Rich Text Format)
PDF
eText
XSL
PeopleSoft supplies design helpers for RTF and PDF templates.
Using Microsoft Word

Template Designer Menu

Data Insert Preview Tools Help

Load XML Data Field PDF Field Browser Oracle Template


Load XML Schema Table/Form HTML Validate Builder Help
Load Report Chart EXCEL Translation About Template
SQL Report Wizard All Fields RTF Export Builder
Options
Downloading PS Query Sample File

To create an RTF template for a PS Query sample file:

1.Add a new data source.


2.Generate the sample XML file.
3.Save the sample XML file to a local drive.
4.In Microsoft Word, create the RTF document to use as a template.
5.Load the sample XML data.
6.Insert the fields in the document.
Loading Sample XML Data

When the sample data has been loaded, you will not see the data
displayed until you select one of the Insert options.

To load the sample XML data:


1.In Microsoft Word, select Data, Load XML Data.
2.Select the XML sample data file.
3.You will receive a message that the data was successfully loaded.
4.Click OK.
Insert Menu

The plug-in provides the ability to insert data fields into your document .

Insert Menu Description

Field Allows you to select fields from your data source


and insert them into the template.
Table/Form Allows you to insert tables and forms into your
template.You may insert data fields to be
organized as simple or nested table or as a form
that is repeated with multiple data.
Chart Allows you to insert a chart that is understood by
Oracle XML Publisher.
All Fields Inserts all fields found in the XML data into your
document.
Inserting Fields

To insert fields into the Word document:

1.Select Insert, Field.


2.Position the cursor where you want to insert the field.
3.Select the field from the Field Dialog box.
4.Click Insert.

You can also double-click the field in the dialog box to insert the field.
You can either select another data field or close the dialog by clicking the
Close button .
Field Dialog Box

For a large XML with


a complicated
structure, you can use
the Find functionality
to find a specific field.

Each field from the Sample data is


sample xml doc is displayed
available

You can select the This is used only for


field to be used for languages that print
calculation. right-to-left, such as
Arabic or Hebrew.
Example RTF Template

The form fields are indicated by gray boxes:

File, Save, change type to RTF and name the template.


Form Field Help Text

Double-click on an inserted field and select Add Help Text .


Preview Data

You can preview the report in:


PDF
HTML
Excel
RTF

STUDENT_NAME sample data

You have been confirmed in COURSE_DESCR sample data


course staring 2007-01-17 at the LOCATION sample data
facility.

The address is:


STREET1 sample data
STREET2 sample data
Demo: Creating RTF Template

In this activity, we will create a report template for student confirmation


letters.
Table/Form Dialog Box

The insert table/form dialog box allows you to:


Create a simple or nested table with a variable number of rows.
Associate a group of data elements, such as complex invoice or a
purchase order line, with a form in the document that will be
repeated for each occurrence of the data element.
Group or re-group data.
Table Form Wizard

The wizard guides you through the process:


Step 1: Select Report Format
Step 2: Select Report Data
Step 3: Select Data Fields
Step 4: Group Report
Step 5: Sort Report
Step 6: Headers/Labels
Step 1: Select Report Format

Table

Last Name First Name Phone


Smith John (123) 456-7890

Form

Last Name Smith

First Name John

Phone (123) 456-7890

Freeform
Smith
John
(123) 456-7890
Step 2: Select Report Data

Select the data set to use for the table


Step 3: Select Data Fields

:
Select the data fields that will be shown in your report
Step 4: Group Report

In this step, you can group the report by selected data fields.
Grouping Layout Options
Group Left

Grouping Grouping Header


Header

Grouping
Header 1 Header 2 Header 3 Header 4 Header 5
Field
Data 1 Data 2 Data 3 Data 4 Data 5

Group Above
Grouping Field 1
Header 1 Header 2 Header 3 Header 4 Header 5
Data 1 Data 2 Data 3 Data 4 Data 5
Step 5: Sort Report

You can sort the data in the table by up to 4 different fields


Step 6: Headers/Labels

You can change the default labels / column headers


Table/Form Advanced
The Advanced option uses drag and drop to select the fields to insert into your
template:
Demo: Designing RTF Template with a Table
In this activity, we will use the Query data source XMLP_COURSE_LIST
that we created in an earlier demo to create a template to list courses
grouped by course type.
Sub-Template

Sub-templates can be created that contain formatting and data fields that
are used in multiple templates.
Within a single sub-template file, multiple sub-template components can
be available.
Start and end template indicators must exist to distinguish those various
components.

<?template:component_name?>
<?end template?>

where component_name is the name you assign sub-template.


Sample Sub-Template
For example, syntax of a sub-template file containing two components could
be:

<?template:header?>
XMLP Training
<?end template?>
<?template:address?>
Pleasanton Campus
500 Oracle Lane
Pleasanton, CA 94488
<?end template?>
Importing Sub-Template
Define sub-template

<?template:header?>
XMLP Training
<?end template?>
Define sub-template in
Sub1.rtf Content Library

Sub-Template ID: TRAINING

Sub-Template file: sub1.rtf

Import sub-template
into a template

<?import:psxmlp://TRAINING?>
<?call-template:header?>
Importing Sub-Template

To import a sub-template file that is stored in the Content Library, use


this syntax:

<?import:psxmlp://sub-template_NAME?>
Where sub-template_NAME is the registered sub-template ID in the
Content Library

To preview a sub-template in Word, use this syntax:

Note the triple slashes and the use of the actual file name instead of the
<?import:file:C:///Directory/subtemplate_file.rtf?>
template ID
Calling the Template

Use this syntax to call the template:

<?call-template:template_name?>

Example:
Passing Parameters

By default, PeopleTools( through the ReportDefn class ProcessReport


method) always passes the following parameters/tags:
<?$ReportID?>
<?$ReportTitle?>
<?$RunDate?>
<?$ReportID?>
<?$RunTime?>
Report Template
The declaration is defined in the Help Text

Declaration in
primary template

<xsl:param name="ReportID"
xdofo:ctx="begin"/>
Demo: Adding a Sub-Template
In this activity, we will create a sub-template and use it in our student letter.
Designing PDF Templates

The source of the PDF document does not matter, Possible design options
are:
Design the layout of your template using any application that
generates documents that can be converted to PDF.
Scan a paper document to use as a template.
Download a PDF document from a third-party Web site.
Form Fields on PDF Template

Text Field Properties


dialog box

Forms Toolsbar

Form Field
PDF Guidelines

The following guidelines need to be adhered to when working with PDF


templates whether or not you are mapping PDF template fields and tags:
The PDF document must allow editing.
Files must be Adobe Acrobat 5.0 compatible.
Files must have form fields for the placement of application data, with
each field tag being unique.
Files should not have embedded javascript.
Demo: Creating PDF Template

In this demo, we will convert an RTF template to PDF and add the form
fields.
Review

In this lesson, you learned that:


XML Publisher supports RTF, PDF, eText and XSL templates.
The Template Builder plug-in is used to create RTF templates.
The Table/Form wizard allows you to easily create standard reports.
Sub-templates can be created that contain formatting and data fields
that are used in multiple templates.
PDF templates contain form fields that will display the data from the
XML input file.
Defining XML Publisher Reports

XML Publisher for PeopleSoft Enterprise


Objectives

By the end of this lesson, you will be able to:


Describe report definitions.
Create report definitions.
Burst reports.
Use Content Library.
Maintain template translations.
Report Definitions

Report definitions are used to:


Associate a data source with a template.
Define output options.
Grant security to view report.
Define bursting options.
Report Definition Pages

Page Description

Definition Identifies the data source and report name. Properties


define the report status, report category and template
type.

Template Identifies the templates associated with the report. As well


the channels (web posting, printer, fax, and so on)
associated with the specific template.

Output Identifies the output options that will be available when the
reports is run.

Security Identifies by role or user ID who can view the report once
it has been run.

Bursting Identifies busrting rules when this feature is used to


generate report results in separate output files when
bursted reports are run through Process Scheduler.
Creating a New Report Definition
PS Query
Reporting Tools, XML Publisher, Report Definition

Data Source Type = PS Query

Select an existing Query


The data source will
automatically be generated
when you save the report.
Definition Page

Status must be Active in


order to run the report

The template type can not


be changed once you save
the report definition

You can download the


sample data file for template
creation
Template Page

A report may have multiple templates . Multiple templates can


be assigned

Template name is generated

web posting,
printer, fax

Multiple effective-dated templates


can be assigned.

At lease one template must Use this button to upload an The preview button uses
be active in order to save a existing template the sample xml data file
report definition to generate report output
Output Page

Whether the internal Adobe flag of a PDF report output


file has the setting turned on to allow editing.

Which output types


Default
will be available to
displayed at
the user
runtime on
prompt or run
control
Output Format Options
Based on the template type, the output options are as follows:

Template Type Output Options

RTF pdf, html, rtf, xls (html)

PDF pdf

Etext txt

XSL pdf, html, rtf, xls (html)


Security Page
Use the Security page to:
Indicate whether the report requestor can add to the standard
Distribute To values on the Process Scheduler Request, Distribution
Detail page.
Define the roles or users who can:
View web-posted output in the Report Manager repository.
Use the XML Publisher Report Repository Search page.
Demo: Creating Report Definitions
In this demo, we will create two report definitions one for student letter and
one for course listing.
Mapping PDF Files
Mapping are required when:
Third party PDF templates, where the form fields already exist inside
the form template.
PDF template where the form field use different XML data element
tags than your data source.

If you create PDF and name tags that are the same to begin with in your
PDF file, no mapping is necessary.
The map file should have a name that distinguishes it from the
unmapped file.
For example, the template file XRFWIN.pdf would have a map file
XRFWINm.pdf.
Generating Map File

Generates a map file


named
Certificate1m.pdf
Map File
The schema and sample data are placed into the PDF template
file to enable you to access the data tags for performing visual
mapping offline within the Adobe application.
Demo: Creating a Report Definition Using PDF Template

In this demo, we will create a report definition using a PDF template for
student certificates.
Bursting

When you generate a bursted report, separate document files are created
for each unique data value for a specified field tag.

<row rownumber="1">
<BU>NAM01</BU>
<LOC>TEA</LOC>
</row>
<row rownumber="2">
NAM01
<BU>NAM01</BU>
<LOC>PHI</LOC>
</row>
<row rownumber="3">
<BU>NAM02</>
<LOC>ATL</LOC>
</row>
NAM02
Bursting Page

Data attribute to burst by

Template or
translation for
each burst file
assigned at
runtime

Report file
security
assigned at
runtime

Search key data values


Burst By

The reports data source must have an associated schema file. The
schema is used to:
Identify the highest level repeating group (node) in the XML source.
Identify node tags.
Schema

<?xml version="1.0"?>
<xs:schema id="STUDENT" targetNamespace="http://tempuri.org/STUDENT.xsd
xmlns="http://tempuri.org/STUDENT.xsd" xmlns:xs="http://www.w3.org/2001/
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="STUDENT" msdata:IsDataSet="true" msdata:
<xs:complexType>
<xs:choice maxOccurs="unbounded"> Highest level
<xs:element name="PSU_STUDENT_TBL">
repeating node
<xs:complexType>
<xs:sequence>
Fields <xs:element name="STUDENT_ID" type="xs:string" minOccurs="0" />
available <xs:element name="STUDENT_NAME" type="xs:string" minOccurs="0" />
to Burst <xs:element name="CUSTOMER_ID" type="xs:string" minOccurs="0" />
By <xs:element name="PSU_STUDENT_EXP" minOccurs="0" maxOccurs
<xs:complexType>
<xs:sequence>
<xs:element name="STUDENT_ID" type="xs:string" minOccurs="0" />
<xs:element name="SKILL" type="xs:string" minOccurs="0" />
Template
This feature dynamically drives the template assignment at runtime based
upon the data value of a designated schema tag.

Field Description

Template controlled by Indicate the field with the template translation


preference.
Data Value Enter a row for each data value that requires a
specific template or template translation.
Template ID A template ID should be selected for each data
value that requires a special template.
Language (Optional) Select a language code for the desired
translation of the template then the specified
data value is found in the XML data.
Search Keys

Delivered search keys include:


Burst By
Report Definition Name
Generated On Date
Additional search keys may be defined to provide even more specific
.
granularity
Content Library Page
The Content Library is a component provided for the registration of
reusable sub-template files.
Reporting Tools, XML Publisher, Content Library
Runtime

The complete template (primary and sub-templates) is systematically


assembled by the XML Publisher engine during report generation. The
same occurs during online previewing as long as the sub-template file
exists.
The report in which the sub-template is placed must have a related data
source that supplies data for form fields on the sub-template or the data
must be passed in as runtime parameters.

Runtime parameters
Demo: Registering Sub-Template
In this demo, we will register the sub-template we created for the student
letter and update the report definition to use the template that contains the
sub-template.
Translations
Localization Interchange File Format (XLIFF) .xlf file processing is used
for translations:

Report Definition

Template file en 01/01/2006


Layout 1

XLIFF de

XLIFF es

Layout 2 Template file en 01/01/2007

XLIFF jp
Translation Components

The Template Translation component interfaces with both report


definition templates and Content Library sub-templates.
Template translation files can be created only when a reports template
type is RTF.
Template Translation is a separate component with no row level security,
as the target user is different from the report developer, requestors, or
viewers.
Advanced Search

Reporting Tools, XML Publisher, Translations,Advanced Search


Running and Viewing Reports

XML Publisher for PeopleSoft Enterprise


Objectives

By the end of this lesson, you will be able to:


Run reports in Query Report Viewer.
Schedule PS Query reports.
Locate and view XML Publisher reports.
Run reports using PeopleCode.
Run reports from application engine.
Query Report Viewer

Reporting Tools, XML Publisher, Query Report Viewer

Bursted reports are listed, but


they arent executable

select the report format

Existing Query security applies so that each user has access to run only
the reports to which he or she has qualified Query access to the data
source.
Query Report Scheduler

Query Report Scheduler uses the existing Process Scheduler functionality


to:
Select runtime parameters for query-based reports.
Monitor the report process request.
Post and secure the results to the Report Manager, a printer, or the
Process Scheduler file directory.
Query Report Scheduler Page

Reporting Tools, XML Publisher, Query Report Scheduler

Select the report

Prompts will be displayed


for selected report
Process Scheduler Request Page

Format Types defined


on Output page

Type based on location on Output page

Allow viewer
ID assignment
at report run
time
XML Publisher Report Repository

The XMLP Report Search page allows you to filter criteria to search for reports.
Reporting Tools, XML Publisher, XML Report Search
XMLP Report Search

You can use additional Search keys defined in the report definition to
narrow down the search:

Burst by field

Additional
Search
fields
Report Manager
In Report Manager, you can also search for reports using filters.
Reporting Tools, Report Manager
Demo: Running Query Reports

In this activity, you will review the activity overview and:


View reports in the Query Report Viewer.
Schedule Query reports.
Search for reports.
View reports in Report Manager.
XML Publisher Classes

PSXP_XMLGEN
Prepare Data
(XML Generation Classes)

PSXP_RPTDEFNMANAGER
(Report Definition Manager Classes)
Generate and Route
Reports
PSXP_ENGINE
(Engine Classes)

Search Reports PSXP_REPORTMGR


Repository (Report Search Classes)
Application Packages
For importing the XML Publisher classes, PeopleSoft recommends that you
import all the classes in the application package .

Class Category Application Package

Report Manager definition classes PSXP_RPTDEFNMANAGER

Report search manager classes PSXP_REPORTMGR

XML generation classes PSXP_XMLGEN

XML Publisher engine classes PSXP_ENGINE


Importing Classes

An import statement names either all the classes in a package or one


particular application class.
Your import statements should look like the following:

import PSXP_RPTDEFNMANAGER:*;
import PSXP_REPORTMGR:*;
import PSXP_XMLGEN:*;
import PSXP_ENGINE:*;

Using the asterisks after the package name makes all the application
classes directly contained in the named package available. Application
classes contained in subpackages of the named package are not made
available.
Publishing a Report

data for the report.


Process the report.
Publish the reporTo generate and publish a report, the PeopleCode will:
Import the appropriate application class.
Initialize variables.
Instantiate the report definition object and initialize it.
Specify the t.
Sample PeopleCode to Publish

1. Import the appropriate application class.

import PSXP_RPTDEFNMANAGER:*;

2. Initialize the variables.

Local XMLDoc &xmlDoc;


Local string &rptDefnId = "Financial";
Local string &LangCode = %Language_User;
Local string &effdt = "2004-4-1";
Local string &output = "HTM";
Local String &reportPath = GetEnv("PS_SERVDIR") |
"\files\reports";
Local String &folder = "General";
Local string &serverName = "PSNT";
Local ReportDefn &rptDefn;
Sample PeopleCode to Publish (continued)

3. Instantiate the report definition object and initialize it.

&rptDefn = Create ReportDefn(&rptDefnId);


&rptDefn.Get();
4. Specify the data for the report.

&rptDefn.SetRuntimeDataXMLDoc(&xmlDoc);

5. Process the report.

&rptDefn.ProcessReport("", &LangCode, &effdt, &output);

6. Publish the report.

&rptDefn.Publish(&serverName, &reportPath, &folder, 0);


Set Runtime Data Methods

Report definitions that use a data source other than a PeopleSoft query
must set the data source before generating the report using the
ProcessReport method.
Depending on your data source, you can use one of the following
methods to specify the data:

Data Source Method syntax

PSQuery SetPSQueryPromptRecord(&Record)

XML file SetRuntimeDataXMLFile(FilePath)


ProcessReport

Use the ProcessReport method to generate a report and store the


information.
Syntax

ProcessReport(TemplateId, LangCD, AsOfDate,


OutputFormat)

For example, to process a report in htm format use:

&oRptDefn.ProcessReport("", "", %Date, "HTM");

You can use quotes to take the default value from the report definition.
Publish

Use the Publish method to publish the current report definition


Syntax

Publish(ServerName, ReportPath, FolderName,


ProcessInstanceId))

For example:

&oRptDefn.Publish("", &path, &folder, 0);


Displaying a Report

You can display a report online using the DisplayOutput method, commit
prior to issuing the DisplayOutput.

/************* Main *************/


&Rowset = GetLevel0();
****** Instantiate report defn and initialize it*****/
&oRptDefn = create PSXP_RPTDEFNMANAGER:ReportDefn(&Rpt);
&oRptDefn.Get();
/**** Specify the data for the report *****/
&oRptDefn.SetRuntimeDataRowset(&Rowset);
/***** process report *****/
&oRptDefn.ProcessReport("", "", %Date, "");

/***** Display the output online *****/


CommitWork();
&oRptDefn.DisplayOutput();
Demo: Running Reports from PeopleCode

In this demo, we will:


Define the customer rowset-based report.
Define the customer XMLDoc-based report.
Complete the PeopleCode.
Run the XMLP reports from a page.
Application Engine Program

Using the same XML Publisher PeopleCode classes, you can create an
application engine program to run XML Publisher reports.
To run the application engine program through the Process Scheduler,
you will need to:
Create a new Run Control page or associate the application engine
program with an existing Run Control page.
Create a Process Definition.
Example: Application Engine Program to Run XML
Publisher Report

Step: RunCtrl - SQL

%Select(PT_XRFWIN_AET.OPRID,
PT_XRFWIN_AET.RUN_CNTL_ID,
PT_XRFWIN_AET.LANGUAGE_CD)
SELECT OPRID
, RUN_CNTL_ID
, LANGUAGE_CD
FROM %Table(PRCSRUNCNTL)
WHERE OPRID = %OperatorId
AND RUN_CNTL_ID = %RunControl
Example: Application Engine Program to Run XML
Publisher Report

Step ExecRpt PeopleCode


import PSXP_RPTDEFNMANAGER:*;

/* XML Publisher report using query data source */


Local PSXP_RPTDEFNMANAGER:ReportDefn &oRptDefn;

/* create report definition */


&oRptDefn = create PSXP_RPTDEFNMANAGER:ReportDefn("XRFWIN");
&oRptDefn.Get();

/* specify output destination when output type is file */


If %OutDestType = 2 Then /* file */
&oRptDefn.OutDestination = %FilePath;
End-If;
Example: Application Engine Program to Run XML
Publisher Report
continued

/* process report */
&oRptDefn.ProcessReport("", PT_XRFWIN_AET.LANGUAGE_CD,
%Date, &oRptDefn.GetOutDestFormatString(%OutDestFormat));

/* send output to destination */


If %OutDestType = 6 Then /* Web */
&oRptDefn.Publish("", "", "",
PT_XRFWIN_AET.PROCESS_INSTANCE);
Else
If %OutDestType = 3 Then /* Printer */
&oRptDefn.PrintOutput(%FilePath);
End-If;
End-If;
Process Definition
When you create the process definition use process type XML Publisher.

XML Publisher
Process name is same as application
engine program name
Creating File Layouts

To create a file layout for XML output:


Create a new file layout.
Insert the records or segments.
Select File, Definition Properties, Use tab.
Select XML for the file output and enter the File Definition Tag.
For records and fields, you can change the tags if desired.
Save the file layout
Sample File Layout

Multi-level file layout

File layout type

Tag value for root


node
Using File Layout for XML Publisher Report

The application engine program can create the XML file and then publish
an XMLP report using that data source:

File Layout
Output format XML file

PeopleCode to write file


using File Layout

PeopleCode to publish
report based on XML File
data source
Methods to Write to Files

The File Class contains methods to write to files defined by a file layout
definition:
WriteRecord(record)
WriteRowset(rowset)
PeopleCode to Write XML File

Local File &MYFILE;


Local Record &recl;
Local SQL &SQL1;
/*** Create an Instance of the record ***/
&recl = CreateRecord(Record.PSU_COURSE_TBL);
/*Create an instance of the file and set File Layout */
&MYFILE = GetFile("E:\temp\COURSE_OUT.txt", "A",
%FilePath_Absolute);
&MYFILE.SetFileLayout(FileLayout.COURSE_FILE);
/* Create SQL object to retrieve the values */
&SQL1 = CreateSQL("%selectall(:1)", &recl);
/* Loop through the record and write the record to file */
While &SQL1.Fetch(&recl)
&MYFILE.WriteRecord(&rec1);
End-While;
/* Close the file */
&MYFILE.Close();
Demo: Running XMLP Report from Application
Engine Program

In this demo, we will:


Create a new data source.
Create a new template.
Define the Student Experience report.
Modify the application engine program.
Run XMLP report from an application engine program
Review
In this lesson, you learned that:
XML Publisher reports that have a data source of PS Query can be
selected and viewed using the Query Report Viewer.
The Query Report scheduler page can be used to schedule XML
Publisher Reports with a data source of PS Query.
You can view XML Publisher reports using XMLP Report Search or
Report Manager.
The XML Publisher classes enable you to access the runtime portions
of the XML publishing process programmatically, that is, after the
templates and reports have been created.
The XML Publisher classes can be used in application engine
programs to publish XML Publisher reports.

You might also like