Send Anything to the Report Repository
Posted by: Brent Martin in PeopleTools on Sep 11, 2008
Have you ever had a report that wasn't generated in PeopleSoft but you wanted to put it in the report repository so that your PeopleSoft users could see it with their other reports? Or have you ever wanted a single SQR to generate multiple reports, with different security for each? Well, in PeopleTools 8.4x or later it's as easy as using the delivered POSTRPT_DMN.
POSTRPT_DMN is an app enging program that watches for XML files in a particular directory. If it finds one, it will parse the XML parameters to determine the directory where the report file(s) are stored, the report's security, title, and other important info. Then it'll use the PostReport PeopleCode class object to post the report to the report repository.
So there are two steps to setting making this work: 1) Configuring the POSTRPT_DMN and set it to run on a regular basis; and 2) Stage your report on the process scheduler server and create the XML file in the directory that POSTRPT_DMN is watching.
Here's how it's done:
Configuring POSTRPT_DMN
First, set up your process scheduler environment to specify which directory you want POSTRPT_DMN to monitor. Assuming you don't want to customize the process, you'll need to set the PS_FILEDIR environment variable to be the high level directory where you want to watch for XML files. If you like the default directory of $PS_HOME/appserv/prcs/<DOMAIN>/files, you can leave PS_FILEDIR unset. If you'd like to specify a different directory you can set the PS_FILEDIR environment variable.
As delivered, POSTRPT_DMN looks for files under $PS_FILEDIR/reports. So make sure you create this directory, and plan to put your XML files there.
Next, you'll want to set up Process Scheduler to run the POSTRPT_DMN program as a PSDAEMON process every 5 minutes. The steps are:
1. Go to PeopleTools, Process Scheduler, Daemon Group.
2. Add a new Daemon Group.
For example, add QEDAEMON. The Daemon Group page appears.
3. Use the drop-down list to add the POSTRPT_DMN program, and click Save.
4. Select PeopleTools, Process Scheduler, Servers.
5. Select the server definition for the Process Scheduler server on which you intend to run the POSTRPT_DMN program.
6. Go to the Daemon page, and complete the information as shown in the example that precedes these instructions.
7. Click Save.
Before the daemon process will be activated, you need to bounce the Process Scheduler.
Now, every 5 minutes, a POSTRPT_DMN Daemon will wake up and look for new XML files. If it finds one, it’ll publish the files to the report repository based on the file’s parameters. Then it will delete the temporary directory you created, and replace the contents of your XML file with the word “Done”. If something goes wrong the files will remain unchanged and the daemon will try again in 5 minutes.
If you're wondering if the daemon process is really working, you can go to Process Monitor on the Servers tab. Click Details next to the server that should be running it. Then click the Message Log. If it's working you should see heartbeat messages and POSTRPT_DMN messages. You can also look at the log file in the $PS_HOME/appserv/prcs/<DOMAIN>/log_output/_PSDAEMON directory.
Staging Report Files
Now let's give our new Daemon process something to do. First, create a directory to contain the reports that our XML control file will point to in the next step. Then put one or more reports into that directory.
Obviously it doesn't matter how reports get into the directory, they could be created via SQR or FTP'd from another application.
Then create an XML control file containing the necessary XML flags. An example is below. Technically the filename doesn’t matter just so it ends in .xml (lower case), but to make it logical I usually name it the same as the directory created in the previous step, except I add the xml extension. Put it in $PS_FILEDIR/reports
<?xml version="1.0"?>
<CONTENTINFO>
<PRCSNAME>XRFWIN</PRCSNAME>
<PRCSTYPE>SQR Report</PRCSTYPE>
<CONTENT_DESCR>Test Report</CONTENT_DESCR>
<REPORTPATH>/usr/local/psoft/FSDEV/FSDEV/appserv/prcs/FSDEV/files/reports</REPORTPATH>
<OUTDESTFORMAT>CSV</OUTDESTFORMAT>
<FOLDER>General</FOLDER>
<SERVER>PSUNX</SERVER>
<AUTHORIZED_LIST>
<DISTID>X0238695</DISTID>
<DISTIDTYPE>USER</DISTIDTYPE>
</AUTHORIZED_LIST>
<AUTHORIZED_LIST>
<DISTID>ALLPAGES</DISTID>
<DISTIDTYPE>ROLE</DISTIDTYPE>
</AUTHORIZED_LIST>
</CONTENTINFO>
Make sure PRCSNAME is a valid process name defined in PeopleSoft. PRCSTYPE needs to be a valid process type as well. CONTENT_DESCR can be anything (not sure about special characters like single quotes or XML delimiters). Report Path should be the full path to the directory you created in the first step. DISTID can either be a valid user ID, or a valid role – specify which in DISTIDTYPE field. This will represent which users can see the report in Report Manager. Feel free to include as many AUTHORIZED_LIST tags as you need.
Troubleshooting
- Check out the log file in this directory: $PS_HOME/appserv/prcs/<domain>/log_output/_PSDAEMON
- Check the message log in Process Monitor > Servers tab > Details
- PeopleTools > Application Engine > Manage Abends can help you remove locked rows. If you do, Also delete from PS_AEDAEMONMGR_AET.
- Make sure to set a PS_FILEDIR environment variable in psconfig.sh. For example: PS_FILEDIR=$PS_HOME/appserv/prcs/PS90HRDV/files
- Be sure the <REPORTNAME> tag doesn’t have an ampersand (&) in it. I used this UNIX command to fix multiple xml control files: find ./ -type f | xargs perl -pi -e 's/\&/and/g'

