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.

Similar Messages

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

  • How to corretly show the total pages when a list of data

    Hi,
    I notice the report result only show 1 of 2? when I click on the View Report in the first place. Indeed, the returned result are spreaded to 4 pages... The user needs to click >| button in order to go to the last page and click |< back to the 1st page
    so he can realised the result does have 4 pages and it is very misleading.....
    Any way to fix this ...?! Thanks in advance ...

    Hi kkcci88888,
    According to your description, you want to know total page number when previewing the report.
    In Reporting Services 2008 or later, on-demand processing has been changed. Reports are now processed and rendered page by page as a report user interactively reads through a report. When we view the report for the first time, it will display an estimated
    number of pages until all pages in the report have been rendered. In your scenario, we can add the TotalPages built-in field in the page header or page footer then hide the textbox. So the total pages can be calculated when processing the report then it can
    display in the navigation bar.
    Reference:
    SQL Server Reporting Services Tips and Tricks to Improve the End User Experience
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

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

  • Total of page with ALV LIST

    Hi,
    I want to display on TOP of PAGE : X page / Total page with ALV LIST.
    here is my code :
    FORM eventtab_build USING lt_events TYPE slis_t_event.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = lt_events.
      READ TABLE lt_events WITH KEY name =  slis_ev_top_of_page
      INTO ls_event.
      IF sy-subrc = 0.
        MOVE gc_formname_top_of_page TO ls_event-form.
        APPEND ls_event TO lt_events.
      ENDIF.
      READ TABLE lt_events WITH KEY name =  slis_ev_end_of_list
                                 INTO ls_event.
      IF sy-subrc = 0.
        MOVE 'END-OF-LIST' TO ls_event-form.
        APPEND ls_event TO lt_events.
      ENDIF.
    ENDFORM.                    "eventtab_build
    FORM top_of_page.
      DATA: t_header TYPE slis_t_listheader,
      wa_header TYPE slis_listheader.
      DATA : lv_desc(15) TYPE c,
             lv_month(2) TYPE c,
             lv_year(4) TYPE c.
      DATA : pageno(2) TYPE c.
      lv_month = sd_augdt-high+4(2).
      lv_year  = sd_augdt-high(4).
      SELECT SINGLE ltx FROM t247 INTO lv_desc WHERE mnr = lv_month
      AND spras = sy-langu.
      WRITE : /1 sd_bukrs-low.
      SKIP 1.
      WRITE : 50 'RELEVE DES ACHATS LIVRAISONS FACONS'.
      WRITE : /52 '& TRAVAUX EFFECTUES AU MAROC'.
      WRITE : /54 'OUVRANT DROIT AU DEDUCTION'.
      SKIP 1.
      WRITE : /1 'IDENTIFIANT FISCAL :', '1234',135 'REGIME : ENCAISSEMENT'.
      SKIP 1.
      IF NOT dtab-mwskz IS INITIAL.
        WRITE : /54 'Code TVA: ',dtab-mwskz.
      ENDIF.
    WRITE : 135 'Page No :', sy-pagno RIGHT-JUSTIFIED.
      WRITE : /2 'MOIS :',lv_desc,20 lv_year.
      SKIP 1.
      pageno = sy-pagno.
      wa_header-typ = 'H'.
      CONCATENATE 'PAGE NO : ' pageno ' of ' '****' INTO
      wa_header-info SEPARATED BY space.
      APPEND wa_header TO t_header.
      CLEAR wa_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
         it_list_commentary = gt_list_top_of_page.
        it_list_commentary = t_header.
    ENDFORM.                    "top_of_page
    please, give me a guidance.
    Best regards.

    Hi Please refer this program. You have not written exact problems here. Anyways refer below code:-
    REPORT ZRIL_ALVEVENTS .
    TYPE-POOLS : SLIS.
    DEFINITION OF DATA INTERNAL TABLE
    DATA : IT_SFLIGHT TYPE STANDARD TABLE OF SFLIGHT.
    DEFINITION OF FIELDCATALOG INTERNAL TABLE
    DATA : WA_FCAT TYPE SLIS_FIELDCAT_ALV, "WORK AREA FOR FIELD CATALOG
                 IT_FCAT TYPE SLIS_T_FIELDCAT_ALV.
    DEFINITION FOR EVENT TABLE
    DATA : IT_EVENTS TYPE SLIS_T_EVENT,
                 WA_EVENTS TYPE SLIS_ALV_EVENT. "WORK AREA FOR EVENT"
    DEFINE THE NAME LIST HEADER
      DATA : FORMNAME TYPE SLIS_FORMNAME VALUE 'TOP_OF_LIST'.
    DEFINE THE TABLE FOR LIST OF ACTION ON EVENT SPECIFIED IN LIST HEADER
      DATA : IT_ACTION TYPE SLIS_T_LISTHEADER,
      WA_ACTION TYPE SLIS_LISTHEADER. " WORK AREA FOR LIST OF "
    *POPULATE DATA FROM SFLIGHT TABLE
    SELECT * FROM SFLIGHT INTO TABLE IT_SFLIGHT.
    MAKE THE FIELDCATALOG TABLE FOR SFLIGHT
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = SY-REPID
    I_INTERNAL_TABNAME =
    I_STRUCTURE_NAME = 'SFLIGHT'
    I_CLIENT_NEVER_DISPLAY = 'X'
    I_INCLNAME =
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE =
    CHANGING
    CT_FIELDCAT = IT_FCAT
    EXCEPTIONS
    INCONSISTENT_INTERFACE = 1
    PROGRAM_ERROR = 2
    OTHERS = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    GET THE LIST OF EVENTS IN EVENT INTERNAL TABLE
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = IT_EVENTS
    EXCEPTIONS
    LIST_TYPE_WRONG = 1
    OTHERS = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    GET THE NAME OF EVENT (TOP-OF-LIST) FROM LIST OF EVENTS IN EVENT TABLE
    READ TABLE IT_EVENTS
    WITH KEY NAME = SLIS_EV_TOP_OF_LIST
    INTO WA_EVENTS.
    IF READ OPERATION SUCCESSFUL
    MOVE NAME OF LIST HEADER INTO WORK AREA OF EVENTS
    AND APPEND THAT WORK AREA TO EVENTS TABLE THAT CONTAINS LIST OF
    EVENTS
    IF SY-SUBRC = 0.
    MOVE FORMNAME TO WA_EVENTS-FORM.
    APPEND WA_EVENTS TO IT_EVENTS.
    ENDIF.
    SPECIFY ONE ACTON ON EVENT IN WORK AREA AND APPEND THAT ACTION TO
    TABLE OF ACTION
    WA_ACTION-TYP = 'H'.
    WA_ACTION-INFO = TEXT-001.
    APPEND WA_ACTION TO IT_ACTION.
    CLEAR WA_ACTION.
    WA_ACTION-TYP = 'S'.
    WA_ACTION-KEY = TEXT-002.
    WA_ACTION-INFO = TEXT-003.
    APPEND WA_ACTION TO IT_ACTION.
    CALL THE SUBROUTINE TO DISPLAY THE LIST
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = SY-REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    I_STRUCTURE_NAME =
    IS_LAYOUT =
    IT_FIELDCAT = IT_FCAT
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
    IT_EVENTS = IT_EVENTS
    IT_EVENT_EXIT =
    IS_PRINT =
    IS_REPREP_ID =
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    T_OUTTAB = IT_SFLIGHT
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    FUNCTION MODULE THAT WILL BE CALLED AUTOMATICALLY WHEN THE
    TOP-OF-LIST EVENT IS TRIGGERED.
    FORM TOP_OF_LIST.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = IT_ACTION
    I_LOGO =
    I_END_OF_LIST_GRID =
    ENDFORM.
    Regards
    Abhii..
    Edited by: Abhii on Nov 10, 2009 1:00 PM

  • Record count per page , total record count per report in BI Publisher

    hi,
    In Oracle BI Publisher tool , can you please tell me how to display total record count of a report ? as well as how to display record count per page ?
    Thanks for your help
    Regards
    Gayathri

    check inbox. forwarded the updated template

  • Latest ep of my podcast doesn't show in iTunes. Subscribers CAN download it. Podcast page shows 'Total: 3 items' but lists only items 2 and 3. RSS feed is validated and fine.

    Latest ep of my podcast doesn't show in iTunes store. Subscribers CAN download it. Podcast page shows 'Total: 3 items' but lists only items 2 and 3. RSS feed is validated and fine. How do I get iTunes to display it?

    I've used Feedburner many times and never had such a problem. I am a bit confused, forgive me if I ask for questions already answerd. Have you tried updating the podcast in someone elses copy of iTunes? My guess is that the file is bad since it is working in other programs but not iTunes. I would try making a new .mp4 file and podcasting it and seeing if that works.
    Good luck!
    ~Ben

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

  • 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

  • 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

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

  • Printing A3 page format using ABAP List from SAP is a problem...

    Hi Experts,
    I am trying to print a standard output (ABAP List) A3 page size from SAP.
    I used SWIN, SAPWIN, I9HP4 device types, but none of them worked.
    I created page format type ZYEVMIYE 290MM – 420MM and the page format L120, W200. In order to make it usable with page size is A3. Unfortunately this did not work either.
    The behaviour of the problem is when I tried to print with the device types that mentioned above then printer indicator comes to an error. And nothing comes out from the printer.
    Just to be on the safe side I made a test from windows self test, it resulted success with A3 page size format. So from this point of the view I got a thought that somehow SAP (selected device types) is not able to send correct signal to Printer for page size A3, because on the printer information screen displays ‘load Tray2 for A4’ this is showing that SAP sends Printer a signal for page format A4.
    I need help on how to make SAP (selected device type) send a correct signal to Printer in order to printout A3 page size format.
    Quick reply will much be appreciated.

    Hi,
    At last i got a Solution to my Question.
    The Problem is that in my SAP-Code they have been translated the PDF into 255 string.But i am retreiving using 132 string.So, i resolved in this way.
    <b>For Each dr As DataRow In ds.Tables(0).Rows
    Dim dataline As String = dr(0)
    If dataline.Length < 255 Then
    dataline = dataline.PadRight(255, " ")
    End If
    sb.Append(dataline)
    Next.</b>
    May be this Thread is useful to Others.
    Regards,
    Rajender.

  • 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 to count Total Number of Pages in SAPSCRIPT

    Hi,
    Iam unable to print total number of pages in the First Page of SAPSCRIPT.Iam writing the Logic in the Varibale window.
    Please kindly help me.
    In First Page , The preview is
    Page 1 of 1-
    In Second Page , Teh Preview is
    Page 2 of 2
    The Logic is ....
    1. Variable window of Script
    PERFORM CHECK_PAGE IN PROGRAM ZZZF_SAPSCRIPT_EXITS
    USING &SAPSCRIPT-FORMPAGES&
    CHANGING &WS_PAGE&
    ENDPERFORM
    Page &PAGE(C)& of &WS_PAGE&
    2. Program
    FORM check_page TABLES p_pagein STRUCTURE itcsy
                            p_pageout STRUCTURE itcsy.
      DATA : p_i TYPE sypagno.
       READ TABLE p_pagein INDEX 1.
       IF sy-subrc = 0 .
         p_i = p_pagein-value.
         p_i = p_i - 1 .
    READ TABLE p_pageout INDEX 1.
    CLEAR p_pageout-value.
    *p_pageout-value = p_i+0(3).
    WRITE P_I TO p_pageout-value.
    condense p_pageout-value no-gaps.
         MODIFY p_pageout INDEX sy-tabix.
       ENDIF.
    ENDFORM. "check_page
    Please help me ASAP.
    Regards,
    Deepthi.

    Try this
    'On The Form'
    IF &NEXTPAGE& EQ 0
    DEFINE &DECRE& := '2'
    PERFORM SET_TEXT_SYMBOL IN PROGRAM YSS20200
    USING &SAPSCRIPT-FORMPAGES&
    USING &DECRE&
    ENDPERFORM
    ENDIF
    'In The Program'
    DATA : BEGIN OF script_table OCCURS 0.
    INCLUDE STRUCTURE itcsy.
    DATA END OF script_table.
    Used to modify total pages so they print correctly
    FORM set_text_symbol TABLES input_table LIKE script_table[]
    output_table LIKE script_table[].
    DATA: pageno TYPE i,
    intCnt type i,
    chrPg(2) type c.
    READ TABLE input_table INDEX 1.
    MOVE input_table-VALUE TO pageno.
    READ TABLE input_table INDEX 2.
    MOVE input_table-VALUE TO intCnt.
    subtract intcnt from pageno.
    write pageno to chrpg.
    CALL FUNCTION 'TEXT_SYMBOL_SETVALUE'
    EXPORTING
    NAME = 'FORMPAGES'
    VALUE = chrpg
    VALUE_LENGTH = 0
    REPLACE_SYMBOLS = ' '
    ENDFORM.

Maybe you are looking for