Display Page number in ALV List.

Dear Friends,
    I want to display page numbers in ALV list print output. But I dont know how to do that without using objects.
Please suggest.
Regards,
Madan.

TRY LIKE THIS
data : ifieldcat type slis_t_fieldcat_alv,
       wfieldcat type slis_fieldcat_alv,
       IEVENT TYPE SLIS_T_EVENT,
       WEVENT TYPE SLIS_ALV_EVENT..
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
   I_LIST_TYPE           = 0
IMPORTING
   ET_EVENTS             = IEVENT
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.
READ TABLE IEVENT INTO WEVENT WITH KEY NAME = 'TOP_OF_PAGE'.
IF SY-SUBRC EQ 0.
WEVENT-FORM = 'TOP_OF_PAGE'.
MODIFY IEVENT FROM WEVENT INDEX SY-TABIX.
ENDIF.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
  I_INTERFACE_CHECK                 = ' '
  I_BYPASSING_BUFFER                =
  I_BUFFER_ACTIVE                   = ' '
   I_CALLBACK_PROGRAM                = REPID
  I_CALLBACK_PF_STATUS_SET          = ' '
  I_CALLBACK_USER_COMMAND           = ' '
  I_CALLBACK_TOP_OF_PAGE            = 'TOPOFPAGE'
  I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
  I_CALLBACK_HTML_END_OF_LIST       = ' '
  I_STRUCTURE_NAME                  =
  I_BACKGROUND_ID                   = ' '
  I_GRID_TITLE                      =
  I_GRID_SETTINGS                   =
  IS_LAYOUT                         =
   IT_FIELDCAT                       = IFIELDCAT
  IT_EXCLUDING                      =
  IT_SPECIAL_GROUPS                 =
  IT_SORT                           =
  IT_FILTER                         =
  IS_SEL_HIDE                       =
  I_DEFAULT                         = 'X'
  I_SAVE                            = ' '
  IS_VARIANT                        =
   IT_EVENTS                         = IEVENT
  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
  IT_ALV_GRAPHICS                   =
  IT_ADD_FIELDCAT                   =
  IT_HYPERLINK                      =
  I_HTML_HEIGHT_TOP                 =
  I_HTML_HEIGHT_END                 =
  IT_EXCEPT_QINFO                   =
IMPORTING
  E_EXIT_CAUSED_BY_CALLER           =
  ES_EXIT_CAUSED_BY_USER            =
  TABLES
    T_OUTTAB                          = ITAB
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.
FORM TOP_OF_PAGE.
WRITE : /10 'HeadinG OF ALV'.
WRITE : 100 SY-PAGNO.
ENDFORM.
ONE THING IS THERE YOU CAN USE WRITE FOR ONLY LIST DISPLAY NOT FOR GRID DISPALY.
REGARDS
SHIBA DUTTA

