Thursday, November 17, 2016

Multiple Reports from One Single Report

One report can call multiple reports without any intervention. In the following example we have a program which calls ten different reports at single time. Those ten reports will be executed one by one without any interaction of users. The output of those reports execute when click on back button on the output pages.

REPORT zsr_test NO STANDARD PAGE HEADING.

DATAnumber           TYPE tbtcjob-jobcount,
      name             TYPE tbtcjob-jobname VALUE 'JOB_TEST',
      print_parameters TYPE pri_params.

START-OF-SELECTION.

  CALL FUNCTION 'JOB_OPEN'
    EXPORTING
      jobname          name
    IMPORTING
      jobcount         number
    EXCEPTIONS
      cant_create_job  1
      invalid_job_data 2
      jobname_missing  3
      OTHERS           4.

  IF sy-subrc 0.
    SUBMIT zreport1 TO SAP-SPOOL
           SPOOL PARAMETERS print_parameters
           WITHOUT SPOOL DYNPRO
           VIA JOB name NUMBER number AND RETURN.

    SUBMIT zreport2 TO SAP-SPOOL
           SPOOL PARAMETERS print_parameters
           WITHOUT SPOOL DYNPRO
           VIA JOB name NUMBER number AND RETURN.

    SUBMIT zreport3 TO SAP-SPOOL
           SPOOL PARAMETERS print_parameters
           WITHOUT SPOOL DYNPRO
           VIA JOB name NUMBER number AND RETURN.

    SUBMIT zreport4 TO SAP-SPOOL
           SPOOL PARAMETERS print_parameters
           WITHOUT SPOOL DYNPRO
           VIA JOB name NUMBER number AND RETURN.

    SUBMIT zreport5 TO SAP-SPOOL
           SPOOL PARAMETERS print_parameters
           WITHOUT SPOOL DYNPRO
           VIA JOB name NUMBER number AND RETURN.

    SUBMIT zreport6 TO SAP-SPOOL
           SPOOL PARAMETERS print_parameters
           WITHOUT SPOOL DYNPRO
           VIA JOB name NUMBER number AND RETURN.

    SUBMIT zreport7 TO SAP-SPOOL
           SPOOL PARAMETERS print_parameters
           WITHOUT SPOOL DYNPRO
           VIA JOB name NUMBER number AND RETURN.

    SUBMIT zreport8 TO SAP-SPOOL
           SPOOL PARAMETERS print_parameters
           WITHOUT SPOOL DYNPRO
           VIA JOB name NUMBER number AND RETURN.

    SUBMIT zreport9 TO SAP-SPOOL
           SPOOL PARAMETERS print_parameters
           WITHOUT SPOOL DYNPRO
           VIA JOB name NUMBER number AND RETURN.

    SUBMIT zreport10 TO SAP-SPOOL
           SPOOL PARAMETERS print_parameters
           WITHOUT SPOOL DYNPRO
           VIA JOB name NUMBER number AND RETURN.

    IF sy-subrc 0.
      CALL FUNCTION 'JOB_CLOSE'
        EXPORTING
          jobcount             number
          jobname              name
          strtimmed            'X'
        EXCEPTIONS
          cant_start_immediate 1
          invalid_startdate    2
          jobname_missing      3
          job_close_failed     4
          job_nosteps          5
          job_notex            6
          lock_failed          7
          OTHERS               8.

      IF sy-subrc <> 0.
        MESSAGE 'Report not Generated' TYPE 'I'.
      ENDIF.
    ENDIF.
  ENDIF.

4 comments:

Anonymous said...


Thankyou for information excellent blog have a great possible. It was so nice Program sap video tutorials

Anonymous said...


Good post! Thanks for sharing this Information.sap video tutorials

Anonymous said...

SAP Success Factors Real Time Hands on Training in Chennai...

Don't always Depend on Training Institute Alone and so please aware of Best Trainers too..

http://thecreatingexperts.com/sap-successfactors-training-in-chennai/

If You need a Best Trainer over SAP Success Factors Means??? Please ready for an DEMO From the Trainer MR.Karthick
CONTACT:8122241286

Both Classroom/Online Training is Available!!!!!!

Unknown said...

Thanks for your info...Here THE CREATING EXPERTS provide hands on training with real time scenarios

http://thecreatingexperts.com/sap-abap-training-in-chennai/

contact +91-08122241286