Skip to Content

Page Number

Hi All,

I require to display page number on the SAPScript.

The problem here is I have to display Page 1 when it is @ that is &PAGE& - 1 value.

Please let me know how to achieve this in the SAPscript.

Thanks in advance.

Amit

Hi, I dont want to display like 1 of 2..

but i want to display Page 1 whwn &PAGE& = 2 and so on.

Message was edited by: Amit Khare

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 02:36 PM

    hi,

    Try with this system variable

    <b>

    &SAPSCRIPT-COUNTER_x& (x= 0..9)</b>

    These fields represent ten counter variables that you can use in your text and forms for any counting purposes. You can use the ‘+’ and ‘-’ formatting options to increment or decrement a counter before its value is printed. You can use the DEFINE control command to assign any specific value to a counter.

    Regards,

    Sailaja.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 12:55 PM

    can u explain more..?

    <b>Page &PAGE& of &SAPSCRIPT-FORMPAGES&</b>

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 12:57 PM
    • &PAGE& OF &SAPSCRIPT-FORMPAGES&

    &SAPSCRIPT-FORMPAGES& : this standard script variable stores total no of pages in that layout to print

    &PAGE& stores current page no.

    Regards

    srikanth

    Message was edited by: Srikanth Kidambi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 12:58 PM

    hi,

    &PAGE& is for current page no

    &SAPSCRIPT-FORMPAGES& for total no of pages

    Regards,

    Sailaja.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 12:59 PM

    Hi,

    use

    page &page&

    &sapscript-formpages&

    Regards

    amole

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 12:59 PM

    Hi,

    Write a External perform for this one ..

    <b>In the script:</b>

    PERFORM <Nmae> ZPROGRAM

    USING &PAGE&

    Changing &PAGE_NO&

    ENDPERFORM

    In the Program(ZPROGRAM) .

    form <name> tables intab structure itcsy

    DATA: var type i.

    outab structure itcsy.

    clear intab.

    read table intab with key name = 'PAGE'.

    if sy-subrc = 0.

    var = intab-page + 1.

    ENDIF.

    CLEAR OUTTAB.

    READ TABLE OUTAB WITH KEY NAME = 'PAGE_NO'.

    IF SY-SUBRC = 0.

    OUTAB-VALUE = VAR.

    modify outab index sy-tabix.

    ENDIF.

    in your Script PAGE_NO will have the value of PAGE + 1.

    Regards

    Sudheer

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi,

      You have to do it in a subroutine in the driver program.

      form get_page tables intab structure itcsy
                         outab structure itcsy.
       DATA: v_page type i.
       clear intab.
       read table intab with key name = 'PAGE'.
       if sy-subrc = 0.
        var = intab-page + 1.
       ENDIF.
      
       CLEAR OUTTAB.
       READ TABLE OUTAB WITH KEY NAME = 'PAGNO'.
       IF SY-SUBRC = 0.
        OUTAB-VALUE = V_page.
       endif.
       modify outab index sy-tabix.
      ENDIF.
      
      Call the form in your script.
      PERFORM get_page ZPROGRAM
               USING &PAGE&
               Changing &PAGNO&
      ENDPERFORM

      Regards,

      Richa/

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 01:01 PM

    Hi Amit,

    For displaying Page 1 when the variable &PAGE& holds the value 2 you will need to do the coding in the print program itself.

    You can use the FM 'GET_TEXTSYMBOL' EXPORTING line = &PAGE& start_offset = 0. The importing parameter 'value' will contain the current page number.

    You can then manipulate this as per your requirement and store the result in a global variable.

    Now you can pass this global variable to your SAPScript and display it.

    Hope this helps!

    Regards,

    Saurabh

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 22, 2006 at 01:25 PM

    Hi All,

    thanks for the reply but the second problem here is I cant change the driver program.

    Whatever I do I have to do it in SAPScripts only.

    Amit

    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.