How to Generate XMLP Reports in PeopleSoft with Desired File Name?
Certainly, in PeopleTools version 8.49 and earlier, generating XMLP reports with desired output file names can be achieved by customizing the code within the Application Package PSXP_RPTDEFNMANAGER, Class ReportDefn, and Method ProcessReport. This involves manipulating the code to set a custom file name for the generated XMLP report.
Below is the code for the ‘method ProcessReport’ with the changes highlighted in red:
Step 1: Update Method Declaration In the method declaration of ProcessReport, add an additional parameter for setting up the custom report name:
method ProcessReport(
&TemplateID As string,
&LanguageCd As string,
&AsOfDate As date,
&OutputFormat As string,
&sCustomRptName As string);
Step 2: Implement Changes in Method Definition Inside the method definition of ProcessReport, add the following code changes to enable generating reports with custom names:
method ProcessReport
—
CreateDirectory(&sOutputDir | &sDirSep | “RptInst” | &sDirSep | String(&i), %FilePath_Absolute);
/* 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;
Step 3: Generate XMLP Report with Custom Name Use the following sample code to generate an XMLP report with the custom report name prefix:
&CustomRptName_prefix = “User Report”;
&ReportDef.ProcessReport(&sTemplateId, “ENG”, %Date, &OutputFmt, &CustomRptName_prefix);
&ReportDef.publish(“”, “”, “”, 0);
This code snippet invokes the ProcessReport method with the specified parameters, including the custom report name prefix. The method will generate the report with the custom name if the conditions are met.
In PeopleTools Version 8.50 and later, PeopleSoft has introduced a convenient feature that allows you to generate XMLP reports with customized names directly from the user interface.
Here’s how to do it:
- Navigation: To access this feature, go to Main Menu > Report Tools > XML Publisher > Report Definition.
![Generating-Custom-XMLP-Reports-in-PeopleSoft-with-Desired-File-Names](https://www.kovaion.com/wp-content/uploads/2023/08/xmlp-300x149.jpg)
- File Name: In the “Report Definition” page, you’ll find a field called “File Name.” This is where you can specify a template for the output file name. The template you provide here will be translated into the actual physical file name when the report is generated.
- You can use a combination of output variables and plain text in this field.
- Output variables are enclosed within percent signs (%). These variables will be replaced with their corresponding values at runtime.
- Example: Let’s say you want to create a report for employee payrolls and want the report file name to include the employee’s last name and the report date. You can set up the “File Name” field like this:
PayrollReport_%LastName%_%CurrentDate%.pdf
In this example:
- %LastName% is an output variable that will be replaced with the employee’s last name.
- %CurrentDate% is an output variable that will be replaced with the current date when the report is generated.
Additional Information:
If you need more detailed information and examples about this feature in PeopleTools Version 8.50, you can refer to the official Oracle documentation. The documentation provides guidance on how to set up different output templates and use various output variables.
The documentation can be found at: http://docs.oracle.com/cd/E15645_01/pt850pbr0/eng/psbooks/txml/book.htm
This feature simplifies the process of generating XMLP reports with custom names, allowing you to define dynamic file name templates that adapt based on the report’s content and other variables.