Get Latest Updates directly delivered in your Email

Generate Multiple Report with Unique Name in PeopleSoft SQR

From last couple of days i was working on SQR Master Details report and also contains requirements to create a more than one report simultaneously based on the common data.After searching on Peoplebook as well Hyperion SQR Manual i found the solutions. So, today i’m sharing the solutions how to proceed it.

I’m describing this blog post pretty elaborate way so you will get fully understand. 🙂

How can we create multiple reports?

  •     Use DECLARE-REPORT to declare one or more reports to be produced in the application.
  •     You must use this command when developing applications to produce more than one report.
  •     This DECLARE-REPORT Command should be use in the SETUP i.e Begin-Setup section.
  •     It includes name of the Report/Layout/Printer.
  •     The name of the Layout and type of the report may different  that depends on the business requirement.
  •     If no printer type is specified, the default is LINEPRINTER.
  •     if no Layout is specified, the default Layout is used.
  •     Valid values for the Printer-Type arguments are HT-HTML, HP-HPLASERJET,PS-POSTSCRIPT, LP-LINEPRINTER

So Declare-Report Command Looke Like

 DECLARE-REPORT report_name

[TOC=toc_name]

[LAYOUT=layout_name]

[PRINTER-TYPE=printer_type]

END-DECLARE

Arguments

report_name

The report name.

TOC

The name of the Table of Contents.

LAYOUT

The layout name. If none is specified, the default layout is used.

PRINTER-TYPE

The type of printer used. If none is specified, the default is the LINEPRINTER. If no DECLARE‑PRINTER is specified, DEFAULT-LP is used. Valid values for PRINTER-TYPE are HT, HP, PD, PS, LP, HTML, HPLASERJET, POSTSCRIPT, and LINEPRINTER.

So first i am declaring the layout like that

 !DECLARE-LAYOUT should be usd in SETUP section.
    DECLARE-LAYOUT RPT_LAYOUT_A
		paper-size={PAGE_PAPER_SIZE}
		orientation = LANDSCAPE
		line-height=9
		char-width=2
    END-DECLARE 

then create the report defination with DECLARE-REPORT command like that and use the previously defined Layout Name RPT_LAYOUT_A

 !DECLARE-REPORT produced one or more reports and should be use in the SETUP section.
	DECLARE-REPORT RPT_A
		LAYOUT=RPT_LAYOUT_A
	END-DECLARE

As you can see the below whole snippets i have use 5 Layout along with 5 Report. So i general terms this MULRPT.SQR will create 5 output in Process Output Directory.

Process Output Directory Generate 5 Reports

Process Output Directory Generate 5 Reports

So next process i have created Different Heading Section for all reports as it is required.

 
!**************
! For Report A
!**************
BEGIN-HEADING 1 FOR-REPORTS=(RPT_A)
	PRINT 'This is Report A' (1) CENTER
END-HEADING

!**************
! For Report B
!**************
BEGIN-HEADING 1 FOR-REPORTS=(RPT_B)
  PRINT 'This is Report B' (1) CENTER
END-HEADING

!**************
! For Report C
!**************
BEGIN-HEADING 1 FOR-REPORTS=(RPT_C)
  PRINT 'This is Report C' (1) CENTER
END-HEADING

But i have use Common Footer for all

 !**** Common Footer all Report *****************
BEGIN-FOOTING 3 FOR-REPORTS=(RPT_A,RPT_B,RPT_C,RPT_D,RPT_E)
	ALTER-PRINTER
		FONT = 3
		POINT-SIZE =13
    PAGE-NUMBER (1,1) 'Page - '
END-FOOTING

RPT_A,RPT_B,RPT_C,RPT_D,RPT_E Use Same Footer.

