Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Total number of pages in Normal Report

Former Member
0 Kudos

How to display the total number of pages in normal report.

To display current page number I am using sy-pagno.

Is there any system variable to display Total numbetr of pages in normal report.

Thanks in advance.

1 ACCEPTED SOLUTION

0 Kudos

Hi sumi,

example for your reference

REPORT YTHA_TEST line-count 40

no standard page heading.

start-of-selection.

do 100 times.

write:/ sy-tabix.

enddo.

DATA L_PAGE_COUNT(5) TYPE C.

end-of-selection.

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 ', '-----'.

7 REPLIES 7

0 Kudos

Hi,

There is no system variable to find total no of pages but you can use the following to get that one.

  • 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 ', '-----'.

*--- End of Program

Thayalan

0 Kudos

0 Kudos

Former Member
0 Kudos

Sumi,

Try using sy-pagct.

Thanks

Kam

0 Kudos

Hi Sumi!

There is no easy answer. Follow this link to get the long story.

In short:

- you can guess (by dividing your internal table by lines per page)

- you can modify the spool output

Regards,

Christian

0 Kudos

Hi sumi,

example for your reference

REPORT YTHA_TEST line-count 40

no standard page heading.

start-of-selection.

do 100 times.

write:/ sy-tabix.

enddo.

DATA L_PAGE_COUNT(5) TYPE C.

end-of-selection.

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 ', '-----'.

Former Member
0 Kudos

Sumi,

In R/2 , we can use sy-pagct.

In R/3, it is not supported.

Thanks

Kam