XML Publisher - Example
program using Row set as Data source taking JOB and COMPENSATION delivered
table
Step 1:
Create an App engine
to supply: a) XML Sample Data File
b) XSD Schema File
Following code to populate Row set in app engine (People
code Action)
import PSXP_RPTDEFNMANAGER:*;
import PSXP_XMLGEN:*;
/*Create Rowset*/
&rs_comp = CreateRowset(Record.COMPENSATION);
&rs_job = CreateRowset(Record.JOB, &rs_comp);
/*Fill Parent Rowset*/
&rs_job.FILL("WHERE EMPLID LIKE 'K0G00%'");
/*Fill child Rowset*/
For &i = 1 To &rs_job.ActiveRowCount
&row =
&rs_job.GetRow(&i);
&rs =
&row.GetRowSet(Scroll.COMPENSATION);
&rs.Fill("WHERE EMPLID = :1", &row.JOB.EMPLID.Value);
End-For;
/*Create Schema XSD */
&rds = create PSXP_XMLGEN:RowSetDS(); /*example package
method*/
&mySchema = &rds.GetXSDSchema(&rs_job);
&f1 = GetFile("c:\temp\JOB_XSD.xsd",
"W", %FilePath_Absolute);
&f1.WriteLine(&mySchema);
&f1.Close();
/*Create Sample XML File*/
&myXMLFile = &rds.GetXMLData(&rs_job,
"c:\temp\JOB_XSD.xsd");
&f2 = GetFile("c:\temp\JOB_XML.xml",
"W", %FilePath_Absolute);
&f2.WriteLine(&myXMLFile);
&f2.Close();
Step 2:
Execute the above
code following XML file and XSD
file will be generated in the above
mention path in the code i;e
"c:\temp\JOB_XML.xml"
Step 3:
Create an RTF
Template file using XML sample data file
in ms-word
Step 4:
With in People soft (3 tire) create a) Data source Definition
b) Report Definition
a) Data source Definition path
Reporting Tools –XML Publisher-Data Source.
Add new value - Data source type : Rowset
Data Source id
: any name
Object Owner id : Human Resources
Upload XML file and XSD File.
Step 4: b) Report Definition.
path Reporting Tools –XML
Publisher-Report Definition.
Add new value – Report Name :
Any Name
Data Source id
: above given name (rowset name)
In Definitaion Tab:
Report
Status: Active
Object Owner id:
Human Resources
In Template Tab:
Status : Active
Upload: RTF file which is created using XML sample
data.
In Out Put Tab: Location
: File Destination : any path (eg: c:\temp)
Step 5 :
Update Your app engine with the following code to output
full data then run it by scheduling it app engine
import PSXP_RPTDEFNMANAGER:*;
import PSXP_XMLGEN:*;
Local PSXP_RPTDEFNMANAGER:ReportDefn &ReportID;
/*Set-Up Report */
&ReportDef = create PSXP_RPTDEFNMANAGER:ReportDefn("Report
name given in step4")
&ReportDef.Get();
………….above code…………in step 1…………..
/*Provide a Data Source for the Report*/
&ReportDef.SetRuntimeDataRowset(&rs_job);
/*Generate the Report*/
&ReportDef.ProcessReport("Templete name in template
tab", "ENG", %Date, "PDF");
/*Publish the Report */
// is_job_aet is a state record
&ReportDef.Publish("", "c:\temp\",
"XMLP", IS_JOB_AET.PROCESS_INSTANCE);
Note: the output of
XML Publisher report doesn’t go to process monitor .instead report manager
Hi Ismail....This is really good...thank q....
ReplyDelete