So here is the most important section. I’m using getlogou.sqc to get Process Output directory and making new file name with some naming conventions that i want to see in process output directory, then use USE-REPORT for using the report, write some text on that and finally Using New-Report command To close the current report output file and open a new one with the specified file name.

 Do get-logoutputdir-value !Get Process Output Directory
		
		if (rtrim($prcsoutputdir,' ') <> '')
			
			Let $NewFileFileSuffixValue = edit($AsOfToday,'DDMonthYYYY')
			
			Let $GenNewFileA = $prcsoutputdir || 'Report_A' || '_' || $NewFileFileSuffixValue || '.pdf'
			Let $GenNewFileB = $prcsoutputdir || 'Report_B' || '_' || $NewFileFileSuffixValue || '.pdf'
			Let $GenNewFileC = $prcsoutputdir || 'Report_C' || '_' || $NewFileFileSuffixValue || '.pdf'
			Let $GenNewFileD = $prcsoutputdir || 'Report_D' || '_' || $NewFileFileSuffixValue || '.pdf'
			Let $GenNewFileE = $prcsoutputdir || 'Report_E' || '_' || $NewFileFileSuffixValue || '.pdf'
			
			Use-Report RPT_A
			
			!To close the current report output file and open a new one with the specified file name
			New-Report $GenNewFileA
			PRINT 'This is the A Multiple Report' (1,1)

Same thing happening for all others reports.

Process Defination

Process Defination

Server Selection

Server Selection

Most Important: You need to specified at Override Tab, else multiple report will not gerenate

Most Important: You need to specified at Override Tab, else multiple report will not gerenate

So here is the Whole Code Snippet, Just Download it and put it to sqr folder i.e PS_HOME/sqr then Create Proess Name MULRPT.SQR as SQR Report

Please Put -MR 5 at the Override Options Tabs in *Parameter List: (Append )
*Parameter List Append -MR 5

See the results in process Monitor.

Please let me know if any problems , suggestion and correction & Hope this help you 🙂

 
!-----------------------------------------------------------------------------------------------!
!  Report Name:  MULRPT.SQR -- Run Via Process Schedular SQR Report (API Aware)                 !
!  Report Descriptions: Generate Multiple Reports with Unique Name in SQR			!
!  Report Create Date: 	4-Oct-2013								!
!  Report Run Component: PRCSMULTI								!
!  Report Process Group: HRALL									!	
!  Note: 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 ( limit upto 99 )		!
!		 indicating to the  Process Scheduler the number                                !
!                of reports generated by the SQR report.                                        !
!-----------------------------------------------------------------------------------------------!

#include 'setenv.sqc'    ! set Default environment
#define PAGE_PAPER_SIZE (A4)

Begin-Setup

    !DECLARE-LAYOUT should be usd in SETUP section.
    DECLARE-LAYOUT RPT_LAYOUT_A
		paper-size={PAGE_PAPER_SIZE}
		orientation = LANDSCAPE
		line-height=9
		char-width=2
    END-DECLARE

    DECLARE-LAYOUT RPT_LAYOUT_B
		paper-size={PAGE_PAPER_SIZE}
		orientation = LANDSCAPE
		line-height=9
		char-width=2
    END-DECLARE

    DECLARE-LAYOUT RPT_LAYOUT_C
      paper-size={PAGE_PAPER_SIZE}
	  orientation = LANDSCAPE
	  line-height=9
	  char-width=2
	END-DECLARE

	DECLARE-LAYOUT RPT_LAYOUT_D
      paper-size={PAGE_PAPER_SIZE}
	  	orientation = LANDSCAPE
		line-height=9
		char-width=2
	END-DECLARE

	DECLARE-LAYOUT RPT_LAYOUT_E
      paper-size={PAGE_PAPER_SIZE}
	  orientation = LANDSCAPE
	  line-height=9
	  char-width=2
	END-DECLARE

	!DECLARE-REPORT produced one or more reports and should be use in the SETUP section.
	DECLARE-REPORT RPT_A
		LAYOUT=RPT_LAYOUT_A
	END-DECLARE

	DECLARE-REPORT RPT_B
		LAYOUT=RPT_LAYOUT_B
	END-DECLARE

	DECLARE-REPORT RPT_C
		LAYOUT=RPT_LAYOUT_C
	END-DECLARE

	DECLARE-REPORT RPT_D
		LAYOUT=RPT_LAYOUT_D
	END-DECLARE

	DECLARE-REPORT RPT_E
		LAYOUT=RPT_LAYOUT_E
	END-DECLARE

END-SETUP

!*****************************************
! Header & Footer Declation for All Report
!*****************************************

!**************
! For Report A
!**************
BEGIN-HEADING 1 FOR-REPORTS=(RPT_A)
	PRINT 'This is Report A' (1) CENTER
END-HEADING

!**************
! For Report B
!**************
BEGIN-HEADING 1 FOR-REPORTS=(RPT_B)
  PRINT 'This is Report B' (1) CENTER
END-HEADING

