ABAP Report Page Number

The code below shows how to display the total number of pages in a report like "Page 1 of 8."  However, it doesn't work if you execute the program as a background jobs.

* Declare a variable
DATA L_PAGE_COUNT(5) TYPE C.

*  Copy this code to the end of program
*  Page count will be printed on each page here
    WRITE SY-PAGNO TO L_PAGE_COUNT LEFT-JUSTIFIED.
    DO SY-PAGNO TIMES.
        READ LINE 1 OF PAGE SY-INDEX.
        REPLACE '-----' WITH L_PAGE_COUNT INTO SY-LISEL.
        MODIFY CURRENT LINE.
    ENDDO.

TOP-OF-PAGE.
    WRITE: /(70) 'Heading' CENTERED, 70 SY-PAGNO,'of ', '-----'.

More Function Module
Functions / SAP Script / ALV

Tables
Database Table

ABAP Books List
ABAP/4 Certification, Programming, Smartforms, Sapscripts and Object Oriented Programming Books

Smart Forms
SAP Smartforms

ABAP Menu:
ABAP Example Hints and Tips

Return to Index:-
SAP ABAP/4 Programming, Basis Administration, Configuration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.  The site www.gotothings.com is in no way affiliated with SAP AG.
Any unauthorised copying or mirroring is prohibited.