Similar Messages

  • Displaying page number in ALV grid display

    Hi,
    Is it possible to display page number in an ALV grid display?
    If yes, how?
    I tried it in top of page event, but it didnt work.
    Harmeet.

    hi,
    check out the sample code....
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program          = sy-repid
            i_callback_user_command     = 'F00007_USER_COMMAND'
            i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
            it_fieldcat                 = g_t_fieldcat[]
            it_events                   = gt_events[]
            i_save                      = 'A'
          TABLES
            t_outtab                    = g_t_final_report[]
          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.
          FORM TOP_OF_PAGE                                              *
    FORM top_of_page.
    write : sy-pagno.
    ENDFORM.                    "top_of_page
    Reward Appropriate points.
    Regards,
    Mansi.

  • How to display page-no in alv list

    Hi All,
    I am trying to display pag number using events 'top-of-page'.
    when i write sy-pagno in top-of-page form its printing only 1, if i press page down i need to change the page number. it should display current pag number. How to achieve this. thanks.
    regards
    vishal

    we can print the pageno .I was also trying for the same finally succeded
    It can be done in the following manner
    DATA SORTING AND SUBTOTAL
    DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
    CLEAR GS_SORT.
    GS_SORT-FIELDNAME = 'FIELD1'.
    GS_SORT-SPOS      = 1.
    GS_SORT-UP        = 'X'.
    GS_SORT-SUBTOT    = 'X'.
    <b>gs_sort-group     = '* '.            "<<<new page</b>
    APPEND GS_SORT TO GT_SORT.
    CLEAR GS_SORT.
    GS_SORT-FIELDNAME = 'FIELD2'.
    GS_SORT-SPOS      = 2.
    GS_SORT-UP        = 'X'.
    gs_sort-group     = ' '.            "<<<new page
    *GS_SORT-SUBTOT    = 'X'.
    APPEND GS_SORT TO GT_SORT.
    ABAP List Viewer
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER =
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = G_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    I_STRUCTURE_NAME = 'ITAB1'
    IS_LAYOUT =  GS_LAYOUT
    IT_FIELDCAT = GT_FIELDCAT[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
      IT_SORT = GT_SORT[]
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
      IT_EVENTS = GT_EVENTS[]
    IT_EVENT_EXIT =
      IS_PRINT = GS_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 = ITAB1
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2.

  • Display Row number in ALV List

    Hi All,
          I have 50 records in Internal table . I  am displaying this internal table data in ALV List display. I want to print row number in ALV . Could you please help me how to print.
    Thanks,
    PRSN.

    HI,
      take one more field in the internal table and fill it up with the number when you are filling it with data .
    loop at itab.
    it_final-seqno = sy-tabix.
    append it_final.
    endloop.

  • Page number in ALV report

    Hi all,
    I use top of page to print page number for ALV report. When i run my report in backgrond and see the spool, the page is always started from page 2.
    These does not happen when I use non-ALV report, report prints the header starting from page 1 normally. It is weird.
    does anyone of you ever face such of that problem ?
    thanks alots
    Alia

    Hi Alia,
    Page number is usually not set in an ALV display, as compared to  List processing.
    r u sure this is a requirement?
    chk this:
    ALV Print page numbers
    Regards,
    Anjali

  • Is it possible to display LOGO in simple ALV list?

    Hi Guys,
    Is it possible to display LOGO in simple ALV list. If yes plz explain in details.
    Thanks
    Sharat

    Yes it is possible to display logo at the top of the page.
    TYPE-POOLS: slis.
    *     Data Decalaration
    DATA: it_vbak TYPE TABLE OF vbak.
    DATA: g_repid TYPE sy-repid.
    DATA: it_listheader TYPE slis_t_listheader,
           wa_listheader TYPE slis_listheader.
    *     START-OF-SELECTION
    START-OF-SELECTION.
       g_repid = sy-repid.
       SELECT * FROM vbak INTO TABLE it_vbak.
       PERFORM build_alv_header.
       CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
           i_callback_program     = g_repid
           i_callback_top_of_page = 'TOP_OF_PAGE'
           i_structure_name       = 'vbak'
         TABLES
           t_outtab               = it_vbak.
    *&      Form  BUILD_ALV_HEADER
    FORM build_alv_header .
    *  Type H is used to display headers i.e. big font
       wa_listheader-typ  = 'H'.
       wa_listheader-info ='Flight Details'.
       APPEND wa_listheader TO it_listheader.
       CLEAR wa_listheader.
    *  Type S is used to display key and value pairs
       wa_listheader-typ = 'S'.
       APPEND wa_listheader TO it_listheader.
       CLEAR wa_listheader.
    *  Type A is used to display italic font
       wa_listheader-typ = 'A'.
       wa_listheader-key = 'Date    :' .
       wa_listheader-info ='SAP ALV Report'.
       APPEND wa_listheader TO it_listheader.
       CLEAR wa_listheader.
    ENDFORM.                    " BUILD_ALV_HEADER
    *&      Form  top_of_page
    FORM top_of_page.
       CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
         EXPORTING
           it_list_commentary = it_listheader
           i_logo         = 'PARI'.
    ENDFORM.                    "top_of_page

  • Help needed- Reg: Display page number in SQL Reports

    Hi,
    I need to display page number in " page no: X of Y " format where X is current page & Y is total number of pages. Now I am able to display only the current page using ' sql.pno '. but not able to display in ' X of Y ' format.
    Any inputs in this regard will be helpful.
    Thanks & Regards,
    Anilkumar.

    Hello Anil,
    If you have the above requirement for Oracle Reports then follow the steps:
    1.In the Paper Layout view or Paper Design view, choose InsertPage Number.
    2. In the Insert Page Number dialog box, choose from the list the location for the page number.
    3.Click the desired page number format: Page Number Only or Page Number and Total Pages.
    Cheers,
    Suresh

  • Displaying Page No in ALV Grid top of page

    Dear All,
    I have tio display the page number in ALV grid top of page .
    That is 001 of 100
    next page 002 of 100
    this page number should increase / decrease depending upon page up and page down also on scrolling the ALV bar .
    How to achieve this?
    Regards

    Hi Rajendra,
    I guess you need to write your logic to get the page numbers. Check the below link.
    Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
    Thanks
    Satya
    Edited by: Rob Burbank on Aug 24, 2010 5:57 PM

  • Displaying a header on alv list

    hi there,
    i want to display a header on alv list.
    i have already used
    call method alvgrid->set_table_for_first_display
    regrads

    Hi,
    use the TOP_OF_PAGE event and add the event to the IT_EVENTS internal table..
    In the subroutine that is assigned to the event..
    FORM top_of_page.
            CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
              EXPORTING
                it_list_commentary = heading.
    ENDFORM.
    Thanks,
    Naren

  • Get PDF Display Page Number Acrobat Reader

    Hi,
    I am working on some automation in that I used Acrobat Reader XI to view PDF.
    I want to get display page number of opened PDF.
    I used app.doc.pageNum();
    It is giveing me the page number when I used this code in Acrobat Debuger manually.
    But I am using VB.net. so please give me the solution how to run this code on opened PDF from vb.net and get the page number or can we create plugin which I can call from VB.Net code and get the page number
    because I am not getting app object in VB.net.

    sorry I typed it wron its app.doc.pageNum;

  • Displaying Page number in all pages of sap script output

    Hi All,
    I have a issues in displaying page number in all pages of sap script output.
    I have created a seperate window just above main window to display page number.
    I have given &PAGE& in the layout editor.
    Now in the sap script output i am getting page number as 1 in all the pages page number is not changing for pages-2,3, etc..
    Can anybody tell me the reason for the same!
    In some other objects same syntax is working fine. For this object it is not working!
    Is there any setting changes!
    Thanks i
    Thanks,
    Deep.

    Hi,
    Just check the Page Counter of the Next or Second Page which you defined.
    First page
    Mode                     START
    Numbering Type           ARABIC
    Second Page
    Mode                     INC
    Numbering Type           ARABIC
    Regards
    Bala Krishna
    Edited by: Bala Krishna on Oct 17, 2008 11:23 AM

  • Page Break in ALV List display

    Dear Community,
    I have a requirement wherein we have group account number ,under which there are 'n'sub group account numbers.Each sub group account number has credit,debit,cumulative(credit-debit) values.whenever group account number changes automatically a new page should be triggered.Now the problem sub account number is running into pages but same page number is displayed even it runs into several pages.I need to restrict this ,at the end of the page(std is 65 lines/page)page break has to be applied,along with the subtotals of the credit,debit,cumulative respectively and page number has to be displayed and the process should continue with the remaining sub group account number values.
    Please do the needfull.
    Thanks & Regards,
    Ullas

    Hi,
    In order to achieve the Page Breaks, we need to fill in the sort catalog structure, LVC_S_SORT, as follows:
    FS_SORT-SPOS = ‘1’. “ Sort order position
    FS_SORT-FIELDNAME = ‘CARRID’. “ Field name on which page break need to be triggered. Whenever this field changes, page break will trigger
    FS_SORT-GROUP = ‘’. “ This has 2 options. ‘’ for page breaks and ‘U’ for underlines.
    FS_SORT-OBLIGATORY = ‘UL’. “ If you need to retail these page breaks through out, we need to set this as obligatory. Otherwise, if the end user selects any other field and presses SORT, then page breaks would disappear
    Hope this helps you.
    Enjoy SAP.
    Pankaj Singh.

  • Display Page numbers in ALV

    Hi,
    I would like to know how to display page numbers in an ALv display(both grid display and list display).I tried to use the system variable sy-pagno .But couldn't get the desired output.

    Hi,
    I don't think you will be able to display page numbers in case of ALV Grid, unless you are in the list view. In case you are using the ALV Grid, you have to implement the top_of_page method (an event handler) for ALV Grid class and write the page number there. The page numbers will be displayed once you choose the list view.
    Hope this helps.
    Regards
    Message was edited by: Shehryar Khan

  • How to display header for secondrary alv list

    HI ALL,
    WHEN I RAN THIS REPORT HEADER IS COMING FOR FIRST ALV.WHEN I DOUBLE CLICK ON SALES ORDER NUMBER IT SHOWS SECONDARY LIST. FOR THIS SECONDARY LIST HEADER IS NOT COMING.ANY BODY CAN SUGGEST HOW TO FIXZ THIS PROBLEM
    REPORT ZMAHI1 LINE-SIZE 30.
    TYPE-POOLS : SLIS.
    *TYPES : BEGIN OF I_VBAK,
           VBELN TYPE VBAK-VBELN,
           ERDAT TYPE VBAK-ERDAT,
           ERNAM TYPE VBAK-ERNAM,
           ERZET TYPE VBAK-ERZET,
           VTWEG TYPE VBAK-VTWEG,
           VKORG TYPE VBAK-VKORG,
          END OF I_VBAK.
    DATA : BEGIN OF IT_VBAK OCCURS 0,
            VBELN TYPE VBAK-VBELN,
            ERDAT TYPE VBAK-ERDAT,
            ERNAM TYPE VBAK-ERNAM,
            ERZET TYPE VBAK-ERZET,
            VTWEG TYPE VBAK-VTWEG,
            VKORG TYPE VBAK-VKORG,
           END OF IT_VBAK.
    *DATA : IT_VBAK TYPE STANDARD TABLE OF I_VBAK INITIAL SIZE 0,
          WA_VBAK TYPE I_VBAK.
    *TYPES : BEGIN OF I_VBAP,
           VBELN TYPE VBAP-VBELN,
           MATNR TYPE VBAP-MATNR,
           ERZET TYPE VBAP-ERZET,
           POSNR TYPE VBAP-POSNR,
          END OF I_VBAP.
    DATA : BEGIN OF IT_VBAP OCCURS 0,
            VBELN TYPE VBAP-VBELN,
            MATNR TYPE VBAP-MATNR,
            ERZET TYPE VBAP-ERZET,
            POSNR TYPE VBAP-POSNR,
           LINE_COLOR(4) TYPE C,     "Used to store row color attributes
          END OF IT_VBAP.
    *DATA : IT_VBAP TYPE STANDARD TABLE OF I_VBAP INITIAL SIZE 0,
          WA_VBAP TYPE I_VBAP.
    DATA : EVENTCAT TYPE SLIS_T_EVENT.
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    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.
    DATA:  I_TITLE_VBAK TYPE LVC_TITLE VALUE 'ALV LIST FIRST'.
    DATA:  I_TITLE_VBAP TYPE LVC_TITLE VALUE 'ALV LIST SECOND'.
    DATA: V_REPID LIKE SY-REPID .
    DATA :    HEADING TYPE  SLIS_T_LISTHEADER.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-T01.
    PARAMETERS : P_VBELN TYPE VBAK-VBELN.
    SELECTION-SCREEN END OF BLOCK B1.
    INITIALIZATION.
      V_REPID = SY-REPID.
    START-OF-SELECTION.
      PERFORM GET_DATA.
      PERFORM BUILT_FIELDCATALOG.
      PERFORM E03_EVENTTAB_BUILD USING EVENTCAT[].
      PERFORM COMMENT_BUILD USING HEADING[].
      PERFORM GRID_DISPLAY.
    *&      Form  GET_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DATA.
      SELECT VBELN
             ERDAT
             ERNAM
             ERZET
             VTWEG
             VKORG
         FROM VBAK
         INTO TABLE IT_VBAK
      WHERE VBELN EQ P_VBELN.
    ENDFORM.                    " GET_DATA
    *&      Form  BUILT_FIELDCATALOG
          text
    -->  p1        text
    <--  p2        text
    FORM BUILT_FIELDCATALOG.
      CLEAR I_FIELDCAT.
      REFRESH : I_FIELDCAT[].
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      WA_FIELDCAT-FIELDNAME = 'VBELN'.
      WA_FIELDCAT-SELTEXT_M = 'SALES DOC NO'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      WA_FIELDCAT-FIELDNAME = 'ERDAT'.
      WA_FIELDCAT-SELTEXT_M = 'Creation Date'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      WA_FIELDCAT-FIELDNAME = 'ERNAM'.
      WA_FIELDCAT-SELTEXT_M = 'NAME'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      WA_FIELDCAT-FIELDNAME = 'ERZET'.
      WA_FIELDCAT-SELTEXT_M = 'TIME'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      WA_FIELDCAT-FIELDNAME = 'VTWEG'.
      WA_FIELDCAT-SELTEXT_M = 'DIS CHANNEL'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      WA_FIELDCAT-FIELDNAME = 'VKORG'.
      WA_FIELDCAT-SELTEXT_M = 'SALES ORG'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    " BUILT_FIELDCATALOG
    *&      Form  GRID_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    FORM GRID_DISPLAY.
      V_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM      = V_REPID
                I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
                I_CALLBACK_TOP_OF_PAGE  = 'TOP-OF-PAGE'
                IT_FIELDCAT             = I_FIELDCAT[]
                I_SAVE                  = 'A'
                IT_EVENTS               = EVENTCAT[]
           TABLES
                T_OUTTAB                = IT_VBAK
           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.                    " GRID_DISPLAY
    for header
    *&      Form  HEADER
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                IT_LIST_COMMENTARY = HEADING.
    ENDFORM.                    " HEADER
    *&      Form  E03_EVENTTAB_BUILD
    FORM E03_EVENTTAB_BUILD USING    E03_LT_EVENTS TYPE  SLIS_T_EVENT.
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                I_LIST_TYPE = 3
           IMPORTING
                ET_EVENTS   = E03_LT_EVENTS.
      READ TABLE E03_LT_EVENTS
      WITH KEY NAME = SLIS_EV_TOP_OF_PAGE INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE 'TOP_OF_PAGE' TO LS_EVENT-FORM.
        APPEND LS_EVENT TO E03_LT_EVENTS.
      ENDIF.
      DELETE E03_LT_EVENTS WHERE FORM IS INITIAL.
    ENDFORM.                    " E03_EVENTTAB_BUILD
    *&      Form  COMMENT_BUILD
    FORM COMMENT_BUILD USING LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
      DATA: W_HEADING TYPE SLIS_LISTHEADER.
      DATA: W_HEADING1 TYPE SLIS_LISTHEADER.
      CLEAR   : W_HEADING, LT_TOP_OF_PAGE.
      REFRESH : LT_TOP_OF_PAGE.
      W_HEADING-INFO = 'Synopsys World' .
      W_HEADING-TYP = 'H'.
      APPEND  W_HEADING  TO LT_TOP_OF_PAGE .
      CLEAR  W_HEADING  .
    ENDFORM.                    " COMMENT_BUILD
    end of header portion.
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN '&IC1'.
          IF RS_SELFIELD-FIELDNAME = 'VBELN'.
            PERFORM GETDATA_FROM_VBAP.
            PERFORM BUILD_FIELDCATLOG_IT_VBAP.
            PERFORM BUILD_LAYOUT.
            PERFORM E03_EVENTTAB_BUILD USING EVENTCAT[].
            PERFORM COMMENT_BUILD USING HEADING[].
            PERFORM GRID_DISPLAY1.
          ENDIF.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  GETDATA_FROM_VBAP
          text
    -->  p1        text
    <--  p2        text
    FORM GETDATA_FROM_VBAP.
      DATA: LD_COLOR(1) TYPE C.
      SELECT VBELN
             MATNR
             ERZET
             POSNR
         FROM VBAP
         INTO TABLE IT_VBAP
         FOR ALL ENTRIES IN IT_VBAK
      WHERE VBELN = IT_VBAK-VBELN.
      LOOP AT IT_VBAP .
        LD_COLOR = LD_COLOR + 1.
        IF LD_COLOR = 8.
          LD_COLOR = 1.
        ENDIF.
        CONCATENATE 'C' LD_COLOR '10' INTO IT_VBAP-LINE_COLOR.
        MODIFY IT_VBAP  TRANSPORTING LINE_COLOR.
      ENDLOOP.
    ENDFORM.                    " GETDATA_FROM_VBAP
    *&      Form  BUILD_FIELDCATLOG_IT_VBAP
          text
    -->  p1        text
    <--  p2        text
    FORM BUILD_FIELDCATLOG_IT_VBAP.
      CLEAR FIELDCATALOG.
      REFRESH : FIELDCATALOG[].
      FIELDCATALOG-FIELDNAME   = 'VBELN'.
      FIELDCATALOG-SELTEXT_M   = 'SALES DOC NO'.
      FIELDCATALOG-COL_POS     = 0.
      FIELDCATALOG-OUTPUTLEN   = 10.
      FIELDCATALOG-EMPHASIZE   = 'X'.
      FIELDCATALOG-KEY         = 'X'.
      APPEND FIELDCATALOG TO FIELDCATALOG.
      CLEAR  FIELDCATALOG.
      FIELDCATALOG-FIELDNAME   = 'POSNR'.
      FIELDCATALOG-SELTEXT_M   = 'PO Item'.
      FIELDCATALOG-COL_POS     = 1.
      APPEND FIELDCATALOG TO FIELDCATALOG.
      CLEAR  FIELDCATALOG.
      FIELDCATALOG-FIELDNAME   = 'MATNR'.
      FIELDCATALOG-SELTEXT_M   = 'MAT NO'.
      FIELDCATALOG-COL_POS     = 2.
      APPEND FIELDCATALOG TO FIELDCATALOG.
      CLEAR  FIELDCATALOG.
      FIELDCATALOG-FIELDNAME   = 'ERZET'.
      FIELDCATALOG-SELTEXT_M   = 'TIME'.
      FIELDCATALOG-COL_POS     = 3.
      APPEND FIELDCATALOG TO FIELDCATALOG.
      CLEAR  FIELDCATALOG.
    ENDFORM.                    " BUILD_FIELDCATLOG_IT_VBAP
    *&      Form  GRID_DISPLAY1
          text
    -->  p1        text
    <--  p2        text
    FORM GRID_DISPLAY1.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM     = GD_REPID
                I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
                IS_LAYOUT              = GD_LAYOUT
                IT_FIELDCAT            = FIELDCATALOG[]
                I_SAVE                 = 'A'
                IT_EVENTS              = EVENTCAT[]
           TABLES
                T_OUTTAB               = IT_VBAP
           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.                    " GRID_DISPLAY1
    *&      Form  BUILD_LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM BUILD_LAYOUT.
      GD_LAYOUT-NO_INPUT          = 'X'.
      GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
      GD_LAYOUT-TOTALS_TEXT       = 'Totals'(201).
      GD_LAYOUT-INFO_FIELDNAME =      'LINE_COLOR'.
    ENDFORM.                    " BUILD_LAYOUT

    In ur report,
    in the rountine <b>GRID_DISPLAY1</b>.
    <b> GD_REPID = SY-REPID.</b>
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM     = GD_REPID
                I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
                IS_LAYOUT              = GD_LAYOUT
                IT_FIELDCAT            = FIELDCATALOG[]
                I_SAVE                 = 'A'
                IT_EVENTS              = EVENTCAT[]
           TABLES
                T_OUTTAB               = IT_VBAP
           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.

  • Display page numbers in alv display

    Hai all,
    I am using fm REUSE_ALV_HIERSEQ_LIST_DISPLAY for the alv display.
    I am also passing the 'top_of_page' subroutine to the event table.
    The requirement is , I need to display the page number in the top of page.
    ex header format is as below:
    company name : abcd.                                       date : xx.yy.zzzz.
    page number: 1
    in the next page that is when user scrolls down,
    the output should be,
    company name : abcd.                                       date : xx.yy.zzzz.
    page number: 2
    in the top of page subroutine I am passing sy-pageno.
    When I executed this, the page number is always showing '1' when I am usinng page down button.
    But when  take the printout, it is coming fine.
    is it possibel to increment the page number, for every pagedown button hit?
    Thanks & Regards,
    Bhaskar

    Hai Gopal,
    Thank you for the response.
    The top-of-page is trigegring only once & it sill display page no 1 always, even after using sy-cpage.
    any idea why is this happening?
    Regards,
    Bhaskar

Maybe you are looking for