How to get files to show up in the Process Monitor/Report Repository

By Chris Malek | Sun, Apr 17, 2011

A common problem for SQR and application engine developers is how to make files generated in SQR and Application Engine accessible to the end user(s). One common solution is to write them to a shared directory on some server. This can cause a bunch of issues and requires security maintenance outside the PeopleSoft database. This model does not always work.

A better solution is to actually have your files show up in the report repository under the “view/log trace”. It turns out to be very easy.

Application Engine Example

In tools 8.4x and beyond, any files opened using the GetFile will actually be automatically transfered to the Report Repository.

Local File &f;
&f = GetFile("summary_log.txt", "w", %FilePath_Relative);
&f.WriteLine("Hello World");

The key thing about this code is the %FilePath_Relative parameter. In tools 8.4x, the application engine will open the file in the correct place and some scripts that run after the process completes will transfer the file to the Report Repository.

SQR Example

Here is a procedure that you can put in an SQC. A variable named $weboutputdir will be populated with the director where you want to open the file.

begin-procedure get-web-outdir

 if $sqr-platform = 'WINDOWS-NT'
    let $dirSep = '\'
    let $dirSep = '/'

  let $weboutputdir = rtrim(&CDM.PRCSOUTPUTDIR, ' ')  ||  $dirSep



How does it work

When the process scheduler starts any new process, a temporary directory is actually created for each and every process instance. Any files in that temporary directory will get automatically transfered to the process monitor (aka report repository). You can figure out that directory name at run time by querying the PS_CDM_LIST.PRCSOUTPUTDIR record field and opening your file there. All the files that normally show up in the report repository like pdf and log files are actually stored in this directory so you are already following the flow of what PeopleSoft is already doing.

I have been using this trick for about 8-10 years now and it works flawlessly across every operating system that I have worked on. The one caveat is that I have seen that not all file extensions are transfered. I typically use .txt or .csv and those tend to work well. I have had other file types not transfer across different tools release. For example in the past the .dat file type did not transfer on some tools releases.

Author Info
Chris Malek

Chris Malek is a PeopleTools® Technical Consultant with two decades of experience working on PeopleSoft enterprise software projects. He is available for consulting engagements.

About Chris Work with Chris
Looking for pain-free PeopleSoft web services? 😀
PeopleSoft Simple Web Services (SWS)

Introducing a small but powerful PeopleSoft bolt-on that makes web services very easy. If you have a SQL statement, you can turn that into a web service in PeopleSoft in a few minutes.

Integration Broker - The Missing Manual

I am in the process of writing a book called "Integration Broker - The Missing Manual" that you can read online.