Printing total no of pages in report for background job.
I am having a report which is executed in background. I need to print 1/3, 2/3, 3/3 on corresponding pages.
I have used the following logic.
*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.
WRITE: /(70) 'Heading' CENTERED, 70 SY-PAGNO,'of ', '-----'.
but it prints the last 1/'--
' , 2/'--', 1/3.
while debugging the report in background, it is known that SY-LISEL contains the line of the last page in every iteration of DO loop.
Is there any alternative way to know the total no. of pages other than the logic below:
total no of records in output internal table / sy-linct.
As there are too many internal table for printing, so it is very difficult to know the total no of records.