How to count page number of report in ABAP/4
In the first session we can define TOP-OF-PAGE event as normally and we will insert the special wording replace the page count.
In the second session we will place this code at the last of program. This session will replace back the no. of last page to special wording that you define in the first session.
*** Note: If the special wording is not in the first line of report, you can change the sentence ’READ LINE 1 OF PAGE SY-INDEX.’ to ’READ LINE X OF PAGE SY-INDEX.’ by X is the no. of line that you want to modify.
*** First Session
TOP-OF-PAGE.
WRITE: /(70) ’PAGE: ’, SY-PAGNO,’of ’,
...
...
...
*** Second Session
DATA LC_PAGE_COUNT(3) TYPE C.
WRITE SY-PAGNO TO LC_PAGE_COUNT LEFT-JUSTIFIED.
DO SY-PAGNO TIMES.
READ LINE 1 OF PAGE SY-INDEX.
REPLACE ’&@&’ WITH LC_PAGE_COUNT INTO SY-LISEL.
MODIFY CURRENT LINE.
ENDDO.
- thitima's blog
- 1752 reads
Post new comment