来源:http://peoplesoft.wikidot.com/sqr-output-to-report-repository
If you are developing a new SQR that creates files that need to be posted from the process scheduler to the report repository, (report manager), here are the steps for doing this. Note this uses delivered SQCs.
The delivered getlogou.sqc can be used to post files to the report repository. There are two functions in this SQC:
- get-prcsoutputdir which is used to get the original output destination from the PSPRCSPARMS record
- get-logoutputdir-value which is used to get the process output directory from the PSPRCSPARMS record
Both functions require a global variable, #prcs_process_instance to be declared somewhere in your SQR. This is normaly the case if you call stdapi.sqc.
The orignal output destination is what has been entered into the process definition for the output location. This is normally %%Log/Output Directory%%. The process output directory is the expanded application server path to the log output directory.
The log output directory contains folders that are posted to the report repository. The naming convention for these folders is:
ProcessType_ProcessName_ProcessInstance
For example, CCLTRGEN is an SQR process. If the process instance is 1234567 then folder for this process in the log output directory would be:
SQR_CCLTRGEN_1234567
This folder typically contains log files (.log, .out), any of the common files output by the process (e.g. .pdf) and any files specifically created and placed in this directory.
This is a typical example of how you would use the get-logoutputdir-value procedure to determine the output location for a CSV file generated by your SQR:
do Get-logoutputdir-value ! getlogou.sqc
if (rtrim($prcsoutputdir,' ') <> '')
move $prcsoutputdir to $CSVPath
end-if
You can check the process output location using the following SQL if you know the process instance:
select PRCSOUTPUTDIR from PSPRCSPARMS where PRCSINSTANCE = '123456789'
!*********************************************************
! GETLOGOU: Get Current Log/Output Directory *
!*********************************************************
!***********************************************************************
! *
! Confidentiality Information: *
! *
! *
! This module contains confidential and proprietary information *
! of Oracle; it is not to be copied, reproduced, or transmitted *
! in any form, by any means, in whole or in part, nor is it to *
! be used for any purpose other than that for which it is *
! expressly provided under the applicable license agreement. *
! *
! Copyright (C) 2006 Oracle. All Rights Reserved. *
! *
!***********************************************************************
!***********************************************************************
!***********************************************************************
! *
! $Date: 2006/07/19:13:08:20 !
! $Release: HR9 !
! $Revision: 101 !
! *
!***********************************************************************
!
begin-procedure Get-prcsoutputdir
let $origoutdest = ''
let $prcsoutputdir = ''
begin-select
ORIGOUTDEST
LET $origoutdest = &ORIGOUTDEST
FROM PSPRCSPARMS
WHERE PRCSINSTANCE = #prcs_process_instance
end-select
if rtrim($origoutdest,' ') = '%%Log/Output Directory%%'
let #prcs_process_instance = $prcs_process_instance
do get-logoutputdir-value
end-if
end-procedure
begin-procedure get-logoutputdir-value
begin-select
PRCSOUTPUTDIR
let $prcsoutputdir = rtrim(&PRCSOUTPUTDIR, ' ')
let $slash = '/'
if $sqr-platform = 'WINDOWS-NT'
let $slash = '\'
end-if
let #xlength = length($prcsoutputdir)
if substr($prcsoutputdir,#xlength,1) = $slash
else
let $prcsoutputdir= rtrim($prcsoutputdir, ' ') || $slash
end-if
FROM PSPRCSPARMS
WHERE PRCSINSTANCE = #prcs_process_instance
end-select
end-procedure