Finding total no.of pages in ALV.

Hello All,
I have used the class "CL_SALV_HIERSEQ_TABLE" to display Hierarchical-Sequential ALV.
I have got the event TOP_OF_PAGE from the method GET_EVENT and using this event
I am able to print the current page number(event has exporting parameter page)
on every page while printing.
Now I require the total no.of pages so that I can print in x of YY method.
x - currrent page
YY - total no.of pages.
As this is Hierarchical ALV I dont think it is a good idea to count the total no.of records
in internal table and calculate the no.of pages.
Help me in solving this
With regards,
Sandeep akella
Edited by: sandeep akella on Feb 4, 2011 10:20 AM

Hello Ramneek,
           But how can we calculate the no.of lines that can excatly fit in a page, because in normal ALV the rows are fixed
so by counting the no.of records in internal table we can come to a conclusion. But in hierarchical ALV there is user action involved with expanding the rows as well as closing them, changing the layout like making header or item details to appear in line1,line2 and line3. So I think it is very difficult in that way.
Could you please suggest any other method for this.
With regards,
sandeep akella.

Similar Messages

  • To find total number of pages in XML publisher

    1. Is there any method to find the total number of pages in BI or XML publisher.
    2. Is there any method to to repeat the column(Not rows) on every page.For eg you have table with two columns say "A" and "B" .I want to repeat this B in every page . And A should print only in first page.
    3. Is there any method to print a text say "ABC" only on first page footer based on condition.
    Thanks
    Wazid

    Exactly what my requirement is- In my template i have set header and footer page setup as "different first page'" and also printing the user text at the bottom of the last page using <?start@last-page-first:body?> <?end body?>.When i run the template, for multiple pages output user text is displaying at the bottom of the last page that is working fine but for single page output user text is not displaying at the bottom of the page because of the ""different first page'" header and footer.If you have any idea please suggest.

  • Find total no of pages in a sap script

    Hi,
      How do i find the no of pages that is generated in SAP script, with out generating a spool.
    thanks.

    Dear friend
    new system symbols (note upper case) were therefore introduced:
    &SAPSCRIPT-FORMPAGES&
    Total page number based on the current output layout set:
    &SAPSCRIPT-JOBPAGES&
    Total page number based on all output layout sets created with the function modules OPEN_FORM, START_FORM .. ENDFORM, START_FORM .. END_FORM, ..., CLOSE_FORM
    Examples:
    Page &PAGE& of &SAPSCRIPT-FORMPAGES(C)&
    Specifies the current page number and total page number. The additional specification (C) outputs the symbol in a compressed form, that is the leading blanks are omitted in the 4-character output (default).
    Number of all output pages: &SAPSCRIPT-JOBPAGES(C)&
    Outputs the total number of output pages. Caution: When using this symbol, all output pages must be held in the main storage so that the total page number can be inserted at the end of the output. Larger outputs can affect performance.

  • Total number of pages in Normal Report

    How to display the total number of pages in normal report.
    To display current page number I am using sy-pagno.
    Is there any system variable to display Total numbetr of pages in normal report.
    Thanks in advance.

    Hi,
    There is no system variable to find total no of pages but you can use the following to get that one.
    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 ', '-----'.
    *--- End of Program
    Thayalan

  • How to get the total pages in ALV report?

    Hi guys,
    Since I used page breaks can somebody please help me on how to get the total pages in ALV report?sincerely please...thanks guys.

    automatic display total page.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
    r

  • 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

  • How to find the total no of pages in script

    hi
    how to find the total no of pages in script

    Hi
    ·     &SAPSCRIPT-FORMPAGES&:
    This field contains a number representing the total number of pages of the currently formatted form (any output between START_FORM and END_FORM). The page counter mode (START, INC, HOLD) of the individual pages is ignored. You can use this symbol to formulate information like
    ‘Page x of y’ for your output.
    ·     &SAPSCRIPT-JOBPAGES&:
    This field contains a number representing the total number of pages of all forms contained in the currently formatted print request, in other words, of all forms created using the OPEN_FORM, START_FORM.. ENDFORM, START_FORM.. END_FORM,..., CLOSE_FORM function modules.
    When using the SAPSCRIPT-FORMPAGES or SAPSCRIPT-JOBPAGES symbols, SAPscript leads all output pages of the current form or current print request into main memory to replace the symbol by the appropriate value. For large output jobs, this can mean a very large amount of memory.
    ·     &PAGE&, &NEXTPAGE&
    This symbols are initially converted using the options specified in the form of the page definition.
    Reward all helpfull answers
    Regards
    Pavan

  • How doi print Any variable at the end of page in ALV report?

    Hi,
    Anyone can tell me that How do i print Any variable at the end of page in ALV report?
    Exmale: at the ende of alv report i want to print total no of employee who has taken house loan or education loan.

    Hi,
    Go through these links
    Thread in sdn regarding FOOTER IN ALV
    [ALV  FOOTER;
    Wiki in sdn regarding HEADER AND FOOTER IN ALV
    [https://wiki.sdn.sap.com/wiki/display/Snippets/ABAP%20Objects%20-%20ALV%20Model%20-%20Using%20Header%20and%20Footer]
    Header and Footer in ALV
    [http://www.sap-img.com/abap/test-alv-display-with-header-footer.htm]
    Hope this helps.
    Thank you,
    Pavan.

  • Finding sum for time field in alv

    hi gurus.,
              i need to find total hours.. i am using field of data type 'TIMS' ... i converted the value to decimal in ALV and founfd total hours .. i need the total hours in Time format .. how can i achieve this in alv .. its very urgent ...
    thanks&regards.,
    S.Sivakumar

    Hi Shivakumar,
    I suggest you not to convert TIMS to Decimal
    because it won't give you correct result..
    Eg...
    Time1 = '11:56:32'
    Time2 = '11:50:10'        
    now add these two times...
    u will get the sum of these as 23:06:42
    but in real life... you want the result as 23:46:42
    So the better way for getting accurate result is to convert this
    HH:MM:SS to Seconds
    and then sum these seconds
    then again convert it to HH:MM:SS
    1 hr = 3600 sec
    1 min = 60 sec
    Hope it will solve your problem...
    Reward points if useful...
    Thanks & Regards
    ilesh 24x7

  • How can I get a report with total number of pages printed on my HP Officejet Pro 8610?

    Since knowing the number of pages I print is so critical to a choice of using the "HP Instant Ink Plan" or not, how can I find the total number of pages I have printed on my brand-new (installed 2 days ago) 8610?  And if I can, is it a "resettable" or rolling total?  Don't see anything in user guide and a search yields nothing usable on this blog.
    Printer is installed wirelessly on an older PC with Windows XP SP3.  I can also of course intstall it with network cable but so far it works OK on my home network without network cable.  If it matters which OS, I also have a Lenovo laptop running Vista on which I can install this printer. 
    Please do not respond that I can find the total by counting the number of pieces of paper I have.  Surely the internals of this fine machine must have the requested data so that HP can tell my usage if I select the monthly ink plan!
    This 8610 was a good buy (net $89.00 after trade-in of my six year old J36xx Deskjet) at Office Depot/Max which of course influenced my decision to buy it.  So far I am very happy with printing qualities and speed, have not tried the scanner yet and will probably never use the fax since I have no land line phone. 
    Thanks,
    Harry
    This question was solved.
    View Solution.

    Hi,
    Section #2 of the Printer Ststus report will tell you. Please try:
    Printer status report
    Use the printer status report to view current printer information and ink cartridge status. Also use the printer status report to help you troubleshoot problems with the printer.
    The printer status report also contains a log of recent events.
    If you need to call HP, it is often useful to print the printer status report before calling.
    To print the Printer Status Report
    1. From the printer control panel display, touch and slide your finger across the screen and then touch Setup.
    2. Touch Print Reports and then touch Printer Status Report.
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • How to make top of page in alv  to be printed.

    hello expert:
    i used following function to output alv.
    but after been printed into spool, i cannot find the top of page.
    how to set the print parameter to print the top of ALV.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program          = w_repid
          i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
          is_layout                   = wa_layout
          it_fieldcat                 = it_fieldcat
        TABLES
          t_outtab                    = it_comp
        EXCEPTIONS
          program_error               = 1
          OTHERS                      = 2.
    thank you and best regards,
    Kevin Gao

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
       I_INTERFACE_CHECK           = ' '
         i_bypassing_buffer          = 'X'
       I_BUFFER_ACTIVE             = ' '
         i_callback_program          = sy-repid
       I_CALLBACK_PF_STATUS_SET    = ' '
       I_CALLBACK_USER_COMMAND     = ' '
       I_CALLBACK_TOP_OF_PAGE      = 'HTML_TOP_OF_PAGE'
        I_CALLBACK_HTML_TOP_OF_PAGE = 'HTML_TOP_OF_PAGE'
       I_CALLBACK_HTML_END_OF_LIST = ' '
        i_structure_name            = <DYN_WA>
       I_BACKGROUND_ID             = ' '
       I_GRID_TITLE                =
       I_GRID_SETTINGS             =
         is_layout                   = gds_layout
         it_fieldcat                 = gdt_field_cata
       IT_EXCLUDING                =
       IT_SPECIAL_GROUPS           =
        it_sort                     = gdt_sortinfo
       IT_FILTER                   =
       IS_SEL_HIDE                 =
       I_DEFAULT                   = 'X'
         i_save                      = 'X'
         is_variant                  = gt_var
         it_events                   = gdt_eventcat
       IT_EVENT_EXIT               =
        IS_PRINT                    = gds_print
       IS_REPREP_ID                =
       I_SCREEN_START_COLUMN       = 0
       I_SCREEN_START_LINE         = 0
       I_SCREEN_END_COLUMN         = 0
       I_SCREEN_END_LINE           = 0
       I_HTML_HEIGHT_TOP           = 0
       I_HTML_HEIGHT_END           = 0
       IT_ALV_GRAPHICS             =
       IT_HYPERLINK                =
       IT_ADD_FIELDCAT             =
       IT_EXCEPT_QINFO             =
       IR_SALV_FULLSCREEN_ADAPTER  =
    IMPORTING
       E_EXIT_CAUSED_BY_CALLER     =
       ES_EXIT_CAUSED_BY_USER      =
       TABLES
         t_outtab                    = <dyn_table>
       EXCEPTIONS
         program_error               = 1
         OTHERS                      = 2 .
    *&      Form  html_top_of_page
    FORM html_top_of_page USING document TYPE REF TO cl_dd_document.
      DATA: text TYPE sdydo_text_element.
      CALL METHOD document->add_gap
        EXPORTING
          width = 100.
      text =  'Company Code Data'.
      CALL METHOD document->add_text
        EXPORTING
          text      = text
          sap_style = 'HEADING'.
      CALL METHOD document->new_line.
      CALL METHOD document->new_line.
      CALL METHOD document->new_line.
      text = 'User Name : '.
      CALL METHOD document->add_text
        EXPORTING
          text         = text
          sap_emphasis = 'Strong'.
      CALL METHOD document->add_gap
        EXPORTING
          width = 6.
      text = sy-uname.
      CALL METHOD document->add_text
        EXPORTING
          text      = text
          sap_style = 'Key'.
      CALL METHOD document->add_gap
        EXPORTING
          width = 50.
      text = 'Date : '.
      CALL METHOD document->add_text
        EXPORTING
          text         = text
          sap_emphasis = 'Strong'.
      CALL METHOD document->add_gap
        EXPORTING
          width = 6.
      text = sy-datum.
      CALL METHOD document->add_text
        EXPORTING
          text      = text
          sap_style = 'Key'.
      CALL METHOD document->add_gap
        EXPORTING
          width = 50.
      text = 'Time : '.
      CALL METHOD document->add_text
        EXPORTING
          text         = text
          sap_emphasis = 'Strong'.
      CALL METHOD document->add_gap
        EXPORTING
          width = 6.
      text = sy-uzeit.
      CALL METHOD document->add_text
        EXPORTING
          text      = text
          sap_style = 'Key'.
      CALL METHOD document->new_line.
      CALL METHOD document->new_line.
    ENDFORM.                    "HTML_TOP_OF_PAGE

  • Space in Top of page on alv header

    Hi Experts,
    I do have a query on ALV , Can you please help me in solving my problem.
    Here goes my query...
    I have to develop a ALV where on the top of page i have to display two fields as shown in below which was highlighted in the screen
    http://img410.imageshack.us/my.php?image=op2sn9.jpg
    But i'm getting output as shown below screen
    http://img410.imageshack.us/my.php?image=op1ut4.jpg
    I have tried with space and all other alternatives but i'm unable to get the desired output.
    Can i have any sample code for the same
    Regards
    Nanda

    Hi,
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
    ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid,
          gt_events     type slis_t_event,
          gd_prntparams type slis_print_alv.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform build_events.
    perform build_print_params.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    * There are a number of ways to create a fieldcat.
    * For the purpose of this example i will build the fieldcatalog manualy
    * by populating the internal table fields individually and then
    * appending the rows. This method can be the most time consuming but can
    * also allow you  more control of the final product.
    * Beware though, you need to ensure that all fields required are
    * populated. When using some of functionality available via ALV, such as
    * total. You may need to provide more information than if you were
    * simply displaying the result
    *               I.e. Field type may be required in-order for
    *                    the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    *  fieldcatalog-do_sum      = 'X'.
    *  fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material No'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    *  gd_layout-totals_only        = 'X'.
    *  gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
    *                                         "click(press f2)
    *  gd_layout-zebra             = 'X'.
    *  gd_layout-group_change_edit = 'X'.
    *  gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
    *            i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
    *            it_special_groups       = gd_tabgroup
                it_events               = gt_events
                is_print                = gd_prntparams
                i_save                  = 'X'
    *            is_variant              = z_template
           tables
                t_outtab                = it_ekko
           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.
    endform.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    * up to 10 rows
      from ekpo
      into table it_ekko.
    endform.                    " DATA_RETRIEVAL
    * Form  TOP-OF-PAGE                                                 *
    * ALV Report Header                                                 *
    Form top-of-page.
    *ALV Header declarations
    data: t_header type slis_t_listheader,
          wa_header type slis_listheader,
          t_line like wa_header-info,
          ld_lines type i,
          ld_linesc(10) type c.
    * Title
      wa_header-typ  = 'H'.
      wa_header-info = 'EKKO Table Report'.
      append wa_header to t_header.
      clear wa_header.
    * Date
      wa_header-typ  = 'S'.
      wa_header-key = 'Date: '.
      CONCATENATE  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
                   sy-datum(4) INTO wa_header-info.   "todays date
      append wa_header to t_header.
      clear: wa_header.
    * Total No. of Records Selected
      describe table it_ekko lines ld_lines.
      ld_linesc = ld_lines.
    concatenate 'Total No. of Records Selected:' ld_linesc
                        into t_line separated by space.
      wa_header-typ  = 'A'.
      wa_header-info = t_line.
      append wa_header to t_header.
      clear: wa_header, t_line.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = t_header.
    *            i_logo             = 'Z_LOGO'.
    endform.
    *       FORM USER_COMMAND                                          *
    *       --> R_UCOMM                                                *
    *       --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    * Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
    *   Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
    *     Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    *     Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    *     Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDCASE.
    ENDFORM.
    *&      Form  BUILD_EVENTS
    *       Build events table
    form build_events.
      data: ls_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = gt_events[].
      read table gt_events with key name =  slis_ev_end_of_page
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_PAGE' to ls_event-form.
        append ls_event to gt_events.
      endif.
        read table gt_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 gt_events.
      endif.
    endform.                    " BUILD_EVENTS
    *&      Form  BUILD_PRINT_PARAMS
    *       Setup print parameters
    form build_print_params.
      gd_prntparams-reserve_lines = '3'.   "Lines reserved for footer
      gd_prntparams-no_coverpage = 'X'.
    endform.                    " BUILD_PRINT_PARAMS
    *&      Form  END_OF_PAGE
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    *&      Form  END_OF_LIST
    form END_OF_LIST.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    Try with this sample
    Regards
    Krishna

  • How to devide the top of page in alv grid display

    hi all
    in the alv grid display am getting the page number and total number of pages in the left hand side
    but what i need is i need in the right hand side
    how to get that

    Hi,
    PLease refer to the code below:
    *& Report  ZDEMO_ALVGRID                                               *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic requirement for this demo is to display a number of       *
    *& fields from the EKKO table.                                         *
    REPORT  zdemo_alvgrid                 .
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid,
          gt_events     type slis_t_event,
          gd_prntparams type slis_print_alv.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform build_events.
    perform build_print_params.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    * There are a number of ways to create a fieldcat.
    * For the purpose of this example i will build the fieldcatalog manualy
    * by populating the internal table fields individually and then
    * appending the rows. This method can be the most time consuming but can
    * also allow you  more control of the final product.
    * Beware though, you need to ensure that all fields required are
    * populated. When using some of functionality available via ALV, such as
    * total. You may need to provide more information than if you were
    * simply displaying the result
    *               I.e. Field type may be required in-order for
    *                    the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    *  fieldcatalog-do_sum      = 'X'.
    *  fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-do_sum      = 'X'.
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    *  gd_layout-totals_only        = 'X'.
    *  gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
    *                                         "click(press f2)
    *  gd_layout-zebra             = 'X'.
    *  gd_layout-group_change_edit = 'X'.
    *  gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
    *            i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
    *            it_special_groups       = gd_tabgroup
                it_events               = gt_events
                is_print                = gd_prntparams
                i_save                  = 'X'
    *            is_variant              = z_template
           tables
                t_outtab                = it_ekko
           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.
    endform.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into table it_ekko.
    endform.                    " DATA_RETRIEVAL
    * Form  TOP-OF-PAGE                                                 *
    * ALV Report Header                                                 *
    Form top-of-page.
    *ALV Header declarations
    data: t_header type slis_t_listheader,
          wa_header type slis_listheader,
          t_line like wa_header-info,
          ld_lines type i,
          ld_linesc(10) type c.
    * Title
      wa_header-typ  = 'H'.
      wa_header-info = 'EKKO Table Report'.
      append wa_header to t_header.
      clear wa_header.
    * Date
      wa_header-typ  = 'S'.
      wa_header-key = 'Date: '.
      CONCATENATE  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
                   sy-datum(4) INTO wa_header-info.   "todays date
      append wa_header to t_header.
      clear: wa_header.
    * Total No. of Records Selected
      describe table it_ekko lines ld_lines.
      ld_linesc = ld_lines.
      concatenate 'Total No. of Records Selected: ' ld_linesc
                        into t_line separated by space.
      wa_header-typ  = 'A'.
      wa_header-info = t_line.
      append wa_header to t_header.
      clear: wa_header, t_line.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = t_header.
    *            i_logo             = 'Z_LOGO'.
    endform.
    *       FORM USER_COMMAND                                          *
    *       --> R_UCOMM                                                *
    *       --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    * Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
    *   Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
    *     Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    *     Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    *     Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDCASE.
    ENDFORM.
    *&      Form  BUILD_EVENTS
    *       Build events table
    form build_events.
      data: ls_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = gt_events[].
      read table gt_events with key name =  slis_ev_end_of_page
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_PAGE' to ls_event-form.
        append ls_event to gt_events.
      endif.
        read table gt_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 gt_events.
      endif.
    endform.                    " BUILD_EVENTS
    *&      Form  BUILD_PRINT_PARAMS
    *       Setup print parameters
    form build_print_params.
      gd_prntparams-reserve_lines = '3'.   "Lines reserved for footer
      gd_prntparams-no_coverpage = 'X'.
    endform.                    " BUILD_PRINT_PARAMS
    *&      Form  END_OF_PAGE
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    *&      Form  END_OF_LIST
    form END_OF_LIST.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    Thanks,
    Sriram Ponna.

  • Total no of pages in spool

    i need to print  total no of pages in the classical report output in the spool .
    i have implemented the below code but its calculating incorrect page numbers.
    CALL FUNCTION 'DISPLAY_PAGENUMBER'
    EXPORTING
        LINES_TOTAL        = LW_TOT_LINES_5
        LINES_LOOP         = '7'
    IMPORTING
        PAGES_TOTAL        = lw_tot_pages.
    also i tried the code
    DESCRIBE TABLE GINT_ALV_A  LINES LW_TOT_LINES_1.
    DESCRIBE TABLE GINT_ALV_B  LINES LW_TOT_LINES_2.
    DESCRIBE TABLE GINT_ALV_C  LINES LW_TOT_LINES_3.
    DESCRIBE TABLE GINT_ALV_D  LINES LW_TOT_LINES_4.
    LW_TOT_LINES_5 = LW_TOT_LINES_1 + LW_TOT_LINES_2 + LW_TOT_LINES_3 + LW_TOT_LINES_4 + 35.
    LW_TEMP = LW_TOT_LINES_5 / 30.
    lw_tot_pages = trunc( LW_TEMP ).
    *temp = frac( temp ).
    if LW_TEMP > 0.
    lw_tot_pages = lw_tot_pages + 1.
    endif.
    but even the above code is not working.
    please help
    Message was edited by: Manish Kumar <spoonfeeding, thread locked by moderator>

    FORM f_display_alv_report .
       DATA: lw_tot_lines_1 TYPE i,
             lw_tot_lines_2 TYPE i,
             lw_tot_lines_3 TYPE i,
             lw_tot_lines_4 TYPE i,
             lw_tot_lines_5 TYPE i,
             lw_number_of_header_lines TYPE i VALUE 6,
             lw_lines_per_page TYPE i,
             lw_tot_pages TYPE string,"kkvn512
             lw_totalpage TYPE string VALUE 1,
             lw_temp TYPE f,
             lwa_gint_alv_a TYPE ty_alv,
             lw_index TYPE i,
             lwa_gint_alv_a_copy TYPE ty_alv,
             lwa_gint_alv_b TYPE ty_alv,
             lwa_gint_alv_b_copy TYPE ty_alv,
             lwa_gint_alv_d_copy TYPE ty_alv,
             lwa_gint_alv_d TYPE ty_alv.
       CONSTANTS : lc_of TYPE char2 VALUE 'of'.          " kwff412 EU1K947328
    *            * Find number of lines in report table
       LW_TOT_LINES_1 = LINES( GINT_ALV_A ).
       LW_TOT_LINES_2 = LINES( GINT_ALV_B ).
       LW_TOT_LINES_3 = LINES( GINT_ALV_C ).
       LW_TOT_LINES_4 = LINES( GINT_ALV_D ).
       LW_TOT_LINES_5 = LW_TOT_LINES_1 + LW_TOT_LINES_2 + LW_TOT_LINES_3 + LW_TOT_LINES_4 + 35.
    DESCRIBE TABLE gint_alv_a  LINES lw_tot_lines_1.
      DESCRIBE TABLE gint_alv_b  LINES lw_tot_lines_2.
    DESCRIBE TABLE gint_alv_c  LINES lw_tot_lines_3.
    *  lw_tot_lines_5 = lw_tot_lines_1 + lw_tot_lines_2 + lw_tot_lines_3 + + 35.
    lw_temp = lw_tot_lines_5 / sy-linct.
    lw_tot_pages = TRUNC( lw_temp ).
    lw_temp = FRAC( lw_temp ).
    IF lw_temp = 0.
    lw_tot_pages = lw_tot_pages + 1.
    ENDIF.
    *  CALL FUNCTION 'DISPLAY_PAGENUMBER'
    *  EXPORTING
    *    LINES_TOTAL        = LW_TOT_LINES_5
    *    LINES_LOOP         = sy-srows
    * IMPORTING
    *    PAGES_TOTAL        = lw_tot_pages
    *  *if delivery is same and hu is not same then we need to blank the quantity field
       IF cb_hu IS NOT INITIAL.
         LOOP AT gint_alv_a INTO lwa_gint_alv_a.
           lw_index = sy-tabix.
           lw_index = lw_index + 1.
           READ TABLE gint_alv_a INTO lwa_gint_alv_a_copy INDEX lw_index.
           IF lwa_gint_alv_a-vbeln_lips = lwa_gint_alv_a_copy-vbeln_lips
               AND lwa_gint_alv_a-exidv <> lwa_gint_alv_a_copy-exidv .
             CLEAR lwa_gint_alv_a_copy-lfimg.
           ENDIF.
           MODIFY gint_alv_a INDEX lw_index FROM lwa_gint_alv_a_copy
             TRANSPORTING lfimg  .
         ENDLOOP.
       ENDIF.
    *End of modification kwff412 27.05.2014 EU1K947328
       DATA wa_alv_a TYPE ty_alv.
       WRITE :/ 'Batch Recall Report - Deliveries To Customers'.
       ULINE.
    * Start of modification KKVN512 EU1K947328
       WRITE :/ text-054 , sy-pagno,lc_of,lw_tot_pages LEFT-JUSTIFIED , text-039, sy-datum , sy-uname,sy-sysid,
           sy-mandt.
    * End of modification Kkvn512 EU1K947328
       ULINE.
       FORMAT COLOR COL_HEADING.
       WRITE:/ sy-vline,
                2 'Material' ,
               20 sy-vline,
                'Batch'   ,
              30 sy-vline,
                 'Material description' ,
              70 sy-vline,
                 'batch Status',"COLOR 5,
              100 sy-vline,
                 'DOM' ,"COLOR 5,
             112 sy-vline,
                 'Expiry Date'," COLOR 5,
             132 sy-vline.
       ULINE  .
       FORMAT COLOR COL_HEADING.
       WRITE: / sy-vline,
              2  'Process Order' ,
              20 sy-vline,
                'Plant'  ,"COLOR 5,
              30 sy-vline,
                'Ship To Party' ," COLOR 5,
              50 sy-vline,
                 'Customer'," COLOR 5,
             70 sy-vline,
                'Name1'," COLOR 5,
             132 sy-vline.
       ULINE  .
       FORMAT COLOR COL_HEADING.
       WRITE:/ sy-vline,
            2  'Name 2',"COLOR 5,
          50  sy-vline,
              'Country' ,"COLOR 5,
          70 sy-vline,
               'Adress',"COLOR 5,
          132 sy-vline.
       ULINE  .
       FORMAT COLOR COL_HEADING.
       WRITE:/ sy-vline,
             2 'City',
          37 sy-vline,
              'Post',
          50 sy-vline,
            'Telephone1',
          75 sy-vline,
            'Telephone2',
         100 sy-vline,
             'Fax No.',
         132 sy-vline.
       ULINE  .
       FORMAT COLOR COL_HEADING.
       WRITE:/ sy-vline,
            2 'Delivery',
           20 sy-vline,
             'Quantity',
           50 sy-vline,
             'Batch UOM',
           64 sy-vline,
             'Shipping Date',
           79 sy-vline,
              'Reference Document' ,
          100 sy-vline,
              'Reference Doc. Creation Date',
          132 sy-vline.
       ULINE  .
       FORMAT COLOR COL_HEADING.
       WRITE:/ sy-vline,
           2  'customer PO Number',
           20  sy-vline,
             'Quantity',
          50  sy-vline,
              'HU UOM' ,
          100  sy-vline,
              'HU' ,
          132  sy-vline.
       ULINE  .
       LOOP AT gint_alv_a INTO wa_alv_a.
         FORMAT COLOR OFF.
         WRITE:/ sy-vline,
             2 wa_alv_a-matnr COLOR 3,
            20 sy-vline,
               wa_alv_a-charg,
           30 sy-vline,
             wa_alv_a-maktx,
           75 sy-vline,
              wa_alv_a-atwtb,
           100 sy-vline,
              wa_alv_a-hsdat,
          112 sy-vline,
              wa_alv_a-vfdat,
          132 sy-vline.
         ULINE  .
         WRITE: / sy-vline,
                2  wa_alv_a-aufnr,
                20 sy-vline,
                  wa_alv_a-werks,
                30 sy-vline,
                  wa_alv_a-kunnr_likp,
                50 sy-vline,
                  wa_alv_a-kunnr_kna1,
               70 sy-vline,
                  wa_alv_a-name1,
               132 sy-vline.
    *           'Name 2',
    *      130 SY-VLINE.
         ULINE  .
         WRITE:/ sy-vline,
              2  wa_alv_a-name2,
            50  sy-vline,
                wa_alv_a-land1 ,
            70 sy-vline,
                 wa_alv_a-stras,
            132 sy-vline.
         ULINE  .
         WRITE:/ sy-vline,
                2 wa_alv_a-ort01,
                 sy-vline,
               37 wa_alv_a-pstlz,
            50 sy-vline,
                wa_alv_a-telf1,
            75 sy-vline,
              wa_alv_a-telf2,
            100 sy-vline,
              wa_alv_a-telfx,
           132 sy-vline.
         ULINE  .
         WRITE:/ sy-vline,
              2   wa_alv_a-vbeln_lips,
            20   sy-vline,
                 wa_alv_a-lfimg,
            50  sy-vline,
                 wa_alv_a-meins,
         64     sy-vline,
              wa_alv_a-wadat_ist,
          79  sy-vline,
               wa_alv_a-vgbel,
          100 sy-vline,
                wa_alv_a-aedat,
          132 sy-vline.
         ULINE  .
         WRITE:/ sy-vline,
            2   wa_alv_a-bstnk,
          20   sy-vline,
              wa_alv_a-vemng,
          50 sy-vline,
               wa_alv_a-vemeh,
           100  sy-vline,
              wa_alv_a-exidv ,
           132  sy-vline.
         ULINE  .
       ENDLOOP.
    ********************2nd table**************
        NEW-page.
       WRITE :/ 'Batch Recall Report - Deliveries To AZ Sites'.
       ULINE.
       WRITE :/ text-054 , sy-pagno,lc_of,lw_tot_pages LEFT-JUSTIFIED , text-039, sy-datum , sy-uname,sy-sysid,
           sy-mandt.
    *if delivery is same and hu is not same then we need to blank the quantity field
       IF cb_hu IS NOT INITIAL.
         LOOP AT gint_alv_b INTO lwa_gint_alv_b.
           lw_index = sy-tabix.
           lw_index = lw_index + 1.
           READ TABLE gint_alv_b INTO lwa_gint_alv_b_copy INDEX lw_index.
           IF lwa_gint_alv_b-vbeln_lips = lwa_gint_alv_b_copy-vbeln_lips
                 AND lwa_gint_alv_b-exidv <> lwa_gint_alv_b_copy-exidv .
             CLEAR lwa_gint_alv_b_copy-lfimg.
           ENDIF.
           MODIFY gint_alv_b INDEX lw_index FROM lwa_gint_alv_b_copy
             TRANSPORTING lfimg  .
         ENDLOOP.
       ENDIF.
    * End of modification Kwff412 EU1K947328
       ULINE.
       FORMAT COLOR COL_HEADING.
       WRITE:/ sy-vline,
                2 'Material' ,
               20 sy-vline,
                'Batch'   ,
              30 sy-vline,
                 'Material description' ,
              70 sy-vline,
                 'batch Status',
              100 sy-vline,
                 'DOM' ,
             112 sy-vline,
                 'Expiry Date',
             132 sy-vline.
       ULINE  .
       FORMAT COLOR COL_HEADING.
       WRITE: / sy-vline,
              2  'Process Order' ,
              20 sy-vline,
                'Plant'  ,
              30 sy-vline,
                'Ship To Party' ,
              50 sy-vline,
                 'Customer',
             70 sy-vline,
                'Name1',
             132 sy-vline.
       ULINE  .
       FORMAT COLOR COL_HEADING.
       WRITE:/ sy-vline,
            2  'Name 2',
          50  sy-vline,
              'Country' ,
          70 sy-vline,
               'Adress',
          132 sy-vline.
       ULINE  .
       WRITE:/ sy-vline,
            2 'City',
         37 sy-vline,
             'Post',
         50 sy-vline,
           'Telephone1',
         75 sy-vline,
           'Telephone2',
        100 sy-vline,
            'Fax No.',
        132 sy-vline.
       ULINE  .
       ULINE  .
       FORMAT COLOR COL_HEADING.
       WRITE:/ sy-vline,
         2   'Shipping Date',
        20  sy-vline,
            'Reference Document' ,
        40 sy-vline,
             'Reference Doc. Creation Date',
        70 sy-vline,
             'customer PO Number',
        100 sy-vline,
           'Quantity',
        120 sy-vline,
            'HU UOM' ,
        132  sy-vline.
       ULINE  .
       FORMAT COLOR COL_HEADING.
       WRITE:/ sy-vline,
          2 'HU' ,
         132  sy-vline.
       ULINE  .
       LOOP AT gint_alv_b INTO wa_alv_a.
         FORMAT COLOR OFF.
         WRITE:/ sy-vline,
             2 wa_alv_a-matnr COLOR 3,
            20 sy-vline,
               wa_alv_a-charg,
           30 sy-vline,
             wa_alv_a-maktx,
           75 sy-vline,
              wa_alv_a-atwtb,
           100 sy-vline,
              wa_alv_a-hsdat,
          112 sy-vline,
              wa_alv_a-vfdat,
          132 sy-vline.
         ULINE  .
         WRITE: / sy-vline,
                2  wa_alv_a-aufnr,
                20 sy-vline,
                  wa_alv_a-werks,
                30 sy-vline,
                  wa_alv_a-kunnr_likp,
                50 sy-vline,
                  wa_alv_a-kunnr_kna1,
               70 sy-vline,
                  wa_alv_a-name1,
               132 sy-vline.
    *           'Name 2',
    *      130 SY-VLINE.
         ULINE  .
         WRITE:/ sy-vline,
              2  wa_alv_a-name2,
            50  sy-vline,
                wa_alv_a-land1 ,
            70 sy-vline,
                 wa_alv_a-stras,
            132 sy-vline.
         ULINE  .
         WRITE:/ sy-vline,
                2 wa_alv_a-ort01,
                 sy-vline,
               37 wa_alv_a-pstlz,
            50 sy-vline,
                wa_alv_a-telf1,
            75 sy-vline,
              wa_alv_a-telf2,
            100 sy-vline,
              wa_alv_a-telfx,
           132 sy-vline.
         ULINE  .
         WRITE:/ sy-vline,
              2   wa_alv_a-vbeln_lips,
            20   sy-vline,
                 wa_alv_a-lfimg,
            50  sy-vline,
                 wa_alv_a-meins,
         64     sy-vline,
              wa_alv_a-wadat_ist,
          79  sy-vline,
               wa_alv_a-vgbel,
          100 sy-vline,
                wa_alv_a-aedat,
          132 sy-vline.
         ULINE  .
         WRITE:/ sy-vline,
            2   wa_alv_a-bstnk,
          20   sy-vline,
              wa_alv_a-vemng,
          50 sy-vline,
               wa_alv_a-vemeh,
           100  sy-vline,
              wa_alv_a-exidv ,
           132  sy-vline.
         ULINE  .
       ENDLOOP.
    ***3rd table********************************
       new-PAGE.
       FORMAT COLOR OFF.
       WRITE :/ 'Batch Recall Report -Stock At AZ Sites'.
       ULINE.
       WRITE :/ text-054 , sy-pagno,lc_of,lw_tot_pages LEFT-JUSTIFIED , text-039, sy-datum , sy-uname,sy-sysid,
           sy-mandt.
       FORMAT COLOR COL_HEADING. "kkvn512 EU1K947838
       ULINE.  "kkvn512 EU1K947838
       WRITE:/ sy-vline,
                2 'Material' ,
               20 sy-vline,
                'Batch'   ,
              30 sy-vline,
                 'Material description' ,
              70 sy-vline,
                 'batch Status',
              100 sy-vline,
                 'DOM' ,
             112 sy-vline,
                 'Expiry Date',
             132 sy-vline.
       ULINE  .
       FORMAT COLOR COL_HEADING.
       WRITE: / sy-vline,
              2  'Process Order' ,
              20 sy-vline,
                'Plant'  ,
              30 sy-vline,
                'Unrestricted' ,
              50 sy-vline,
                 'Quality Inspection',
             70 sy-vline,
                'Blocked',
             132 sy-vline.
       ULINE  .
       FORMAT COLOR COL_HEADING.
       WRITE:/ sy-vline,
            2  'Returns',
          50  sy-vline.
       ULINE. "kkvn512
       LOOP AT gint_alv_c INTO gwa_alv_c.
         FORMAT COLOR OFF.
         WRITE:/ sy-vline,
             2 gwa_alv_c-matnr COLOR 3,
            20 sy-vline,
               gwa_alv_c-charg,
            30 sy-vline,
              gwa_alv_c-maktx,
           70 sy-vline,
              gwa_alv_c-atwtb,
           100 sy-vline,
              gwa_alv_c-hsdat,
          112 sy-vline,
              gwa_alv_c-vfdat,
             132 sy-vline.
         ULINE  .
         WRITE: / sy-vline,
                2  gwa_alv_c-aufnr,
                20 sy-vline,
                  gwa_alv_c-werks,
                30 sy-vline,
                  gwa_alv_c-cspem,
                50 sy-vline,
                  gwa_alv_c-cretm,
               70 sy-vline,
                  gwa_alv_c-clabs,
               132 sy-vline.
         ULINE  .
         WRITE:/ sy-vline,
              2  gwa_alv_c-cinsm,
            50  sy-vline.
         ULINE.  "kkvn512
       ENDLOOP.
    ****4th table*******************************
       new-PAGE.
       WRITE :/ 'Batch Recall Report - Incomplete Deliveries '.
       ULINE.
       WRITE :/ text-054 , sy-pagno,lc_of,lw_tot_pages LEFT-JUSTIFIED , text-039, sy-datum , sy-uname,sy-sysid,
           sy-mandt.
       ULINE.
    *if delivery is same and hu is not same then we need to blank the quantity field
       IF cb_hu IS NOT INITIAL.
         LOOP AT gint_alv_d INTO lwa_gint_alv_d.
           lw_index = sy-tabix.
           lw_index = lw_index + 1.
           READ TABLE gint_alv_d INTO lwa_gint_alv_d_copy INDEX lw_index.
           IF lwa_gint_alv_d-vbeln_lips = lwa_gint_alv_d_copy-vbeln_lips
                  AND lwa_gint_alv_d-exidv <> lwa_gint_alv_d_copy-exidv .
             CLEAR lwa_gint_alv_d_copy-lfimg.
           ENDIF.
           MODIFY gint_alv_d INDEX lw_index FROM lwa_gint_alv_d_copy
             TRANSPORTING lfimg  .
         ENDLOOP.
       ENDIF.
    * End of modification Kwff412 EU1K947328
       ULINE.
       FORMAT COLOR COL_HEADING.
       WRITE:/ sy-vline,
                2 'Material' ,
               20 sy-vline,
                  'Batch'   ,
              30 sy-vline,
                 'Material description' ,
              70 sy-vline,
                 'batch Status',
              100 sy-vline,
                 'DOM' ,
             112 sy-vline,
                 'Expiry Date',
             132 sy-vline.
       ULINE  .
       FORMAT COLOR COL_HEADING.
       WRITE: / sy-vline,
              2  'Process Order' ,
              20 sy-vline,
                'Plant'  ,
              30 sy-vline,
                'Ship To Party' ,
              50 sy-vline,
                 'Customer',
             70 sy-vline,
                'Name1',
             132 sy-vline.
       ULINE  .
       FORMAT COLOR COL_HEADING.
       WRITE:/ sy-vline,
            2  'Name 2',
          50  sy-vline,
              'Country' ,
          70 sy-vline,
               'Adress',
          132 sy-vline.
       ULINE  .
       FORMAT COLOR COL_HEADING.
       WRITE:/ sy-vline,
             2 'City',
          37 sy-vline,
              'Post',
          50 sy-vline,
            'Telephone1',
          75 sy-vline,
            'Telephone2',
         100 sy-vline,
             'Fax No.',
         132 sy-vline.
       ULINE  .
       FORMAT COLOR COL_HEADING

  • How do I print the total number of pages in report, like Page 1 of 5?

    Hi
    How do I print the total number of pages in report, like Page 1 of 5?
    thanks,
    kiran.M

    Hi,
    Check for the below code:
    *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 ', '-----'.
    You will find your solution in below thread with code:
    Total Pages in Basic List
    Rgds,
    Shakuntala

Maybe you are looking for