Tips & Tricks SQR Report

Mutliple reports from one SQR:-

To generate multiple report from SQR two things should be done:


·   Declaring the reports using DECLARE-REPORT

·   Updating the Parameters in Process Definition

Step 1: In the BEGIN-SETUP section declare report layouts as below:

BEGIN-SETUP

DECLARE-REPORT REPORT1

END-DECLARE

DECLARE-REPORT REPORT2

END-DECLARE

END-SETUP

Step 2: In the BEGIN-PROGRAM section or from the required procedure use the reports declared in Step 1.

BEGIN-PROGRAM
USE-REPORT REPORT1
PRINT 'Text to print in REPORT1' (,1)
!Once REPORT1 is completed switch to REPORT2 as below:
USE-REPORT REPORT2
PRINT 'Text to print in REPORT2' (,1)
END-PROGRAM


Step 3: After performing the above two steps and running the SQR, one will find only one report(usually the first one) is displayed in Process Monitor though the other one also got generated. This is because the Process Scheduler is unaware that we are printing two reports in a single report. To make the process scheduler aware of multiple reports in the Parameter section of Process Scheduler specify "
-MR n" without quotes. Here, MR indicates Multiple Reports and 'n' is a number between 2 to 99 indicating to the Process Scheduler the number of reports generated by the SQR report.

Step 4: Providing custom file names for multiple reports generated by SQR

While the above three steps will generate multiple reports and display in Process Scheduler, the file names would be a combination of process name, process instance and the file number. To provide custom file names, modify the contents of Step 2 as below:
BEGIN-PROGRAM
Let $Filename_of_Report1 = Requiredpath/1.pdf
Let $Filename_of_Report2 = Requiredpath/2.pdf
USE-REPORT REPORT1
NEW-REPORT $Filename_of_Report1 
PRINT 'Text to print in REPORT1' (,1)
!Once REPORT1 is completed switch to REPORT2 as below:
USE-REPORT REPORT2
NEW-REPORT $Filename_of_Report2
PRINT 'Text to print in REPORT2' (,1)
END-PROGRAM

How to read long and short values (XLAT) values from a SQR:-

‘READXLAT.sqc’ is the SQC that can be used to read data from the PeopleSoft Translate Table(PSXLATITEM). How to access the values from this SQC?


1. Include READXLAT.SQC in the SQR

2. Populate $fieldname and $fieldvalue with the required fieldname and values for which Translate values are to be retrieved.

3.  Call the procedure Read-Translate-Table to retrieve the values from PSXLATITEM.

4. Get either $XLATLongName or $XLATShortName to get Long or Short values respectively.

SQL Query to fetch list of all processes\jobs in a recurrence

 SELECT process_job_name, 

       description, 
       
recurname 
FROM   ps_prcsrecur a, 
       
(SELECT p.prcsname  AS Process_Job_name, 
               
p.descr     AS Description, 
               
p.recurname AS recurname 
        
FROM   ps_prcsdefn p 
        
UNION 
        
SELECT jp.prcsjobname AS Process_Job_name, 
               
(SELECT j.descr 
                
FROM   ps_prcsdefn j 
                
WHERE  j.prcsname = jp.prcsname) AS Description, 
               
jp.recurname AS recurname 
        
FROM   ps_prcsjobdefn j, 
               
ps_prcsjobitem jp 
        
WHERE  j.prcsjobname = jp.prcsjobname) b
WHERE b.recurname = a.recurname 

AND a.recurname = :1

ORDER  BY 1

PeopleCode to retrieve Google map between two addresses

  PeopleCode Example: /* Define constants for the API request */ Local string &origin = "123 Main St, Anytown, USA";   /* ...