SAPScript: manual counting of Total pages

Hi All,
in my requirement I have to print a Back page with Terms & conds on each page of the form, but the Back page is increasing a counter, so I want to calculate total pages manually, is it possible?
In SDN I have found that system always count total no of pages in window type final.
but this is form SmartForms, what about SAPScript?
What system variable stores window type?
more about the problem how Back page is increasing a counter:
[BACK page is increasing a counter?|BACK page is increasing a counter?]
Thanks and best regards,
Mindaugas
Edited by: Mindaugas Kazlauskas on Nov 17, 2008 6:02 PM

Hi Sanjay,
   In your case where you want to increment the value of the total number of pages always use <b>&SAPSCRIPT-JOBPAGES&</b> and for the individual page <b>&PAGE&</b>.
Since you have to increment the value of the total number of pages, pass the value to a variable increment the variable and then display that variable.
:   PERFORM CHECK_PAGE IN PROGRAM Z_SCRIPT
:   USING &SAPSCRIPT-JOBPAGES&               
:   CHANGING &WS_PAGE&                           
:   ENDPERFORM                                
FORM check_page TABLES p_page STRUCTURE itcsy
                       p_page1 STRUCTURE itcsy.
  READ TABLE p_page INDEX 1.
  IF sy-subrc = 0 .
    p_page1-value = p_page-value + 1.
    MODIFY p_page1 INDEX sy-tabix.
  ENDIF.
ENDFORM.                    "check_page
Now your total number of pages would have been increased by 1 and display this variable in the script. But one point is <b>dont declare</b> the variable <b>WS_PAGE</b> in the driver program. If you declare the value will be reset. It will work believe me it works.
Reward if helpful.
Regards,
Tushar

Similar Messages

  • Page count and total page number for multiple forms in spool

    Hi,
    I'm printing 5 or 6 forms in the same spool, they basically represent one big form.  Hence the page numbers should continue from one form to the other, also I will need a total page count that includes all the pages from all the forms. How should I go about doing this?

    I'm not certain, but if you change the the page counter mode to INC for every PAGE except the start page of the first form it may just keep counting. Normally the first page of a form is set to START, making it page 1.

  • How to Determine the "Total" Page Count on HP 2575 All-in-one printer?

    Looking at how to determine the "Total" Page Count on HP 2575 All-in-one printer?   I've seen directions for other HP printers but can't seem to find any for the HP 2575 All-in-one printer.  I am trying to find approximately how many pages my printer has printed since I've owned it.    Any help is much appreciated. 

    The manual says you should be able to use the Embedded Web Server to view statistics. 
    Say thanks by clicking the Kudos Thumbs Up to the right in the post.
    If my post resolved your problem, please mark it as an Accepted Solution ...
    I worked for HP but now I'm retired!

  • Pagination Displaying Count of Total Records available and Current Page

    Hi,
    I need to implement paging in one of our pages.
    The problem is we need to display the count of total number of records the search has resulted and the search results that fall into the current page.
    For e.g. If the search resulted in 100 records total and we are in page 5 (with 10 records per page), I need to display the count 100 on the top and records 51-50 in the page.
    How to get the count of fetched results without running a second SELECT COUNT(1) FROM ... clause.
    Is there a way to do this in a optimized way?
    Thanks

    How to get the count of fetched results without running a second SELECT COUNT(1) FROM ... clause.
    SQL> select cnt "Total", rn "Line", empno, ename, job
      from (select count (*) over () cnt, row_number () over (order by empno) rn,
                   empno, ename, job
              from emp)
    where rn between 4 and 6
         Total       Line      EMPNO ENAME      JOB     
            14          4       7566 JONES      MANAGER 
            14          5       7654 MARTIN     SALESMAN
            14          6       7698 BLAKE      MANAGER 

  • How to Get the Total Page Count in XML Reports?

    Hi All,
    we have a requirement where we have to print Page X of Y(Total Page Count of the document).
    But whenever my header group resets the total count is also reseting.
    for e.g.
    I m getting the page 1 of 4, page 2 of 4, page 3 of 4, page 4 of 4 for my first record.
    same way i am getting page 1 of 3 ,page 2 of 3, page 3 of 3 for my second record.
    But the requirement is to display page 1 of 7, page 2 of 7, page 3 of 7, page 4 of 7 for the first header record.
    And page 5 of 7, page 6 of 7 and page 7of 7 for the second record.
    Is there any way to achieve this?
    Thanks,
    Sachin

    You might have better luck getting an answer here:
    BI Publisher

  • Count total page in ABAP list

    Dear Expert,
    Please help me, how to count total page in ABAP list ?
    Any suggestion or idea to solve this question ?
    Thank you.
    Really appreciate your respond and solution.

    In the first statement of ur report u'll have to reserve some lines for footer as follows:
    REPORT <prg name> LINE-COUNT 25(2).
    here ur list will display 23 lines of data and then 2 lines are reserved for footer.
    This means that in each page u can display 23 lines of text.  Now depending on number of entries in your internal table which contains data to be displayed, we can calculate the number of pages required to print the total output.
    E.g: I have 62 records in my internal table, so to get the total number of pages use the following logic:
          (U can find out the number of recs in internal table dynamically using DESCRIBE stmt)
           62/23 = 2.69
           Round the result to the next integer using CEIL , so the next interger is 3.
           So ur total number of pages is 3.  And u now the current page number by sy-pagno.
    Hope this solves ur problem.

  • Query "Total Page Count"

    I have a HP Deskjet F4400 printer, I am running windows 7. I would like to get the "Total Page Count" from the printer. Is there a way to query this data from this printer?

    Post Author: V361
    CA Forum: General
    You could try creating a formula, for example
    WhilePrintingRecords;PageNofM
    and use the formula, hopefully, CR will be able to calculate the correct page count.

  • Getting total pages incorect in SAPSCRIPT FORM with SAPSCRIPT-FORMPAGES

    Hi,
    In scriptform I have total 3 pages, one is envelope_page, second is page_first, and third page_next. I want total no pages excluding envelop page, I have given HOLD for envelop page, START for first page, and INC for next page. Now when I run, I have only one page as output in my script(excluding envelop) so when am printing &PAGE& of &SAPSCRIPT-FORMPAGES& on first page, its giving me 1 of 2 instead I WANT 1 of 1, I even tried subtracting 1 from &SAPSCRIPT-FORMPAGES&, even by perform, but its not working.
    Its very urgent.
    Basically if anyone can even tell me how to do
    'total pages - 1' , that will also help.
    Please advice.
    Thanks for your help in advance.

    Hi Sanjay,
       In your case where you want to increment the value of the total number of pages always use <b>&SAPSCRIPT-JOBPAGES&</b> and for the individual page <b>&PAGE&</b>.
    Since you have to increment the value of the total number of pages, pass the value to a variable increment the variable and then display that variable.
    :   PERFORM CHECK_PAGE IN PROGRAM Z_SCRIPT
    :   USING &SAPSCRIPT-JOBPAGES&               
    :   CHANGING &WS_PAGE&                           
    :   ENDPERFORM                                
    FORM check_page TABLES p_page STRUCTURE itcsy
                           p_page1 STRUCTURE itcsy.
      READ TABLE p_page INDEX 1.
      IF sy-subrc = 0 .
        p_page1-value = p_page-value + 1.
        MODIFY p_page1 INDEX sy-tabix.
      ENDIF.
    ENDFORM.                    "check_page
    Now your total number of pages would have been increased by 1 and display this variable in the script. But one point is <b>dont declare</b> the variable <b>WS_PAGE</b> in the driver program. If you declare the value will be reset. It will work believe me it works.
    Reward if helpful.
    Regards,
    Tushar

  • How to get total page count (in footer) for just a section?

    In Pages 08, I was able to put a total page count (for only a section) in the footer. However, when I tried doing the same thing in Pages 09, it keeps giving me a total page count for the entire document. I used the same settings for Pages 08 and 09, but 09 keeps giving me the total page count for the entire document. Does anyone know how I can make it work like it did in Pages 08? This is really annoying and preventing me from buying iWork 09 as I need this feature to work. Thanks in advance!

    As far as I know, the Pages '08 behavior was a bug.
    The Pages '09 Help states:
    Here are ways to work with information about a document:
    To add or change descriptive information about a document (author, title, comments, and keywords), click Inspector in the toolbar, click the Document button, and then click Info. Enter or change information in the fields in the pane.
    This information is searchable using Spotlight on computers with Mac OS X version 10.4 and later.
    _To display document statistics, such as number of words, pages, lines, paragraphs, sections, graphics, and characters in the document_, click Inspector in the toolbar, click the Document button, and then click Info.
    _A document’s word and page count_ are always visible at the bottom left of the window. To hide your document’s word count, choose Pages > Preferences, and then deselect “Show word count at window bottom.”
    If a range of text is selected, you can specify the extent of the displayed statistics by choosing Selection or Document from the Range pop-up menu in the Document inspector.
    This time it's clear that except if you select a chunk of text, word count and page count are global document 's properties.
    Yvan KOENIG (from FRANCE lundi 2 février 2009 11:48:56)

  • Count total pages

    hi,
    i would like to know if it is possible to count the total of pages in pdf?
    and if its possible.. can i have a sample code?
    thanks

    you need to have iText jars in your classpath
    PdfReader reader = new PdfReader(args[f]);                    
                     int n = reader.getNumberOfPages();

  • How can I get a total page count of a PDF before placing every page in the PDF?

    Before the [long] spiel, I'm using javascript in InDesign CS3.
    I'd like to create a script that places a multiPage PDF in any number of different impositions. (saddle stitch, 4up signatures, 16up signatures etc.)
    I've easily created a script that iterates through a PDF and places it into a new document as (4,1|2,3), (8,5|6,7) etc, which works for printing in duplex, folding each page in half, and gluing the resulting spines to make a simple thick book (for PDFs with more than, say, 64 pages).
    However, the next step is to re-write the script to create a saddle stitch document (16,1|2,15), (14,3|4,13) ... (10,7|8,9). For this I need to know how many pages there are in the PDF before I start placing the PDF pages, and then making the new document [int((PDFpages+3)/4)] pages long.
    Is there a simple way to get the count of PDFpages without going through a loop and placing the next page from the PDF until the placed page number equals the first page number?
    This way seems wasteful:
    var totPDFPages = 1;
    app.pdfPlacePreferences.pageNumber = totPDFPages;
    myPDFPage = sheetFront.place(File(srcPDF), [0,0])[0];
    var pdfFirstPage = myPDFPage.pdfAttributes.pageNumber;
    while (doneCounting == false) {
    totPDFPages += 1;app.pdfPlacePreferences.pageNumber = totPDFPages;
    myPDFPage = sheetFront.place(File(srcPDF), [0,0])[0];
    if (myPDFPage.pdfAttributes.pageNumber == pdfFirstPage) {
    totPDFPages -=1;
    doneCounting = true;
    alert("PDF has " + totPDFPages + " pages!");exit();
    myPDFPage.remove();
    NB. Javascript above *hasn't* been run, but should look similar once debugged.
    The only thing I've though of to relieve the sheer duplication of placing the PDF twice (once for the count, and once for the imposition), is to create an array of impoPages[counter]=myPDFPage, and then shuffle the pages referenced by the array to the correct sheet and position.
    It'd be much easier to be able to assign pageCount = File(srcPDF).pageCount !!!
    Thanks for any help/tips or even a simple "What are you smoking, man!?"
    Cheers,
    Jezz

    this will get almost all pdf pages count.
    jxswm
    function getPDFPageCount(f){
      if(f.alias){f = f.resolve();}
      if(f == null){return -1;}
      if(f.hidden){f.hidden = false;}
      if(f.readonly){f.readonly = false;}
      f = new File(f.fsName);
      f.encoding = "Binary";
      if(!f.open("r","TEXT","R*ch")){return -1;}
      f.seek(0, 0); var str = f.read(); f.close();
      if(!str){return -1;}
      //f = new File(Folder.temp+"/123.TXT");
      //writeFile(f, str.toSource()); f.execute();
      var ix, _ix, lim, ps;
      ix = str.indexOf("/N ");
      if(ix == -1){
        var src = str.toSource();
        _ix = src.indexOf("<< /Type /Pages /Kids [");
        if(_ix == -1){
          ps = src.match(/<<\/Count (\d+)\/Type\/Pages\/Kids\[/);
          if(ps == null){
            ps = src.match(/obj <<\\n\/Type \/Pages\\n\/Count (\d+)\\n\/Kids \[/);
            if(ps == null){
              ps = src.match(/obj\\n<<\\n\/Type \/Pages\\n\/Kids \[.+\]\\n\/Count (\d+)\\n\//);
              if(ps == null){return -1;}
              lim = parseInt(ps[1]);
              if(isNaN(lim)){return -1;}
              return lim;
            lim = parseInt(ps[1]);
            if(isNaN(lim)){return -1;}
            return lim;
          lim = parseInt(ps[1]);
          if(isNaN(lim)){return -1;}
          return lim;
        ix = src.indexOf("] /Count ", _ix);
        if(ix == -1){return -1;}
        _ix = src.indexOf(">>", ix);
        if(_ix == -1){return -1;}
        lim = parseInt(src.substring(ix+9, _ix));
        if(isNaN(lim)){return -1;}
        return lim;
      _ix = str.indexOf("/T", ix);
      if(_ix == -1){
        ps = str.match(/<<\/Count (\d+)\/Type\/Pages\/Kids\[/);
        if(ps == null){return -1;}
        lim = parseInt(ps[1]);
        if(isNaN(lim)){return -1;}
        return lim;
      lim = parseInt(str.substring(ix+3, _ix));
      if(isNaN(lim)){return -1;}
      return lim;

  • Print tpage number/total page number in a report with width more than 240

    Dear all,
    I need to display total page number as following code sample.
    But I need to put it after position 240.
    this program can print total page number if   it is placed at postion 239 or before.
    WRITE: /234(10) 'Heading',  239 SY-PAGNO,'of ', '-----'.
    Whenever I put  240 or more WRITE: /234(10) 'Heading',  240 SY-PAGNO,'of ', '-----'.
    Total page num could not be displayed.
    Please tell me the solution.
    thanks
    REPORT YPAGECOUNT NO STANDARD PAGE HEADING LINE-SIZE 276  LINE-COUNT 65.
        DATA L_PAGE_COUNT(5) TYPE C.
    TOP-OF-PAGE.
      WRITE : /234(10) 'PAGE', SY-PAGNO,'/ ','-----', ''.
       WRITE: /234(10) 'Heading',  239 SY-PAGNO,'of ', '-----'.
        ULINE.
    START-OF-SELECTION.
      Real list output takes place here
        DO 1000 TIMES.
            WRITE: / 'Line #', SY-LINNO.
        ENDDO.
      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.

    Using Values Greater than 255 for the LINE-SIZE of a List
    If you define a fixed column width greater than 255 using the LINE-SIZE addition in the REPORT or NEW-PAGEstatement, the following notes apply:
    Type definitions: The type group SLIST defines the valid maximum value for the list width (SLIST_MAX_LINESIZE), and contains a type for list lines with maximum width (SLIST_MAX_LISTLINE).
    Accessing the entire contents of a line: To read or modify the entire contents of a wide line, you can use the ... LINE VALUE addition in the READ LINE or MODIFY LINE statements. This is an alternative to using SY-LISEL that is independent of the attributes of the system field (since the length of SY-LISEL is 255 characters).
    Horizontal lines: With extra-wide lists, the "ULINE." statement corresponds to "WRITE / SY-ULINE.". So, for example, "ULINE AT 5(300)." corresponds to "WRITE AT 5(300) SY-ULINE.".
    Output length: You can use the length specification in WRITE (or ULINE) to extend the output length of an extra-wide list up to the value of LINE-SIZE. If you want to output a whole field that is longer than 255 characters, you must use this, even if the field itself is defined as longer than 255 characters.
    Example
    NEW-PAGE LINE-SIZE 1000.
    DATA: F1(500) VALUE 'F1'.
    WRITE: /      F1 COLOR COL_NORMAL.  " Output with length 255
    WRITE: /(500) F1 COLOR COL_NORMAL.  " Output with length 500
    Awrd Points if useful
    Bhupal

  • Is it possible to intitate total page refresh from plugin code

    In 11.1.1.4 EMAIGC we are facing following issue: Target status is not getting refreshed after dependent components status change (Which will be done through through EM Plugin UI actions). This will status will be reflected only after manual refresh.
    From our plugin code , after the dependent component start/stop operations we wanted to call total page refresh, is there any way to handle this?
    Thanks ,
    Ramadevi

    In 11.1.1.4 EMAIGC we are facing following issue: Target status is not getting refreshed after dependent components status change (Which will be done through through EM Plugin UI actions). This will status will be reflected only after manual refresh.
    From our plugin code , after the dependent component start/stop operations we wanted to call total page refresh, is there any way to handle this?
    Thanks ,
    Ramadevi

  • Total Page in ABAP List

    Hi Experts,
    I have a requirement to print: "Page XX of XX" in my ABAP List report (this report is meant to be printed).
    For Current Page, I know that the system field is SY-PAGNO.  But I can't find the field for Total Page. Is there anyway to print this (Total Page) since it means that we have to predict how long the report will be before we WRITE anything?
    Thanks a lot,
    Sam

    In the first statement of ur report u'll have to reserve some lines for footer as follows:
    REPORT <prg name> LINE-COUNT 25(2).
    here ur list will display 23 lines of data and then 2 lines are reserved for footer.
    This means that in each page u can display 23 lines of text.  Now depending on number of entries in your internal table which contains data to be displayed, we can calculate the number of pages required to print the total output.
    E.g: I have 62 records in my internal table, so to get the total number of pages use the following logic:
          (U can find out the number of recs in internal table dynamically using DESCRIBE stmt)
           62/23 = 2.69
           Round the result to the next integer using CEIL , so the next interger is 3.
           So ur total number of pages is 3.  And u now the current page number by sy-pagno.
    Hope this solves ur problem.

  • Total page no in Report

    Hi,
    i want to total page no in my report.
    I am printing total 5 page in the report so i want to print
    Page 1 of 5
    Page 2 of 5
    ' So how to print this type of msg in the report.
    Please help me its very urgent......
    Thanks in advance.
    Kumar AT.

    Hi,
    Check this
    * 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,'of ', '-----'.
    aRs

Maybe you are looking for

  • How can I add an e-mail address to my address book from an e-mail?

    Someone sends me an e-mail and I do not have their e-mail in my Thunderbird address book. Is there a way to enter their information into my address book without having to retype it all into my address book. In other e-mail programs that I have used,

  • MacBook Pro, 15" Late 2008, 10.6.7 Model 2,2 2.16 ghz Core 2 Duo

    MacBook Pro, 15" Late 2008, 10.6.7 Model 2,2 2.16 ghz Core 2 Duo This condition just sprang up.  Machine not dropped, no new parts added, OS stable, no single or significant change to anything on the box. No new external hardware.  Did a restart and

  • Epson perfection 2450 photo and Mountain Lion

    Is there anyone who has been able to use their Epson Perfection 2450 photo with Mountain Lion.  When I bought my new Apple computer, it had Mountain Lion.  I have not been able to use my scanner since then.  Is there a way to get the software necessa

  • Restore problems w/ iPod Classic in Windows Vista

    Hello everyone, I'm having something of a cyclical problem with my 160GB iPod Classic. The iPod has stopped working and displays the message "use Windows to restore" when I turn it on. When I connect the iPod to my computer to attempt the restore, I

  • Currency Symbol Problem on Unix

    I am having a problem with the Currency Symbol display on a Unix Environment. The java code was done on a NT environment and was displaying correctly with the "$" symbol preceding the number. However when I moved this to the unix environment, instead