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

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

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");
&f.close()

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 = '\'
 else
    let $dirSep = '/'
 end-if

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

  FROM PS_CDM_LIST CDM WHERE CDM.PRCSINSTANCE = #prcs_process_instance

end-select
end-procedure

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值