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

Similar Messages

  • How to get total pages from a Word Document?

    I want have created a program with ABAP, It'll print the cover page with form, the detail infomation is in a word document on a file server. I want to display the total pages in the cover page, how can I do? In another word, how to calculate the pages for a word document in sap ?

    I don't know how to use it. My test codes:
    REPORT print_via_ole_example .
    INCLUDE ole2incl .
    DATA: gs_word TYPE ole2_object ,
    gs_documents TYPE ole2_object ,
    gs_newdoc TYPE ole2_object ,
    gs_actdoc TYPE ole2_object ,
    gs_application type ole2_object,
    gs_document type ole2_object ,
    gs_docproperty type ole2_object,
    p_pages type p .
    START-OF-SELECTION .
    CREATE OBJECT gs_word 'WORD.APPLICATION'.
    SET PROPERTY OF gs_word 'Visible' = '0' .
    CALL METHOD OF gs_word 'Documents' = gs_documents.
    CALL METHOD OF gs_documents 'Open'
    EXPORTING #1 = 'd:\test.doc' .
    CALL METHOD OF gs_word 'ActiveDocument' = gs_actdoc .
    get property of gs_actdoc 'Application' = gs_application .
    get property of gs_actdoc 'BuiltinDocumentProperties' = gs_docproperty .
    get property of gs_docproperty 'wdPropertyPages' = p_pages.
    CALL METHOD OF gs_actdoc 'PrintOut' .
    CALL METHOD OF gs_documents  'CLOSE' .
    CALL METHOD OF gs_word 'Quit' .
    new-line.
    END-OF-SELECTION.
    FREE: gs_word, gs_actdoc, gs_documents, gs_newdoc .
    When run it, I can not get the total pages, and winword.exe hung up, can only be terminated in Task Manager.
    Could you help me to modify this test code?
    Thank you .

  • 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

  • Rearrange pages when printing adobe form with multiple master pages

    Hello!
    Good day to you all.
    I have an issue in regards with printing my adobe form with multiple Master pages. I have 4 master pages:
    1st master page: a
    2nd master page: b
    3rd master page: c
    4th master page: d
    all with different headers and footers all having the same contents (items). I don't have issue with one page content (it just prints 4 pages with different headers and footers). The issue comes out once the items exceed 1 page.
    What happens is that the preview/print shows (example: 3-page item)
    a1-a2-a3-b1-b2-b3-c1-c2-c3-d1-d2-d3.
    What i need is to print these such that all 1st pages of the 4 master page to be printed first, then all the 2nd pages, then all 3rd pages. Please see below:
    a1-b1-c1-d1-a2-b2-c2-d2-a3-b3-c3-d3
    This is because we will be using carbonless copy paper during printing and it's possible that it would be printed on batch jobs. Please suggest ways to do this.
    Thanks a lot in advance!
    Best Regards,
    abap_peer_dangs

    Hi,
    Is that requirement of multiple pages as groups only at the time of print or at print preview also...?
    Can you have a Print button on this screen or you should be using the Abobe toolbar's Print button..?
    Well if this on a click of a button in the form and the requirement is only at the time of print and not on print prieview I can have a JS script which does this...
    Let me know if this suffice, I can try with a local file and send you the script.
    @ Chris: I didn't understand what do you mean by reported, I was eager to hear and learn a solution from you may be a new approach which I am not aware of ...?
    Cheers,
    Sai.

  • 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 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)

  • How do I get to open a access's form with LabView?

    I know as to send data to access´s table. Now,I would like to open a access´s form with LabView using activeX or other tools.
    I would like to receive, if possible, a v.i. as example.
    Thank you ...

    This is a resource which should help you:
    http://digital.ni.com/public.nsf/3efedde4322fef198​62567740067f3cc/f763aa1d7cd3c83d862568e8007c51cd?O​penDocument

  • Problem with total page numbers in Scripts

    Hi,
    I have a problem with total number of pages in the Script.
    I have a script of 15 pages.
    On every page, I am using &PAGE& of &SAPSCRIPT-FORMPAGES(C)&.
    Problem is : I am getting only single digit for SAPSCRIPT-FORMPAGES as long as the page number remains in single digit - like -
    1 of 1
    2 of 1
    3 of 1... till 9 of 1.
    But from 10th page, it is printing :
    10 of 15
    11 of 15
    12 of 15... till 15 of 15.
    So, i think the symbol SAPSCRIPT-FORMPAGES(C) is filled with value 15 , but it is prinitng only the first digit '1' for pages 1 to 9 and then printing both the digits '15' for pages from 10 onwards.
    So, please help me out in this problem.
    Thank you.

    Hi Ven,
    The CONDENSE option cannot be used on the program icon SAPSCRIPT-FORMPAGES
    (C) without an explicit length specification: This symbol is
    only replaced with a value after the form has been completely edited, as the
    total number of pages of a form is first known in the program function
    END_FORM or CLOSE_FORM. However, the size of the symbol (number of
    characters) is reserved correctly when the symbol first occurs, with the
    current page number. Therefore, only one character is reserved for option C
    (CONDENSE) on pages 1-9, two characters on pages 10-99, and so on.
    If you are sure that the total number of pages doesn't cross 99(i.e 2-digit number), then use the FORM pages as SAPSCRIPT-FORMPAGES(2CZ).
    Here Z will suppress the leading zeros, for the total number of pages.
    Hope this information would be useful for you.
    Reward points if this is useful.
    Pavan.

  • How to get input value from a HTML form?

    Hi,
    I use URL class to connect to a simple HTML file. In the returned page there is a form with hidden input with default value. How can I get the values?
    Thanx.

    By parsing the HTML.

  • How to display page no for different master pages in one adobe form application

    Hi All,
    we have requirement where we need to  display page nos in different master pages in one single adobe form.
    For the First form the page nos should be displayed pgno of total pages and for 2nd form the page no shuld be displayed as pgno of total pg.
    so please help me with any script or suggestions for displaying the page no accordingly in different master pages. Your suggestions are greatly appreciated.
    Thanks
    Raja.

    Hi Lingaraj,
    We have 2 different Master pages and 2 Body pages. For the seccond Master page the page no are comming correct like 1 of 3 ,2 of 3 and 3 of 3 but for First master page the page no are comming 0 of 3  in all of the page its not displaying the current page no in 1st master page.
    Screen shots are attached for first master page and Hierarchy Node.Pls see the highlighted section in 2nd image.
    Pls see and suggest me accordingly. Hope this helps are let me know anything u require.

  • How to change the page break in adobe forms

    Does anyone know how to change the page break on an adobe form?  I'm hoping it will be the same way you change the page view in excel.
    Can anyone help?
    Thank you in advance,
    Priscilla

    HI
          YOU CAN USE THE FOLLOWING SYSTEM FIELDS OF SMARTFORMS FOR THE MENTIONED PURPOSE
    <b>&SFSY-PAGE& </b>
         Inserts the number of the current print page into the text. You determine the  format of the page number (for example, Arabic, numeric) in the page node. 
    <b>&SFSY-FORMPAGES&</b> 
         Displays the total number of pages for the currently processed form. This  allows you to include texts such as'Page x of y' into your output
    <b>&SFSY-JOBPAGES& </b>
         Contains the total page number of all forms in the currently processed print  request.
    REGARDS
    ANOOP

  • Can't style forms with CSS in DWCS6 / Need to add WYSIWYG menu

    Hello everyone,
    i put both my "problems" in a single topic:
    1) I was trying to add some style to my pages with forms in them, but it seems it doesn't work so well.... i explain: i create a php page, i insert a form with text fields (username and password, for example) and the "login" button. The form ID is "LogForm". I create a CSS class, called ".FormCSS" and inside i put the rule "align text: right". I apply the rule to the form and all the text inside goes to the right. I try online (real server and local server, i tried both) but nothing happens, the elements of the form stay on the left. I tried to apply the rul to the ID of the form. Nothing.
    Probably i'm doing something wrong. Even with text and tables inside the form, i can't move/modify them, at all. In design view i see all the changes, online i can't (chrome and IE). What do i have to do?
    2) I'm creating a page to insert long text in a database, like when you post in a forum. I'd like to insert a sort of toolbar with the align options, style, and so on, like the WYSIWYG editors. Is it possibile? Is there a way to put a toolbar like that in DWCS6?
    Thanks

    #1 You're not styling the correct form selectors: form, fieldset, lable label, input, textarea...
    See example of a CSS styled HTML5 form. View source to see the code.
    HTML5 Form with jQuery Validation
    #2 Look at CK Editor.
    CKEditor.com | The best web text editor for everyone
    Nancy O.

  • All I get is Page Load error about a week after installing Broadband. IE does not work either

    I finally conneted to BB with Virgin. All went well until about a week or two later. All I get is Page Load error. Same with IE. Contacted Virgin and they said there is something blocking access to the Internet. The LAN connection is there and router is all lit up. I am cable connected. Ive switched off and rebooted loads. Stuck and am under pressure from wife to get it fixed. I was previously on dial up Freeserve

    The default of the pref network.http.max-connections has been increased from 30 to 256 in Firefox 6+ versions.
    Try to decrease the value of the pref <b>network.http.max-connections</b> from 256 to 30 as used in Firefox 3 versions.
    *https://support.mozilla.com/kb/Firefox+never+finishes+loading+certain+websites

  • &SAPSCRIPT-FORMPAGES& not giving correct number

    Hi,
    Iam unable to print total number of pages correctly.
    Please kindly help me.
    I am getting  total pages 4 but need to display 3(exclude terms&conditions page) at page 1 of 3 like that.
    I tried to decrement page counter by 1 in the below perform, it's working fine but the issue is ....
    First time when perform is called system is passing 2 at &SAPSCRIPT-FORMPAGES&, next time getting 3 into &SAPSCRIPT-FORMPAGES&.
    PERFORM CHECK_PAGE IN PROGRAM ZZ_RFQ USING &SAPSCRIPT-FORMPAGES&
    CHANGING &WS_PAGE&
    ENDPERFORM
    Page &PAGE(C)& of &WS_PAGE&
    Thanks,
    Geetha.

    Thanks for the reply Max. Let me explain more on the issue.
    I created a custom field on RFQ for terms & conditions. On th form I have to print terms & conditions on the back of first page when the custom field is checked.
    When I check the custom field on RFQ everything is working fine including page numbers.
    When the cusotm field is not checked system is caliculating terms and confitions also as a page (In spool I see blank page) but not printing as it is back of the first page. Client is ok with it. but the prob is with page numbers getting 1 of 4, 2 o 4, 3 of 4.
    So I tried to call this perform when the field is not checked to reduce the page number. as you said SAPSCRIPT-FORMPAGES is calculated at runtime not able to get right values.
    Any alternative to get right value?
    Thanks,
    Geetha.

  • Issue with total no of pages in Sap Acript -- &SAPSCRIPT-FORMPAGES(C)&

    Hi,
    I am using the command &SAPSCRIPT-FORMPAGES(C)& to get the total number of pages.But for the first 9 pages it is displaying only one digit and from the 10th page it is displaying the correct value.
    Example : I have a total number of 26 pages for the first 9 pages the output is displaying as
                    Page 1 of 2
                    Page 2 of 2
                   Page 9 of 2
                   Page 10 of 26
                   Page 11 of 26
                  Page 26 of 26
           Currently i have done it this way in my program
           P4    <b2>Print Date:</>&v_prtdat&,,,,,,,,       Page &page& of
           =       &SAPSCRIPT-FORMPAGES&
    I have gone through the earlier Posts,but i could not right solution.
    Please help me in this regard.

    Hi,
         Try to use this
    &PAGE& of &SAPSCRIPT-FORMPAGES(2)&
    "(C) suppresses leading spaces

Maybe you are looking for