Search This Blog

Tuesday, March 12, 2013

XML Publisher Passing Run Control values to PS Query as Data Source

XML Publisher.
Data Source:  PS query

Below is the code to pass values from Application Engine State Record to PS Query prompt record.
Input values are FromDate and ThruDate.

The XML Publisher then runs the report based on input values and generates the output.


import PSXP_RPTDEFNMANAGER:*;
local string &sRptDefn = ‘PAYROLL_RPTDFN’;
/* get report definition object */
&oRptDefn = create PSXP_RPTDEFNMANAGER:ReportDefn (&sRptDefn);
&oRptDefn.Get();

/* fill query runtime prompt record */
&rcdQryPrompts = &oRptDefn.GetPSQueryPromptRecord();
&FieldName1 = &rcdQryPrompts.GetField(1).Name;
&FieldName2 = &rcdQryPrompts.GetField(2).Name;

/* MessageBox(0, "", 0, 0, "The First field name is : " | &FieldName1); */
/* MessageBox(0, "", 0, 0, "The Second field name is : " | &FieldName2); */

&rcdQryPrompts.GetField(1).Value = PS_PAYROLL_AET.FROM_DATE;
&rcdQryPrompts.GetField(2).Value = PS_PAYROLL_AET.TO_DATE;

If Not &rcdQryPrompts = Null Then
  &oRptDefn.SetPSQueryPromptRecord(&rcdQryPrompts);
End-If;
/*generate report*/

&oRptDefn.ProcessReport (&sTmpltID, &sLangCd, &AsOfDate, &sOutFormat);
/*publish report */

No comments: