Thursday, 13 February 2014

Generate XML Report using Peoplecode



Generate XML Report using Peoplecode (PSQUERY as Data Source)

  • Import Report definition manager Application classe.
  • Create a new report definition object using the XML Publisher Report ID.
  • Call the Process Request method using the Template ID.
  • Display the generated output report.

Report File Generation Sample: 

import PSXP_RPTDEFNMANAGER:ReportDefn;

Local PSXP_RPTDEFNMANAGER:ReportDefn &oRptDefn;
Local string &ReportId = "MYXML_RPT";
Local string &TemplateId = "MYXML_TMPL";

&oRptDefn = create PSXP_RPTDEFNMANAGER:ReportDefn(&ReportId);
&oRptDefn.Get();
&rcdQryPrompts = &oRptDefn.GetPSQueryPromptRecord();
If Not &rcdQryPrompts = Null Then
         Rem &rcdQryPrompts.EMPLID.Value = “XYZ”;
               &oRptDefn.SetPSQueryPromptRecord(&rcdQryPrompts);
End-If;
&sOutDestFormat = &oRptDefn.GetDefaultOutputFormat();
 
&oRptDefn.ProcessReport(&TemplateId, "", %Date, &sOutDestFormat);
CommitWork();
&oRptDefn.DisplayOutput();