07-25-2008 6:34 AM
hi experts
Now I am writing a report and I have to get the number of how many pages is going to be displayed.
How can I know this? I know there is a system variantsy-pagnocontains the current page number, but is there any variant that can tell me how many pages are there?
many thanks...
07-25-2008 7:01 AM
Hi,
the page number itself is the number of pages we have right. so we can use that.
07-25-2008 6:39 AM
Hi,
If you are using smartform to print your data..than u can use system variable SFSY-FORMPAGES to get the total number of pages..
Regards,
Smit
07-25-2008 7:01 AM
Hi,
the page number itself is the number of pages we have right. so we can use that.
07-25-2008 7:07 AM
Dear chandrika and Smit
I am not using Smartform, I am just writing a report using SE38, and then write out the result.
e.g. the result will be printed in 3 pages, how could the program know how many pages should be needed?
I just want to print like: page 1/3 2/3 3/3...
07-25-2008 7:12 AM
Hi,
You declare a variable and assign sy-pagno to it after writing the data .
the variable will give you the total number of pages
regards
padma
07-25-2008 7:12 AM
Hi,
you told that sy-pageno is the system variant which stores the current page number.
store that value into a variable and while printing,
write the value.
if u want to write as 1/3,2/3...
take a variable with 0 as initial value.
if variable < pagenumber value
write variable/pagenumber.
increase the variable( variable+1)
endif.
07-25-2008 7:15 AM
REPORT Y_WA no standard page heading line-count 60(5).
data: v_totpage type i.
data: v_temp(3) type c.
Start-of-selection.
do 100 times.
write:/ sy-index.
enddo.
end-of-selection.
v_temp = v_totpage.
do v_totpage times.
read line 1 of page sy-index.
replace '@@@' in sy-lisel with v_temp.
modify line 1 of page sy-index.
enddo.
top-of-page.
write:/60 'page', sy-pagno, '/','@@@'.
v_totpage = sy-pagno.
Here is a sample:
zlines number of lines in the table
sy-srows number of lines in screen
sy-cpage current page
zpages total number of pages type i
temp temporary number type f
describe table itab lines zlines.
temp = zlines / sy-srows.
zpages = trunc( temp ).
temp = frac( temp ).
if temp > 0.
zpages = zpages + 1.
endif.
zpages is the number of pages
write: /'Page ',sy-cpage, ' of ', zpages.
07-25-2008 7:13 AM
Hi Sun,
Try the following code:
The code below shows how to display the total number of pages in a report like "Page 1 / 8."
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,'/ ', '-----'.
Hope this helps you.
Regards,
Chandra Sekhar