Friday, 28 December 2012

How to generate XMLP reports in PeopleSoft with desired file name?


In People Tools version 8.49 and earlier, XMLP generates reports with some random names. There is no delivered option for the user/developer to specify desired output report name. However, this can be achieved easily by tweaking the code in the Application Package - PSXP_RPTDEFNMANAGER, Class -ReportDefn, Method  - ProcessReport

Below is the code for the 'method ProcessReport' with the changes highlighted in red:                  
Ø  In the method declaration, add one additional parameter for setting up the report name as shown below:
 method ProcessReport(&TemplateID As string, &LanguageCd As string, &AsOfDate As date,     &OutputFormat As string, &sCustomRptName As string);

Ø  In the method definition, include the below shown code changes:
  method ProcessReport
   ---
CreateDirectory(&sOutputDir | &sDirSep | "RptInst" | &sDirSep | String(&i),     %FilePath_Absolute);
 /*This code is to generate the report with a custom name */
  If %This.UseBurstValueAsOutputFileName Then
          &sOutFileName = &sBurstValue | &sCustomRptName;
   Else
          &sOutFileName = &ID;
   End-If;
                ----
   &oReportOut = create XX_RPTDEFN:ReportOutput(&sBurstValue, String(&i),    &sOutFileName | "." | Lower(&sFileExt), &sBurstDataFile);       
   &arOutput.Push(&oReportOut);
   End-For;        
    End-If;
      Else
  /*******Include report name here if you want to change******/
  If &sCustomRptName <> " " Then
        &ID = &sCustomRptName;
  End-If;
  &sLocalOutputFile = %This.GetLocalOutputFile(&ID | "." | Lower(&sFileExt), "", 1);
   ----
  end-method;

Below is the sample code to generate the XMLP report where 'method ProcessReport' is invoked with additional parameter:
&CustomRptName_prefix = "User Report";
 &ReportDef.ProcessReport(&sTemplateId, "ENG", %Date, &OutputFmt, &CustomRptName_prefix);
 &ReportDef.publish("", "", "", 0);

We implemented this at one of our customer site. It is tested and works fine. We recommend you to test it with various options.



In PeopleTools Version 8.50 and later, PeopleSoft has delivered the option to generate XMLP reports with customized names.
Navigation:  Main Menu > Report Tools>XML Publisher> Report Definition
File Name: Specify a file name template that gets translated at runtime to a physical file name. This field accepts a combination of output variables and plain text. Output variables are enclosed within percent signs (%). More details on PT8.50 report outpput option feature is available at http://docs.oracle.com/cd/E15645_01/pt850pbr0/eng/psbooks/txml/book.htm

No comments:

Post a Comment