!**************
! For Report C
!**************
BEGIN-HEADING 1 FOR-REPORTS=(RPT_C)
  PRINT 'This is Report C' (1) CENTER
END-HEADING

!**************
! For Report D
!**************
BEGIN-HEADING 1 FOR-REPORTS=(RPT_D)
  PRINT 'This is Report D' (1) CENTER
END-HEADING

!**************
! For Report E
!**************
BEGIN-HEADING 1 FOR-REPORTS=(RPT_E)
  PRINT 'This is Report E' (1) CENTER
END-HEADING

!**** Common Footer all Report *****************
BEGIN-FOOTING 3 FOR-REPORTS=(RPT_A,RPT_B,RPT_C,RPT_D,RPT_E)
	ALTER-PRINTER
		FONT = 3
		POINT-SIZE =13
    PAGE-NUMBER (1,1) 'Page - '
END-FOOTING

!***** Heading & Footing Section Completed ************

!*****************
Begin-Program
!****************
	 do Init_Report
	 do Main_Report
	 do Stdapi-Term
end-program

!****************************
Begin-Procedure Init_Report
!****************************
	 Do Stdapi-Init
	 Do Init-DateTime
	 Do Init-Number
	 Do Get-Current-DateTime
end-procedure

!*****************
Begin-Procedure Main_Report
!****************

		Do get-logoutputdir-value !Get Process Output Directory

		if (rtrim($prcsoutputdir,' ') <> '')

			Let $NewFileFileSuffixValue = edit($AsOfToday,'DDMonthYYYY')

			Let $GenNewFileA = $prcsoutputdir || 'Report_A' || '_' || $NewFileFileSuffixValue || '.pdf'
			Let $GenNewFileB = $prcsoutputdir || 'Report_B' || '_' || $NewFileFileSuffixValue || '.pdf'
			Let $GenNewFileC = $prcsoutputdir || 'Report_C' || '_' || $NewFileFileSuffixValue || '.pdf'
			Let $GenNewFileD = $prcsoutputdir || 'Report_D' || '_' || $NewFileFileSuffixValue || '.pdf'
			Let $GenNewFileE = $prcsoutputdir || 'Report_E' || '_' || $NewFileFileSuffixValue || '.pdf'

			Use-Report RPT_A

			!To close the current report output file and open a new one with the specified file name
			New-Report $GenNewFileA
			PRINT 'This is the A Multiple Report' (1,1)

			Use-Report RPT_B

			!To close the current report output file and open a new one with the specified file name
			New-Report $GenNewFileB
			PRINT 'This is the B Multiple Report' (1,1)

			Use-Report RPT_C

			!To close the current report output file and open a new one with the specified file name
			New-Report $GenNewFileC
			PRINT 'This is the C Multiple Report' (1,1)

			Use-Report RPT_D

			!To close the current report output file and open a new one with the specified file name
			New-Report $GenNewFileD
			PRINT 'This is the D Multiple Report' (1,1)

			Use-Report RPT_E

			!To close the current report output file and open a new one with the specified file name
			New-Report $GenNewFileE
			PRINT 'This is the E Multiple Report' (1,1)

		end-if

end-procedure

!***********************************************************************
! Standard Include Files
!***********************************************************************
#Include 'curdttim.sqc'   !Get-Current-DateTime procedure
#Include 'datetime.sqc'   !Routines for date and time formatting
#Include 'number.sqc'     !Routines to format numbers
#Include 'stdapi.sqc'     !Update Process API
#Include 'datemath.sqc'   !Date Manipulation functions
#Include 'timemath.sqc'   !Time Related Calculatin
#include 'getlogou.sqc'   !get current logoutput directory
#include 'reset.sqc'      !Reset Printer Show End of Report
!***********************************************************************
Related Article you might like:
Previous:
How to Get Process Name by Process Instance Using PeopleSoft SQR
Next:
Difference Between SQR and SQC in PeopleSoft

