Skip to Content
author's profile photo Former Member
Former Member

page n of n

hi everybody,

i would like to ask help how to code this page 1 of 10.

what i knew is sy-pagno which displays the current page however i dont know what command i would use to determined the total pages.

thanks.

den

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    Posted on Jan 07, 2005 at 08:46 AM

    Hi,

    in general there are two ways to get total number of pages for a list:

    - guessing like Fuat's example - which can get nasty, when you have variable headers; subtotals, which occur depending how often some key fields change...

    - writing the complete list, re-reading the spool out of spool system, modifying the output and adding correct total number on each page and re-saving the spool.

    If guessing isn't enough, maybe a legend on the last page indicates: here is the end - that was for some customers sufficient. Otherwise it will be easier to change to smartforms (or sapscript), then implementing option two (I know of one realization, it's really not worth the effort)!

    Regards,

    Christian

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 07, 2005 at 08:07 AM
    • 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.

    -


    please give points if it helps.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 07, 2005 at 07:37 AM

    in smartform or

    in sapscript or

    in list ?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 07, 2005 at 07:37 AM

    Den,

    I suppose you display in a list the contents of an internal table.

    Would it be possible to find the number of pages by dividing the total number of records in the internal table by the number of lines on a page?

    Bogdan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 07, 2005 at 09:17 AM

    thank you for the asnwers and comments. however the best answers i got is from christian. my list is not a flat list, my list contains sub header, line item that i get from diffent table that add into my screen. its not a simple way of getting the total rec of the table and divide it to the number of line.

    i really appreciate all your answers. all answers are helpful.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 10, 2005 at 03:58 PM

    Hi,

    nice code of Rich, unfortunately only working online. These statements (read line, hide, modify line) were designed for interactive lists 😔

    (I copied the source, ran online: fine! Planning this mini-report in background, result: Page: 1 of ****)

    Regards,

    Christian

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.