Print two pages of ABAP code on one page

Here's a handy ABAP snippet that can be used to print two pages of ABAP code on one page.

This Content Component encountered an error

Here's a handy ABAP snippet that can be used to print two pages of ABAP code on one page (landscape format). And to save even more paper, people could print the sourcecode in duplex mode, so one piece of paper would contain 4 pages of ABAP code.


 *&---------------------------------------------------------------------*
*& Report  ZRSZPRAB                                                    *
*&                                                                     *
*&---------------------------------------------------------------------*
*& Author   :  Ben Meijs   C/TAC                                       *
*& Date     :  01-05-1998                                              *
*& SAP rel. :  R/3 3.0 vv                                              *
*& Purpose  :  Print part of abap/4 sources two pages on one
*&---------------------------------------------------------------------*
*& Maintenance history                                                 *
*& Author       |Date      |Correction Nr                              *
*&              |          |                                           *
*&---------------------------------------------------------------------*

 REPORT  ZRSZPRAB LINE-SIZE       170
                  LINE-COUNT       58.

*----------------------------------------------------------------------*
* TABLES
*----------------------------------------------------------------------*

*----------------------------------------------------------------------*
* DATA
*----------------------------------------------------------------------*
* Internal table with header line
 DATA:    BEGIN OF TA_REPID    OCCURS 0,  "omschrijving
            LINE(72)        ,
          END   OF TA_REPID.
*
 DATA: TA_EDIT LIKE TA_REPID OCCURS 0,
* other help data
 TP_OFFSET LIKE SY-FDPOS    ,          "line number of abap source
 TP_LINNR(6) TYPE N         .          "line number of abap source
*----------------------------------------------------------------------*
* CONSTANTS
*----------------------------------------------------------------------*
 CONSTANTS:
             TRUE     TYPE C         VALUE 'X', "boolean meaning TRUE
             FALSE    TYPE C         VALUE ' '. "boolean meaning FALSE
*----------------------------------------------------------------------*
* SELECT-OPTIONS and PARAMETERS
*----------------------------------------------------------------------*
 SELECT-OPTIONS:
          SO_LINNR    FOR TP_LINNR     "omschrijving
                          NO-EXTENSION.
 PARAMETERS    :                       "omschrijving
          PA_NAME     LIKE TRDIR-NAME  OBLIGATORY,
          PA_EDITR    AS CHECKBOX.
*----------------------------------------------------------------------*
* TOP-OF-PAGE
*----------------------------------------------------------------------*
 TOP-OF-PAGE.
*----------------------------------------------------------------------*
* START-OF-SELECTION : executed after Execute
*----------------------------------------------------------------------*
 START-OF-SELECTION.
   FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

   READ REPORT PA_NAME  INTO TA_REPID .
   IF SY-SUBRC NE  0.
     WRITE: 'ABAP', PA_NAME , 'bestaat niet!' .
   ELSE.
     SY-TVAR1 = PA_NAME.
* afdrukken
     TP_OFFSET = 0.
     LOOP AT TA_REPID.
       TP_LINNR = SY-TABIX * 10.
       CHECK SO_LINNR.
       IF PA_EDITR = TRUE.
         APPEND TA_REPID TO TA_EDIT.
       ELSE.
         WRITE: AT /TP_OFFSET(6) TP_LINNR    NO-GAP,
                                ' '           COLOR OFF NO-GAP,
                                TA_REPID-LINE ,
                                SY-VLINE     .

         IF  SY-LINNO = 57      .
           IF TP_OFFSET = 82.
             NEW-PAGE.
             TP_OFFSET = 0.
           ELSE.
             TP_OFFSET = 82.
             SKIP TO LINE 3.
           ENDIF.
         ENDIF.
       ENDIF.
     ENDLOOP.
   ENDIF.
*----------------------------------------------------------------------*
* END-OF-SELECTION : executed after start-of-selection or STOP
*----------------------------------------------------------------------*
 END-OF-SELECTION.
  IF PA_EDITR = TRUE.
     EDITOR-CALL FOR  TA_EDIT.
  ENDIF.
*----------------------------------------------------------------------*
* FORMS
*----------------------------------------------------------------------*

This was first published in September 2002

Dig deeper on SAP ABAP

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close