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: 

Type 1 report program - printing total pages.

Former Member
0 Kudos

Hi fellow ABAPers,

I am working on Type 1 report program. I want to print the total no of pages Eg: Page : 1 / 10, Page : 2 / 10 .... so on and so forth .

I am getting the page no. from sy-pagno but am unable to derive the total pages for the report, i.e. 10 in the above example.

Kindly assist in deriving the total pages.

Thanks and regards.

3 REPLIES 3

Former Member
0 Kudos

I am assuming that u r working with classical report.

Pl. check this sample code:

REPORT ZLTEST3 NO STANDARD PAGE HEADING

LINE-COUNT 65

LINE-SIZE 80.

DATA: NUM_PAGES_C(10) TYPE C.

PERFORM WRITE.

PERFORM GET_TOTAL_PAGENO.

TOP-OF-PAGE.

WRITE:/(SY-LINCT) 'TEST - TEST' CENTERED.

WRITE: / SY-DATUM, 60 SY-PAGNO,'of', '*****'.

SKIP.

&----


*& Form WRITE

&----


  • text *

----


  • --> p1 text

  • <-- p2 text

----


FORM WRITE.

DO 200 TIMES.

WRITE:/ 'TEST', SY-LINNO.

ENDDO.

ENDFORM. " WRITE

&----


*& Form GET_TOTAL_PAGENO

&----


  • text *

----


  • --> p1 text

  • <-- p2 text

----


FORM GET_TOTAL_PAGENO.

WRITE SY-PAGNO TO NUM_PAGES_C LEFT-JUSTIFIED.

DO SY-PAGNO TIMES.

READ LINE 2 OF PAGE SY-INDEX.

REPLACE '***' WITH NUM_PAGES_C INTO SY-LISEL.

MODIFY LINE 2 OF PAGE SY-INDEX.

ENDDO.

ENDFORM. " GET_TOTAL_PAGENO

This technique only works with foreground, in background it will not work.

Regards,

JOy.

former_member705122
Active Contributor

Former Member
0 Kudos

-