14 comments on “Generate Multiple Report with Unique Name in PeopleSoft SQR

  1. Hello Nayan,

    I am trying to figure out how to incorporate the NEW-REPORT into a SQR report I am working on. I was wondering if you could help me out. I am not sure where to add the code. I have an unknown number of reports that will be generated. Please help


    #include 'setenv.sqc' !Set environment

    !**********
    begin-setup
    !**********

    ! page-size 15000 500

    #include 'ptpsl177.sqc' !Printer and page-size initialization

    end-setup

    !***********
    begin-report
    !***********

    do Init-DateTime
    do Init-Number
    do Get-Current-DateTime
    do Init-Report
    do Init-Arrays
    do Reset-Arrays
    do Process-Main
    do Reset
    do Stdapi-Term

    end-report

    !**************
    begin-heading 8
    !**************

    #include 'stdhdg01.sqc'

    print 'From RunID' (+1,1)
    print $FromPayRunID (0,+1)
    print 'Thru' (0,+1)
    print $ThruPayRunID (0,+1)

    print 'Current' (+2,44,10)
    print 'Current' (0,55,10)
    print 'Earnings' (0,103,10)
    print 'Earnings' (0,114,13)
    print 'Estimated' (0,128,10)
    print 'Variance' (0,139,10)
    print 'Variance' (0,150,10)

    print 'Name' (+1,1,30)
    print 'EmplID' (0,32,11)
    print 'Status' (0,44,10)
    print 'Class' (0,55,10)
    print 'Earnings Code' (0,68,34)
    print 'Hrs' (0,103,10)
    print 'Gross' (0,114,13)
    print 'Biweekly' (0,128,10)
    print 'Amount' (0,139,10)
    print 'Percentage' (0,150,10)

    print '-' (+1,1,30) fill
    print '-' (0,32,11) fill
    print '-' (0,44,10) fill
    print '-' (0,55,10) fill
    print '-' (0,68,34) fill
    print '-' (0,103,10) fill
    print '-' (0,114,13) fill
    print '-' (0,128,10) fill
    print '-' (0,139,10) fill
    print '-' (0,150,10) fill

    end-heading

    !**************************
    begin-procedure Init-Report
    !**************************

    move 'ccwpay09c' to $ReportID
    move 'Variance Report - Hours & Earnings Totals' to $ReportTitle
    display $ReportTitle

    do Stdapi-Init

    if $prcs_process_instance = ''
    display ' '
    input $FromPayRunID maxlen=10 'From pay run id: '
    let $FromPayRunID = upper($FromPayRunID)
    display ' '
    input $ThruPayRunID maxlen=10 'Thru pay run id: '
    let $ThruPayRunID = upper($ThruPayRunID)
    display ' '
    end-if

    end-procedure

    !**************************
    begin-procedure Init-Arrays
    !**************************

    create-array name = ErnYTDArray
    size = 50
    field = ErnYTDCd:char
    field = ErnYTDHrs:number
    field = ErnYTDErn:number

    create-array name = SummaryErnYTDArray
    size = 100
    field = SummaryErnYTDCd:char
    field = SummaryErnYTDHrs:number
    field = SummaryErnYTDErn:number

    move -1 to #Summary_Earnings_Rows

    end-procedure

    !***************************
    begin-procedure Reset-Arrays
    !***************************

    move 0 to #i
    while #i <= 49
    put ' ' 0 0 into ErnYTDArray(#i)
    add 1 to #i
    end-while
    move -1 to #Earnings_Rows

    end-procedure

    !***************************
    begin-procedure Process-Main
    !***************************
    ! Gets all the pay lines between the two pay run ids specified.
    ! Gets the employees current status based on the report run date.

    begin-select

    J.DEPTID () on-break
    print=never
    before=Print-Dept-Subheading
    after=Print-Dept-Subtotals
    level=1

    PL.NAME () on-break
    print=never
    after=Test-If-Variance
    save=$Name
    level=2

    PL.COMPANY
    PL.PAYGROUP
    PL.PAY_END_DT
    PL.OFF_CYCLE
    PL.PAGE_NUM
    PL.LINE_NUM
    PL.EMPLID
    move &PL.EMPLID to $EmplID
    PL.EMPL_RCD
    PL.BUSINESS_UNIT
    PC.PAY_END_DT

    J.EMPL_CLASS
    move &J.EMPL_CLASS to $Empl_Class
    J.EMPL_STATUS
    move &J.EMPL_STATUS to $Empl_Status
    J.BUSINESS_UNIT
    J.DAILY_RT
    move &J.DAILY_RT to #Empl_Daily_Rt

    do Get-Earnings
    do Get-Overtime
    do Get-Other-Earnings

    FROM PS_PAY_CALENDAR PC,
    PS_PAY_LINE PL,
    PS_JOB J

    WHERE PC.RUN_ID BETWEEN $FromPayRunID AND $ThruPayRunID
    AND PL.COMPANY = PC.COMPANY
    ! AND PL.PAYGROUP IN ('TWS') !*******************uncomment this code to run Transit Windsor
    AND PL.PAYGROUP = PC.PAYGROUP
    AND PL.PAY_END_DT = PC.PAY_END_DT
    AND PL.PAYGROUP 'RBG'
    AND J.EMPLID = PL.EMPLID
    AND J.EMPL_RCD = PL.EMPL_RCD
    ! AND J.COMPANY = PL.COMPANY
    ! AND J.PAYGROUP = PL.PAYGROUP
    AND (J.EFFDT = (SELECT MAX(EFFDT)
    FROM PS_JOB
    WHERE EMPLID = J.EMPLID
    AND EMPL_RCD = J.EMPL_RCD
    AND EFFDT <= PC.PAY_END_DT)
    AND J.EFFSEQ = (SELECT MAX(EFFSEQ)
    FROM PS_JOB
    WHERE EMPLID = J.EMPLID
    AND EMPL_RCD = J.EMPL_RCD
    AND EFFDT = J.EFFDT))

    ORDER BY J.DEPTID, PL.NAME

    end-select

    do Print-Grand-Totals
    do Print-Earning-Code-Totals

    end-procedure

    !***************************
    begin-procedure Get-Earnings
    !***************************
    ! Searches the payroll earnings table to get all earnings for the employee
    ! based on the pay lines passed. Stores the values in the earnings array.

    move 'N' to $Found
    move 0 to #Row

    begin-select

    PE.ERNCD_REG_HRS
    PE.REG_HRS+PE.REG_EARN_HRS &Hours
    PE.REG_EARNS+PE.REG_HRLY_EARNS &Earnings

    while (#Row <= #Earnings_Rows) and ($Found = 'N') and (&Earnings 0)
    get $Temp_ErnCd from ErnYTDArray(#Row) ErnYTDCd
    if $Temp_ErnCd = &PE.ERNCD_REG_HRS
    array-add &Hours &Earnings to ErnYTDArray(#Row) ErnYTDHrs ErnYTDErn
    move 'Y' to $Found
    end-if
    add 1 to #Row
    end-while

    if $Found = 'N' and (&Earnings 0)
    add 1 to #Earnings_Rows
    put &PE.ERNCD_REG_HRS &Hours &Earnings into ErnYTDArray(#Earnings_Rows)
    end-if

    move 'N' to $Found
    move 0 to #Row

    FROM PS_PAY_EARNINGS PE

    WHERE PE.COMPANY = &PL.COMPANY
    AND PE.PAYGROUP = &PL.PAYGROUP
    AND PE.PAY_END_DT = &PL.PAY_END_DT
    AND PE.OFF_CYCLE = &PL.OFF_CYCLE
    AND PE.PAGE_NUM = &PL.PAGE_NUM
    AND PE.LINE_NUM = &PL.LINE_NUM

    ORDER BY PE.ERNCD_REG_HRS

    end-select

    end-procedure

    !***************************
    begin-procedure Get-Overtime
    !***************************
    ! Searches the payroll earnings table to get all overtime for the employee
    ! based on the pay lines passed. Stores the values in the earnings array.

    move 'N' to $Found
    move 0 to #Row

    begin-select

    PE1.ERNCD_OT_HRS
    PE1.OT_HRS
    PE1.OT_HRLY_EARNS

    while (#Row <= #Earnings_Rows) and ($Found = 'N') and (&PE1.OT_HRLY_EARNS 0)
    get $Temp_ErnCd from ErnYTDArray(#Row) ErnYTDCd
    if $Temp_ErnCd = &PE1.ERNCD_OT_HRS
    array-add &PE1.OT_HRS &PE1.OT_HRLY_EARNS to ErnYTDArray(#Row) ErnYTDHrs ErnYTDErn
    move 'Y' to $Found
    end-if
    add 1 to #Row
    end-while

    if $Found = 'N' and (&PE1.OT_HRLY_EARNS 0)
    add 1 to #Earnings_Rows
    put &PE1.ERNCD_OT_HRS &PE1.OT_HRS &PE1.OT_HRLY_EARNS into ErnYTDArray(#Earnings_Rows)
    end-if

    move 'N' to $Found
    move 0 to #Row

    FROM PS_PAY_EARNINGS PE1

    WHERE PE1.COMPANY = &PL.COMPANY
    AND PE1.PAYGROUP = &PL.PAYGROUP
    AND PE1.PAY_END_DT = &PL.PAY_END_DT
    AND PE1.OFF_CYCLE = &PL.OFF_CYCLE
    AND PE1.PAGE_NUM = &PL.PAGE_NUM
    AND PE1.LINE_NUM = &PL.LINE_NUM

    ORDER BY PE1.ERNCD_OT_HRS

    end-select

    end-procedure

    !*********************************
    begin-procedure Get-Other-Earnings
    !*********************************
    ! Searches the payroll other earnings table to get all other earnings for the
    ! employee based on the pay lines passed. Stores the values in the earnings array.

    move 'N' to $Found
    move 0 to #Row

    begin-select

    POE.ERNCD
    POE.OTH_HRS
    move &POE.OTH_HRS to #Oth_Hrs
    POE.OTH_EARNS
    ET.PAYMENT_TYPE

    evaluate &ET.PAYMENT_TYPE
    when = 'U' !Units - when units, only show the earnings and 0 out the hours
    move 0 to #Oth_Hrs
    end-evaluate

    while (#Row <= #Earnings_Rows) and ($Found = 'N')
    get $Temp_ErnCd from ErnYTDArray(#Row) ErnYTDCd
    if $Temp_ErnCd = &POE.ERNCD
    array-add #Oth_Hrs &POE.OTH_EARNS to ErnYTDArray(#Row) ErnYTDHrs ErnYTDErn
    move 'Y' to $Found
    end-if
    add 1 to #Row
    end-while

    if $Found = 'N'
    add 1 to #Earnings_Rows
    put &POE.ERNCD #Oth_Hrs &POE.OTH_EARNS into ErnYTDArray(#Earnings_Rows)
    end-if

    move 'N' to $Found
    move 0 to #Row

    FROM PS_PAY_OTH_EARNS POE,
    PS_EARNINGS_TBL ET

    WHERE POE.COMPANY = &PL.COMPANY
    AND POE.PAYGROUP = &PL.PAYGROUP
    AND POE.PAY_END_DT = &PL.PAY_END_DT
    AND POE.OFF_CYCLE = &PL.OFF_CYCLE
    AND POE.PAGE_NUM = &PL.PAGE_NUM
    AND POE.LINE_NUM = &PL.LINE_NUM
    AND (POE.ADD_GROSS 'N' OR POE.ERNCD IN ('HB1', 'HB2'))
    AND POE.ERNCD = ET.ERNCD
    AND ET.EFFDT = (SELECT MAX(EFFDT)
    FROM PS_EARNINGS_TBL
    WHERE ERNCD = ET.ERNCD
    AND EFFDT 0
    move 0 to #Empl_Variance_Pct
    let #Empl_Variance_Pct = round(((#Empl_YTDErn - #Empl_Est_Biweekly)/#Empl_Est_Biweekly)*100,2)
    end-if

    print #Empl_Variance_Pct (0,150,10) edit 999,999.99

    position (+1)

    add #Empl_YTDHrs to #Dept_YTDHrs
    add #Empl_YTDErn to #Dept_YTDErn

    add 1 to #Dept_Empl_Count

    do Reset-Arrays

    end-procedure

    !***************************
    begin-procedure Print-Report
    !***************************

    move 0 to #Empl_YTDHrs
    move 0 to #Empl_YTDErn

    move 'EMPL_CLASS' to $FieldName
    move $Empl_Class to $FieldValue
    do Read-Translate-Table
    move $XlatShortName to $Empl_Class

    move 'EMPL_STATUS' to $FieldName
    move $Empl_Status to $FieldValue
    do Read-Translate-Table
    move $XlatShortName to $Empl_Status

    print $Name (+1,1,30)
    print $Emplid (0,32,11)
    print $Empl_Status (0,44,10)
    print $Empl_Class (0,55,10)

    move 0 to #i

    move #Earnings_Rows to #Total_Rows

    while #i <= #Total_Rows

    get $ErnYTDCd #ErnYTDHrs #ErnYTDErn from ErnYTDArray(#i)

    if $ErnYTDCd ' '
    move $ErnYTDCd to $ErnCd
    do Get-Earnings-Name
    print $ErnYTDCd (0,68,3)
    print '-' (0,71,1)
    print $EarningsName (0,72,30)
    print #ErnYTDHrs (0,103,10) edit 999,999.99
    print #ErnYTDErn (0,114,13) edit 99,999,999.99
    add #ErnYTDHrs to #Empl_YTDHrs
    add #ErnYTDErn to #Empl_YTDErn
    end-if

    position (+1)

    move 'N' to $Found
    move 0 to #Row

    while (#Row <= #Summary_Earnings_Rows) and ($Found = 'N') and (#ErnYTDErn 0)
    get $Temp_ErnCd from SummaryErnYTDArray(#Row) SummaryErnYTDCd
    if $Temp_ErnCd = $ErnYTDCd
    array-add #ErnYTDHrs #ErnYTDErn to SummaryErnYTDArray(#Row) SummaryErnYTDHrs SummaryErnYTDErn
    move 'Y' to $Found
    end-if
    add 1 to #Row
    end-while

    if $Found = 'N' and (#ErnYTDErn 0)
    add 1 to #Summary_Earnings_Rows
    put $ErnYTDCd #ErnYTDHrs #ErnYTDErn into SummaryErnYTDArray(#Summary_Earnings_Rows)
    end-if

    add 1 to #i

    end-while

    do Print-Empl-Subtotals

    end-procedure

    !*********************************
    begin-procedure Print-Grand-Totals
    !*********************************

    print 'Grand Totals:' (+2,1)
    print 'YTD Hours:' (+2,5,15)
    print #Grand_YTDHrs (0,+1) edit 999,999,999.99
    print 'YTD Earnings:' (+1,5,15)
    print #Grand_YTDErn (0,+1) edit 999,999,999.99
    print 'Employees:' (+1,5,15)
    print #Grand_Empl_Count (0,+1) edit 999,999,999.99

    end-procedure

    !****************************************
    begin-procedure Print-Earning-Code-Totals
    !****************************************

    new-page

    print 'Grand Totals By Earnings Code' (+2,1)

    print 'Cd' (+2,5,3)
    print 'YTD Hrs' (0,9,15)
    print 'YTD Gross' (0,25,15)

    print '-' (+1,5,3) fill
    print '-' (0,9,15) fill
    print '-' (0,25,15) fill

    move 0 to #i

    while #i <= #Summary_Earnings_Rows

    get $SummaryErnYTDCd #SummaryErnYTDHrs #SummaryErnYTDErn from SummaryErnYTDArray(#i)

    print $SummaryErnYTDCd (+1,5,3)

    move $SummaryErnYTDCd to $ErnCd
    do Get-Earnings-Name
    print '-' (0,9,1)
    print $EarningsName (0,10,30)

    print #SummaryErnYTDHrs (0,41,15) edit 999,999,999.99
    print #SummaryErnYTDErn (0,57,15) edit 999,999,999.99

    add 1 to #i

    end-while

    end-procedure

    !*******************************
    begin-procedure Test-If-Variance
    !*******************************

    move 0 to #Empl_YTDHrs
    move 0 to #Empl_YTDErn

    move 0 to #i

    move #Earnings_Rows to #Total_Rows

    while #i <= #Total_Rows

    get $ErnYTDCd #ErnYTDHrs #ErnYTDErn from ErnYTDArray(#i)
    if $ErnYTDCd ' '

    move $ErnYTDCd to $ErnCd
    do Get-Earnings-Name

    add #ErnYTDHrs to #Empl_YTDHrs
    add #ErnYTDErn to #Empl_YTDErn
    end-if

    move 'N' to $Found
    move 0 to #Row

    ! while (#Row <= #Summary_Earnings_Rows) and ($Found = 'N') and (#ErnYTDErn 0)
    ! get $Temp_ErnCd from SummaryErnYTDArray(#Row) SummaryErnYTDCd
    ! if $Temp_ErnCd = $ErnYTDCd
    ! array-add #ErnYTDHrs #ErnYTDErn to SummaryErnYTDArray(#Row) SummaryErnYTDHrs SummaryErnYTDErn
    ! move 'Y' to $Found
    ! end-if
    ! add 1 to #Row
    ! end-while

    ! if $Found = 'N' and (#ErnYTDErn 0)
    ! add 1 to #Summary_Earnings_Rows
    ! put $ErnYTDCd #ErnYTDHrs #ErnYTDErn into SummaryErnYTDArray(#Summary_Earnings_Rows)
    ! end-if

    add 1 to #i

    end-while

    move 0 to #Empl_Est_Biweekly
    let #Empl_Est_Biweekly = round(#Empl_Daily_Rt * 10,2)

    move 0 to #Empl_Variance
    let #Empl_Variance = #Empl_YTDErn - #Empl_Est_Biweekly

    if #Empl_Est_Biweekly > 0
    move 0 to #Empl_Variance_Pct
    let #Empl_Variance_Pct = round(((#Empl_YTDErn - #Empl_Est_Biweekly)/#Empl_Est_Biweekly)*100,2)
    end-if

    if #Empl_Variance_Pct 0
    do print-Report
    else
    do Reset-Arrays
    end-if

    end-procedure

    !*************************
    begin-procedure Get-Values
    !*************************

    end-procedure

    #include 'curdttim.sqc' !Get-Current_dateTime procedure
    #include 'datetime.sqc' !Routines for date and time formatting
    #include 'number.sqc' !Routines to format numbers
    #include 'stdapi.sqc' !Update Process API
    #include 'reset.sqc' !Reset printer procedure
    #include 'readxlat.sqc' !Read-Translate-Table procedure
    #include 'getdptnm.sqc' !Get-Department-Name procedure
    #include 'askftd.sqc' !Ask-From-Thru-Date procedure
    #include 'askftdep.sqc' !Ask-From-Thru-Dept procedure
    #include 'geternnm.sqc' !Get-Earnings-Name procedure

  2. Hi, just found this article.
    Is there a way to use the USE-REPORT to have multiple report styles in the SAME PDF output?
    My problem is you can only have one DECLARE-LAYOUT and there no ALTER for it like the ALTER-PRINTER as I want to adjust the Line height on a new page to print some smaller text. The line height doesnt seem to be able to be adjusted so the alter-printer command I use – alter-printer point-size=6 font=4 – has the same line height for smaller text. Theres a pitch option but i cant see how to dynamically adjust that either..

    So Im trying a 2nd DECLARE_LAYOUT and USE-REPORT for it but cant get it to print in the same PDF…

    Thanks, Adrian

  3. Thanks a lot for sharing Awesome documnet for Generate Multiple Report with Unique Name in PeopleSoft SQR. Its very useful.

  4. Hi ,
    I am new to SQR here my requirement is creating a “pdf file” using sqr program itself?
    Note:I have selected ‘PDF’ format in process scheduler but here my requirement says write a code in sqr program itself..

      • Hi Nayan,
        My requirement is “How generate PDF file using Sqr program”?

        Thanks,
        Balaji

      • On System Process Request or Any other run control page you should selection Format As “PDF” from drop down menu.then it will produce PDF documents.
        Let Say an example – Company Car Report (CAR003) run this report from System Process Request then Select PDF as Format.

        Please let me know still you are not clear about that.

  5. Dear Nayan, I gone through your article on “Multiple report” which I found very compact helps to fulfill any requirement relates to generation multiple reports on PS and also very well explained.

  6. HEY HI NAYAN HOPE YOU DOING FINE…ACTUALLY I WENT THROUGH YOUR CODE AND I CAME TO HAVE ONE QUERY …I CAN’T UNDERSTAND THE USE OF USE-REPORT???AND ONE MORE THING IS THERE IN PALCE OF (FOR-REPORTS) IF I AM GIVING AS (FOR-REPORT) IT SHOWING ERROR SO LIKE (FOR-REPORTS) IS SYNTAX ??OTHERWISE I UNDERSTAND YOUR CODE ITS WAS GOOD EXPERIENCE TO LEARN SOMETHING NEW FROM YOUR CODE..HOPING YOU TO POSTING SOMETHING MORE……

    • Hi Kunal First of all thanks for your complements 🙂
      Now come to point,You mention that you can’t understand

       USE-REPORT 

      command.
      USE-REPORT command used For programs with multiple reports, allows the user to switch between reports. For Example You have created 3 Reports i mean your single SQR Programme will generate 3 reports simultaneously.like RPT_A , RPT_B and RPT_C etc.to choose RPT_A then you have to use USE-REPORT Command. Please follow PeopleBook USE-REPORT

       FOR-REPORTS

      Please check that FOR-REPORTS i have use in header section, Please check with spell.

      hope you understand.Anyway please let me know if you need more explanation.

Leave a Reply

Your email address will not be published. Required fields are marked *

Write your code inside of code or pre tag

<code> your code resides here </code>