Header Ads

  • Recent Posts

    Printing Multiple Reports in a SQR Report

    One of my team had a requirement to create 2 reports from one SQR and faced couple of minor issues. Sharing the issues and the solution we used in this post.

    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

    5 comments:

    1. Where can i find peoplesoft events and things like that?

      ReplyDelete
    2. This is a SQR program, why will you get PeopleSoft events in it ?

      ReplyDelete
    3. thanks for such a wonderful page i found it very informative keep it updates.

      ReplyDelete
    4. Let $Filename_of_Report1 = Requiredpath/1.pdf

      what should i set for Requiredpath? where can i get it?

      ReplyDelete
      Replies
      1. It is nothing else but the directory where you want your reports to be created.

        Delete

    Please refrain for marketing messages and unnecessary back links.

    Post Top Ad

    Post Bottom Ad