07-14-2008 3:41 PM
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.
07-14-2008 3:49 PM
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.
07-14-2008 3:52 PM
Hi,
Check this link:
http://abapreports.blogspot.com/2008/06/total-pages-of-abap-report-output.html
Regards
Adil
01-19-2009 12:41 PM