Doubt in alv top of page

hi,
I am trying to pass top of page to my alv report.
DATA : TY_EVENTS TYPE SLIS_ALV_EVENT,
IT_EVENTS TYPE SLIS_T_EVENT.
CLEAR TY_EVENTS.
TY_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
TY_EVENTS-FORM = 'TOP_OF_PAGE'.
APPEND TY_EVENTS TO IT_EVENTS.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
  I_INTERFACE_CHECK              = ' '
  I_BUFFER_ACTIVE                = ' '
   I_CALLBACK_PROGRAM             = v_repid
   I_CALLBACK_PF_STATUS_SET       = 'SET_PF_STATUS'
   I_CALLBACK_USER_COMMAND        = 'USER_COMMAND'
   I_STRUCTURE_NAME               = 'itab'
   IS_LAYOUT                      = s_layout
   IT_FIELDCAT                    = t_fieldcatalog[]
  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                       = 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.
Now i have to write the code for top of page in the perform 'TOP_OF_PAGE'.
My problem is when i double click the 'TOP_OF_PAGE'
in here TY_EVENTS-FORM = 'TOP_OF_PAGE'.
,its not creating a form but insted it is asking
Program text 'TOP_OF_PAGE' does not exist.
Do you want to create the object .
and when i click yes its taking to text elements
I need to get some like this
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
SKIP.
ULINE.
WRITE :/2 ' DATE :', SY-DATUM,
ENDFORM. "TOP_OF_PAGE
waiting for replies
How do i get the form so that i can write the code for my top of page

hi Preeti,
if you click on the 'TOP_OF_PAGE', it will not create a form routine, because, the name of the form is passed as a character text to the function module. So you need to manually write the form routine with the name top_of_page.
Please use the following code; your requirement would be met!!!!
form top_of_page.
  data:
      ls_line type slis_listheader,
      lt_line type table of slis_t_listheader,
      lv_date(10).
  ls_line-typ  = 'H'.
  concatenate sy-datum6(2) sy-datum4(2) sy-datum+0(4)
             into lv_date separated by '/'.
  concatenate 'Date' lv_date into ls_line-info
                        separated by space.
  append ls_line to lt_line.
  call function 'REUSE_ALV_COMMENTARY_WRITE'
  exporting
      it_list_commentary = lt_line.
endform.
Hope this works.
Sajan.

Similar Messages

  • Field in Alv Top-of-page

    How to pass field in Alv Top-of-page
    Edited by: Deepak  Mathrani on Aug 12, 2008 12:40 PM
    <THREAD LOCKED. Please read the [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] to discover why>
    Edited by: Mike Pokraka on Aug 12, 2008 2:58 PM

    Hi
    sample program
    *& Report  ZNNR_ALVSAMPLE
    REPORT  znnr_alvsample NO STANDARD PAGE HEADING.
    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.
    *Start-of-selection.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      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'.        "Display column total
      fieldcatalog-datatype     = 'CURR'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      fieldcatalog-EDIT = 'X'.
      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'(001)  "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_XEVENTS
                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.

  • Alv top of page date chopped

    Hi Experts,
                 In my Alv report top-of-page, i have a date . with name "Open Items As key Date" but i cant see
    full text and if the date is 11.07.2008. its showing 11.07.20. so how to do this.
    Correct answers will be fully rewarded.
    Regards
    Sunita.

    Hi,
    data : lv_bldat(10) type c.
    write p_bldat to lv_bldat.
    pass  lv_bldat inside of p_bldat.
    What about this thread
    ALV Top-Of -Page Display  No respose for this.
    If u got the solution close the THREAD.
    Thanks,
    Durai.V
    Edited by: Durai V on Jul 11, 2008 12:04 PM

  • ALV top of page error

    Hi All,
    I have the same issue as mentioned in the thread
    ALV - Top of Page Error
    Please let me know the solution
    Thanks
    Bala Duvvuri
    Moderator message: please describe the problem in your own thread, do not have people clicking on links first.
    Edited by: Thomas Zloch on Mar 22, 2011 9:59 AM

    Solved by self

  • ALV Top of Page Date format problem?

    Dear All Abapper,
                        I have placed date(12.12.2007) format in ALV Top of Page, but it displayed
                      <u> <b> 20071212</b></u> in this format.
                        Pls, give me the suggestion to reclaim my problem.

    Hi,
    Cjeck the following code:
    V_DATE = 'Run Date:'.
      CONCATENATE  V_DATE SY-DATUM6(2) '.' SY-DATUM4(2) '.' SY-DATUM(4)
       INTO V_DATE .
      REFRESH ITHED.
      CLEAR SHED.
      SHED-TYP  = 'A'.
      SHED-INFO =  V_DATE.
      APPEND SHED TO ITHED.
      CLEAR SHED.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                IT_LIST_COMMENTARY = ITHED.
             I_LOGO             =
             I_END_OF_LIST_GRID =
    ENDFORM.                                                   
    Hope this helps.
    Reward if helpful.
    Regards,
    Sipra

  • ALV- top-of-page: print varaibale in right corner,...

    Hi,
    In ALV (REUSE_ALV_GRID_DISPALY), i've requirement to print shop name at the top right corner of the top-of-page and sy-datum at top left corner.
    How can I print a varaible at top right corner in top-of-page of ALV? and
    how to print page no in ALV top-of-page?
    How can I set portrait format to print the ALV?
    regards,
    Ravi

    pls ignore
    pk
    Edited by: kishan P on Mar 9, 2009 6:01 PM

  • To display posting date in alv top of page area for transaction KOB1

    I want to display posting date given on selection screen of transaction KOB1 to the alv top of page area on final alv output .
    what are the possible solutions ?

    I want to display posting date given on selection screen of transaction KOB1 to the alv top of page area on final alv output .
    what are the possible solutions ?

  • The no of character in alv top of page

    i have to display k:
    Share\MM_SCUBCode_PDAtxt_Upload\OUT-1090000017-200903171823 - LY 2.txt
    in the alv top of page but it is taking k:
    Share\MM_SCUBCode_PDAtxt_Upload\OUT-1090000017-200903171823.
    any idea how to do it
    please check my code
    form top_of_page .
      DATA: wa_header TYPE slis_listheader.
    IF  p_file IS NOT  INITIAL.
      wa_header-typ = 'S'.
      wa_header-key = 'File Path:'.
      wa_header-info = p_file.
      APPEND wa_header TO it_header.
      CLEAR wa_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        it_list_commentary       = it_header.
    ENDIF.

    Hi,
         To overcome this limitation we can use dynamic document, which can be implemented through the class CL_DD_DOCUMENT. As dynamic documents use HTML viewer control so instead of triggering the TOP_OF_PAGE event we should trigger event of HTML TOP_OF_PAGE. 
    First create a subroutine for top of page in HTML format and send that name in I_CALLBACK_HTML_TOP_OF_PAGE parameter of ALV function module. The input parameter for this subroutine will be a variable of class CL_DD_DOCUMENT.   
    *       FORM html_top_of_page                                     *
    FORM html_top_of_page USING top TYPE REF TO cl_dd_document.
      data: l_text(255) type c.
    l_text = 'k:\\Share\MM_SCUBCode_PDAtxt_Upload\OUT-1090000017-200903171823 - LY 2.txt'.
      CALL METHOD top->add_text EXPORTING text = 'Hello world '
                                          sap_style = 'heading' .
      CALL METHOD top->add_gap EXPORTING width = 200.
      CALL METHOD top->add_picture EXPORTING picture_id = 'ENJOYSAP_LOGO'.
      CALL METHOD top->NEW_LINE( ).
      CALL METHOD top->add_text EXPORTING
      text = l_text.
    ENDFORM.
    * Display ALV grid
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
              i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'
              i_callback_program          = g_repid
              i_structure_name            = 'STRUCTURE'
         TABLES
              t_outtab                    = gt_outtab.
    Regards
    Bala Krishna

  • How to write ICONS in ALV TOP of Page

    Hai experts,
    How to ICON in ALV  Top of PAGE
    i want to wrire
    ICON_LED_RED for cancellation Invioce
    ICON_LED_GREEN for  Invioce
    but i pass this values to wa_header-info it comes  @5C@ @5B@
    thanks
    sitaram

    Hi...
       I think this code is help full for u....
    *& Report ZFI_TEST *
    REPORT ZFI_ICON_TEST MESSAGE-ID zz .
    *& TABLES DECLARATION *
    TABLES: vbak.
    *& TYPE POOLS DECLARATION *
    TYPE-POOLS: slis.
    *& INTERNAL TABLE DECLARATION *
    DATA: BEGIN OF itab OCCURS 0,
    icon TYPE icon-id, "itab-icon = '@08@' -> Green ; '@09@' -> Yellow ; '@0A@' -> Red
    vbeln LIKE vbak-vbeln,
    audat LIKE vbak-audat,
    vbtyp LIKE vbak-vbtyp,
    auart LIKE vbak-auart,
    augru LIKE vbak-augru,
    netwr LIKE vbak-netwr,
    waerk LIKE vbak-waerk,
    END OF itab.
    *INTERNAL TABLE FOR FIELD CATALOG
    DATA: wa_fieldcat TYPE slis_fieldcat_alv,
    it_fieldcat TYPE slis_t_fieldcat_alv.
    IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV
    WITH HEADER LINE,
    *INTERNAL TABLE FOR EVENTS
    DATA: it_event TYPE slis_t_event,
    wa_event TYPE slis_alv_event,
    *INTERNAL TABLE FOR SORTING
    it_sort TYPE slis_t_sortinfo_alv,
    wa_sort TYPE slis_sortinfo_alv,
    *INTERNAL TABLE FOR LAYOUT
    wa_layout TYPE slis_layout_alv.
    *& VARIABLE DECLARATION *
    DATA : v_repid TYPE sy-repid,
    v_pagno(4) TYPE n,
    v_date(8) TYPE c.
    *& CONSTANTS *
    CONSTANTS: c_x TYPE c VALUE 'X'.
    *& SELECTION SCREEN *
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,
    s_vbtyp FOR vbak-vbtyp DEFAULT 'C'.
    SELECTION-SCREEN: END OF BLOCK b1.
    SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN : BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) text-003.
    PARAMETERS: p_list RADIOBUTTON GROUP rad1 DEFAULT 'X'.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN : BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) text-004.
    PARAMETERS: p_grid RADIOBUTTON GROUP rad1.
    SELECTION-SCREEN : END OF LINE.
    SELECTION-SCREEN: END OF BLOCK b2.
    AT SELECTION-SCREEN.
    PERFORM validate_screen.
    *& START OF SELECTION *
    START-OF-SELECTION.
    CLEAR: itab, itab[].
    V_REPID = SY-REPID.
    PERFORM get_data.
    PERFORM display_data.
    *& END OF SELECTION *
    END-OF-SELECTION.
    *--DO ALV Process
    v_repid = sy-repid.
    *--Sort the Output Fields
    PERFORM sort_fields.
    *--Build Field catalog for the Output fields
    PERFORM BUILD_FIELDCAT.
    *--Set the Layout for ALV
    PERFORM set_layout.
    *& Form GET_DATA
    text
    TO GET THE DATA FROM TABLES INTO ITAB
    FORM get_data .
    SELECT vbeln
    audat
    vbtyp
    auart
    augru
    netwr
    waerk
    INTO CORRESPONDING FIELDS OF TABLE itab
    FROM vbak
    WHERE vbeln IN s_vbeln AND
    audat > '04.04.2005'
    AND netwr > 0.
    LOOP AT itab.
    IF itab-netwr < 10000.
    itab-icon = '@08@'.
    ELSEIF itab-netwr > 10000 AND itab-netwr < 100000.
    itab-icon = '@09@'.
    ELSEIF itab-netwr > 100000.
    itab-icon = '@0A@'.
    ENDIF.
    MODIFY itab INDEX sy-tabix.
    ENDLOOP.
    ENDFORM. " GET_DATA
    *& Form sort_fields
    FORM sort_fields .
    CLEAR wa_sort.
    wa_sort-fieldname = 'VBTYP'.
    wa_sort-spos = '1'.
    wa_sort-up = 'X'.
    APPEND wa_sort TO it_sort.
    CLEAR wa_sort.
    wa_sort-fieldname = 'NETWR'.
    wa_sort-spos = '2'.
    wa_sort-up = 'X'.
    wa_sort-subtot = 'X'.
    APPEND wa_sort TO it_sort.
    ENDFORM. " sort_fields
    *& Form set_layout
    FORM set_layout .
    IF p_list = c_x .
    wa_layout-window_titlebar = 'LIST DISPLAY'(016).
    wa_layout-zebra = 'X'.
                    +
                    +
    ALV LIST DISPLAY
    PERFORM list_display TABLES itab.
              o
                    +
                    + ALV GRID DISPLAY
    ELSEIF p_grid = c_x.
    wa_layout-window_titlebar = 'GRID DISPLAY'(017).
    wa_layout-zebra = 'X'.
    PERFORM grid_display TABLES itab.
    ENDIF.
    ENDFORM. " set_layout
    *& Form list_display
    FORM list_display TABLES p_itab .
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = v_repid
    is_layout = wa_layout
    it_fieldcat = it_fieldcat[]
    it_sort = it_sort[]
    i_save = 'U'
    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.
    ENDFORM. " list_display
    *& Form GRID_DISPLAY
    FORM grid_display TABLES p_itab .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = v_repid
    is_layout = wa_layout
    it_fieldcat = it_fieldcat[]
    it_sort = it_sort[]
    it_events = it_event
    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.
    ENDFORM. " GRID_DISPLAY
    *& Form VALIDATE_SCREEN
    text
    --> p1 text
    <-- p2 text
    FORM validate_screen .
    DATA: lv_vbeln LIKE vbak-vbeln.
    IF NOT s_vbeln IS INITIAL.
    SELECT vbeln
    INTO lv_vbeln
    UP TO 1 ROWS
    FROM vbak
    WHERE vbeln IN s_vbeln.
    ENDSELECT.
    IF sy-subrc <> 0.
    MESSAGE e000 WITH 'INVALID SALES DOC'.
    ENDIF.
    ENDIF.
    ENDFORM. " VALIDATE_SCREEN
    *& Form display_data
    text
    --> p1 text
    <-- p2 text
    FORM display_data .
    DEFINE m_fieldcat.
    add 1 to wa_fieldcat-col_pos.
    wa_fieldcat-fieldname = &1.
    wa_fieldcat-ref_tabname = 'VBAK'.
    wa_fieldcat-do_sum = &2.
    wa_fieldcat-cfieldname = &3.
    append wa_fieldcat to it_fieldcat.
    END-OF-DEFINITION.
    DATA:
    ls_fieldcat TYPE slis_fieldcat_alv,
    lt_fieldcat TYPE slis_t_fieldcat_alv.
    m_fieldcat 'ICON' '' ''.
    m_fieldcat 'VBELN' '' ''.
    m_fieldcat 'AUDAT' '' ''.
    m_fieldcat 'VBTYP' '' ''.
    m_fieldcat 'AUART' '' ''.
    m_fieldcat 'AUGRU' '' ''.
    m_fieldcat 'NETWR' 'C' 'WAERK'.
    m_fieldcat 'WAERK' '' ''.
    ENDFORM. " display_data[/code]
    Regards,
    Rahul
    Edited by: Rahul Reddy on Apr 14, 2008 12:33 PM

  • Pdf file in ALV  TOP OF PAGE

    Hi,
      Could any one tell how to use cl_gui_dialogbox_container  to display pdf in a ALV top of page

    Hi,
    It is not possible to change the color in ALV top of page.
    Thanks,
    Sriram Ponna.

  • Change color in ALV top of page

    Hi all,
    Can anyone tell me how (if it is possible) to change color in ALV top-of-page?
    Thank you in advance,
    Hagit

    Hi,
    It is not possible to change the color in ALV top of page.
    Thanks,
    Sriram Ponna.

  • Alv-top-of-page

    Hi all,
    In my alv report,when Iam executing top of page is shown only once,but when Iam checking print preview it being dispalyed twice,when Iam comming back to normal view it is shown 4 times.
    why Iam getting this type of error.can any one tell me what may be wrong.
    regards.

    hi,
    think you are not refreshing the data
    try to clear all the work areas and refresh all internal tables
    shiva

  • ALV Top of Page is not displaying

    Hi,
    in this program TOP OF PAGE is displaying as empty
    * Tables
    TABLES:/irm/ipsipart.
    * Type pools
    TYPE-POOLS slis.
    * Types
    TYPES:BEGIN OF typ_ipsipart,
          depcode  TYPE /irm/ip_depcode,
          partid   TYPE /irm/ip_ktonr,
          endda    TYPE /irm/ip_pedat,
          begda    TYPE /irm/ip_pbdat,
          END OF typ_ipsipart.
    TYPES:BEGIN OF typ_pa0000,
          pernr    TYPE persno,
          endda    TYPE endda,
          begda    TYPE begda,
          massn    TYPE massn,
          massg    TYPE massg,
          stat2    TYPE stat2,
          partid   TYPE /irm/ip_ktonr,
          END OF typ_pa0000.
    TYPES:BEGIN OF typ_pa0001,
          pernr    TYPE persno,
          endda    TYPE endda,
          ename    TYPE ename,
          END OF typ_pa0001.
    TYPES:BEGIN OF typ_pernr,
          pernr    TYPE persno,
          END OF typ_pernr.
    TYPES:BEGIN OF typ_a942,
          zzpersnr TYPE persno,
          END OF typ_a942.
    TYPES:BEGIN OF typ_a943,
          zzpersnr TYPE persno,
          END OF typ_a943.
    TYPES:BEGIN OF typ_a976,
          zzpersnr TYPE persno,
          END OF typ_a976.
    TYPES:BEGIN OF typ_final,
          pernr    TYPE persno,
          ename    TYPE ename,
          begda    TYPE begda,
          statx(9) TYPE c,
          mgtxt    TYPE mgtxt,
          depcode  TYPE /irm/ip_depcode,
          begda_c  TYPE /irm/ip_pbdat,
          endda_c  TYPE /irm/ip_pedat,
          END OF typ_final.
    TYPES:BEGIN OF typ_t530t,
          massn    TYPE massn,
          massg    TYPE massg,
          mgtxt    TYPE mgtxt,
          END OF typ_t530t.
    * Internal Tables
    DATA:it_a942     TYPE TABLE OF typ_a942,
         it_a943     TYPE TABLE OF typ_a943,
         it_a976     TYPE TABLE OF typ_a976,
         it_pernr    TYPE TABLE OF typ_pernr,
         it_pa0000   TYPE TABLE OF typ_pa0000,
         it_pa0001   TYPE TABLE OF typ_pa0001,
         it_ipsipart TYPE TABLE OF typ_ipsipart,
         it_final    TYPE TABLE OF typ_final,
         it_t530t    TYPE TABLE OF typ_t530t.
    * Work areas
    DATA:wa_a942     TYPE typ_a942,
         wa_a943     TYPE typ_a943,
         wa_a976     TYPE typ_a976,
         wa_pernr    TYPE typ_pernr,
         wa_pa0000   TYPE typ_pa0000,
         wa_pa0001   TYPE typ_pa0001,
         wa_ipsipart TYPE typ_ipsipart,
         wa_final    TYPE typ_final,
         wa_t530t    TYPE typ_t530t.
    * Constants
    CONSTANTS:c_stat2 TYPE stat2 VALUE '0',
              c_statx(9) TYPE c  VALUE 'Withdrawn',
              c_endda TYPE endda VALUE '99991231',
              c_ptype TYPE /irm/ip_patype VALUE 'PE',
              c_kappl TYPE kappl VALUE 'V',
              c_ysam  TYPE kschl VALUE 'YSAM',
              c_ysdm  TYPE kschl VALUE 'YSDM',
              c_yssm  TYPE kschl VALUE 'YSSM',
              c_ysse  TYPE kschl VALUE 'YSSE',
              c_sprsl TYPE spras VALUE 'E'.
    * Variables
    DATA:v_begda TYPE begda,
         v_endda TYPE endda.
    DATA:v_variant   LIKE disvariant,
         v_save(1)   TYPE c,
         v_repid TYPE sy-repid.
    * ALV Declaraion Part
    * FIELD CATALOG DECLARATION                                        *****
    DATA:it_fcat TYPE slis_t_fieldcat_alv,
         wa_fcat TYPE slis_fieldcat_alv.
    * ALV SORT INFORMATION                                             *****
    DATA:wa_sort TYPE slis_sortinfo_alv,
         it_sort TYPE slis_t_sortinfo_alv.
    *ALV LAYOUT INFORMATION                                            *****
    DATA:wa_layout TYPE slis_layout_alv.
    *ALV TOOLBAR EXCLUDING                                             *****
    DATA:it_excluding TYPE slis_t_extab,
         wa_excluding TYPE slis_extab.
    * Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:s_pernr  FOR /irm/ipsipart-partid,
                   s_date   FOR /irm/ipsipart-begda OBLIGATORY NO-EXTENSION,
                   s_depcod FOR /irm/ipsipart-depcode.
    SELECTION-SCREEN END OF BLOCK b1.
    * At Selection Screen
    AT SELECTION-SCREEN.
      IF NOT s_date-low IS INITIAL AND s_date-high IS NOT INITIAL.
        READ TABLE s_date INDEX 1.
        v_begda = s_date-low.
        v_endda = s_date-high.
      ENDIF.
      IF s_date-low IS INITIAL AND s_date-high IS NOT INITIAL.
        READ TABLE s_date INDEX 1.
        v_begda = s_date-high.
        v_endda = s_date-high.
      ENDIF.
      IF s_date-low IS NOT INITIAL AND s_date-high IS INITIAL.
        READ TABLE s_date INDEX 1.
        v_begda = s_date-low.
        v_endda = s_date-low.
      ENDIF.
    * Start of selection
    START-OF-SELECTION.
      break vkreddy1x.
      PERFORM get_data.
      PERFORM move_data_to_finalitab.
      IF NOT it_final[] IS INITIAL.
        PERFORM field_catalog TABLES it_final
                              USING it_fcat[]
                                    wa_fcat.
        PERFORM alv_sort_info USING it_sort[]
                                    wa_sort.
        PERFORM alv_layout_build USING wa_layout.
        PERFORM alv_toolbar_excluding USING it_excluding[]
                                            wa_excluding.
        PERFORM load-variant     USING v_variant v_repid v_save.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program     = v_repid
            i_callback_top_of_page = 'TOP_OF_PAGE'
            is_layout              = wa_layout
            it_fieldcat            = it_fcat
            it_excluding           = it_excluding
            it_sort                = it_sort
            i_save                 = v_save
            is_variant             = v_variant
          TABLES
            t_outtab               = it_final
          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.
      ELSE.
        PERFORM info_msg.
      ENDIF.
    *&      Form  GET_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM get_data .
      SELECT zzpersnr FROM a942 INTO TABLE it_a942 WHERE kappl  = c_kappl
                                                   AND   kschl  = c_ysdm
                                                   AND   datbi >= v_begda
                                                   AND   datab <= v_endda.
      IF sy-subrc EQ 0.
        SORT it_a942 BY zzpersnr.
        DELETE ADJACENT DUPLICATES FROM it_a942 COMPARING zzpersnr.
        LOOP AT it_a942 INTO wa_a942.
          MOVE wa_a942-zzpersnr TO wa_pernr-pernr.
          APPEND wa_pernr TO it_pernr.
          CLEAR:wa_pernr,wa_a942.
        ENDLOOP.
      ENDIF.
      SELECT zzpersnr FROM a943 INTO TABLE it_a943 WHERE kappl  = c_kappl
                                                   AND  ( kschl = c_ysam
                                                       OR kschl = c_ysse )
                                                   AND   datbi >= v_begda
                                                   AND   datab <= v_endda.
      IF sy-subrc EQ 0.
        SORT it_a943 BY zzpersnr.
        DELETE ADJACENT DUPLICATES FROM it_a943 COMPARING zzpersnr.
        LOOP AT it_a943 INTO wa_a943.
          MOVE wa_a943-zzpersnr TO wa_pernr-pernr.
          APPEND wa_pernr TO it_pernr.
          CLEAR:wa_pernr,wa_a943.
        ENDLOOP.
      ENDIF.
      SELECT zzpersnr FROM a976 INTO TABLE it_a976 WHERE kappl  = c_kappl
                                                   AND   kschl  = c_yssm
                                                   AND   datbi >= v_begda
                                                   AND   datab <= v_endda.
      IF sy-subrc EQ 0.
        SORT it_a976 BY zzpersnr.
        DELETE ADJACENT DUPLICATES FROM it_a976 COMPARING zzpersnr.
        LOOP AT it_a976 INTO wa_a976.
          MOVE wa_a976-zzpersnr TO wa_pernr-pernr.
          APPEND wa_pernr TO it_pernr.
          CLEAR:wa_pernr,wa_a976.
        ENDLOOP.
      ENDIF.
      SORT it_pernr BY pernr.
      DELETE ADJACENT DUPLICATES FROM it_pernr COMPARING pernr.
      IF NOT it_pernr[] IS INITIAL.
        SELECT pernr endda begda massn massg stat2 FROM pa0000
                                                   INTO TABLE it_pa0000
                                                   FOR ALL ENTRIES IN it_pernr
                                                   WHERE pernr = it_pernr-pernr
                                                   AND endda >= v_begda
                                                   AND begda <= v_endda
                                                   AND stat2 = c_stat2.
      ENDIF.
      LOOP AT it_pa0000 INTO wa_pa0000.
        wa_pa0000-partid = wa_pa0000-pernr.
        MODIFY TABLE it_pa0000 FROM wa_pa0000 .
      ENDLOOP.
      IF NOT it_pa0000[] IS INITIAL.
        SELECT depcode partid endda begda FROM /irm/ipsipart
                                INTO CORRESPONDING FIELDS OF TABLE it_ipsipart
                                FOR ALL ENTRIES IN it_pa0000
                                WHERE nrart = c_ptype
                                           AND partid = it_pa0000-partid
                                           AND endda >= it_pa0000-begda
                                           AND begda <= it_pa0000-endda.
        SELECT pernr ename FROM pa0001 INTO TABLE it_pa0001
                                       FOR ALL ENTRIES IN it_pa0000
                                       WHERE pernr = it_pa0000-pernr
                                       AND endda   = c_endda.
        SELECT mgtxt FROM t530t INTO TABLE it_t530t
                                FOR ALL ENTRIES IN it_pa0000
                                WHERE sprsl = c_sprsl
                                AND massn = it_pa0000-massn
                                AND massg   = it_pa0000-massg.
      ENDIF.
    ENDFORM.                    " GET_DATA
    *&      Form  MOVE_DATA_TO_ITAB
    FORM move_data_to_finalitab .
      LOOP AT it_pa0000 INTO wa_pa0000.
        MOVE wa_pa0000-pernr TO wa_final-pernr.
        MOVE wa_pa0000-begda TO wa_final-begda.
        IF wa_pa0000-stat2 = c_stat2.
          MOVE c_statx TO wa_final-statx.
        ENDIF.
        READ TABLE it_pa0001 INTO wa_pa0001 WITH KEY pernr = wa_pa0000-pernr.
        IF sy-subrc EQ 0.
          MOVE wa_pa0001-ename TO wa_final-ename.
        ENDIF.
        READ TABLE it_t530t INTO wa_t530t WITH KEY massn = wa_pa0000-massn
                                                   massg = wa_pa0000-massg.
        IF sy-subrc EQ 0.
          MOVE wa_t530t-mgtxt TO wa_final-mgtxt.
        ENDIF.
        READ TABLE it_ipsipart INTO wa_ipsipart WITH KEY
                                                   partid = wa_pa0000-partid.
        IF sy-subrc EQ 0.
          MOVE wa_ipsipart-depcode TO wa_final-depcode.
          MOVE wa_ipsipart-begda TO wa_final-begda_c.
          MOVE wa_ipsipart-endda TO wa_final-endda_c.
        ENDIF.
        APPEND wa_ipsipart TO it_ipsipart.
        CLEAR wa_ipsipart.
      ENDLOOP.
    ENDFORM.                    " MOVE_DATA_TO_ITAB
    *&      Form  FIELD_CATALOG
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM field_catalog TABLES p_it_final  LIKE it_final
                       USING  p_it_fcat   TYPE slis_t_fieldcat_alv
                              p_wa_fcat   TYPE slis_fieldcat_alv.
      CLEAR p_wa_fcat.
      p_wa_fcat-col_pos   = '1'.
      p_wa_fcat-tabname   = p_it_final.
      p_wa_fcat-fieldname = 'PERNR'.
      p_wa_fcat-key       = 'X'.
      p_wa_fcat-seltext_l = 'Personnel Number'.
      p_wa_fcat-seltext_m = 'Personnel No.'.
      p_wa_fcat-seltext_s = 'Pers.No.'.
      APPEND p_wa_fcat TO p_it_fcat.
      CLEAR p_wa_fcat.
      p_wa_fcat-col_pos   = '2'.
      p_wa_fcat-tabname   = p_it_final.
      p_wa_fcat-fieldname = 'ENAME'.
      p_wa_fcat-key       = 'X'.
      p_wa_fcat-seltext_l = 'Employee Name'.
      p_wa_fcat-seltext_m = 'Emp Name'.
      p_wa_fcat-seltext_s = 'Name'.
      APPEND p_wa_fcat TO p_it_fcat.
      CLEAR p_wa_fcat.
      p_wa_fcat-col_pos   = '3'.
      p_wa_fcat-tabname   = p_it_final.
      p_wa_fcat-fieldname = 'BEGDA'.
      p_wa_fcat-key       = ' '.
      p_wa_fcat-seltext_l = 'Termination start date'.
      p_wa_fcat-seltext_m = 'Term start date'.
      p_wa_fcat-seltext_s = 'Term start date'.
      APPEND p_wa_fcat TO p_it_fcat.
      CLEAR p_wa_fcat.
      p_wa_fcat-col_pos   = '4'.
      p_wa_fcat-tabname   = p_it_final.
      p_wa_fcat-fieldname = 'MGTXT'.
      p_wa_fcat-seltext_l = 'Reason f.action text'.
      p_wa_fcat-seltext_m = 'Reason for action'.
      p_wa_fcat-seltext_s = 'Act.reason'.
      APPEND p_wa_fcat TO p_it_fcat.
      CLEAR p_wa_fcat.
      p_wa_fcat-col_pos   = '5'.
      p_wa_fcat-tabname   = p_it_final.
      p_wa_fcat-fieldname = 'STATX'.
      p_wa_fcat-seltext_l = 'Employment status text'.
      p_wa_fcat-seltext_m = 'Employment status'.
      p_wa_fcat-seltext_s = 'Employment status'.
      APPEND p_wa_fcat TO p_it_fcat.
      CLEAR p_wa_fcat.
      p_wa_fcat-col_pos   = '6'.
      p_wa_fcat-tabname   = p_it_final.
      p_wa_fcat-fieldname = 'DEPCODE'.
      p_wa_fcat-seltext_l = 'Deployment Code'.
      p_wa_fcat-seltext_m = 'Deployment Code'.
      p_wa_fcat-seltext_s = 'Dep. Code'.
      APPEND p_wa_fcat TO p_it_fcat.
      CLEAR p_wa_fcat.
      p_wa_fcat-col_pos   = '7'.
      p_wa_fcat-tabname   = p_it_final.
      p_wa_fcat-fieldname = 'BEGDA_C'.
      p_wa_fcat-seltext_l = 'Participation Start Date'.
      p_wa_fcat-seltext_m = 'Participation Start'.
      p_wa_fcat-seltext_s = 'Start Date'.
      APPEND p_wa_fcat TO p_it_fcat.
      CLEAR p_wa_fcat.
      p_wa_fcat-col_pos   = '8'.
      p_wa_fcat-tabname   = p_it_final.
      p_wa_fcat-fieldname = 'ENDDA_C'.
      p_wa_fcat-seltext_l = 'Participation End Date'.
      p_wa_fcat-seltext_m = 'Participation End'.
      p_wa_fcat-seltext_s = 'End Date'.
      APPEND p_wa_fcat TO p_it_fcat.
    ENDFORM.                    " FIELD_CATALOG
    *&      Form  ALV_SORT_INFO
    *       text
    *      -->P_IT_SORT[]  text
    *      -->P_WA_SORT  text
    FORM alv_sort_info  USING   p_it_sort TYPE slis_t_sortinfo_alv
                                p_wa_sort TYPE slis_sortinfo_alv .
      p_wa_sort-fieldname = 'PERNR'.
      p_wa_sort-up = 'X'.
      APPEND p_wa_sort TO p_it_sort.
    ENDFORM.                    " ALV_SORT_INFO
    *&      Form  ALV_LAYOUT_BUILD
    FORM alv_layout_build  CHANGING p_wa_layout TYPE slis_layout_alv.
      p_wa_layout-no_input          = 'X'.
      p_wa_layout-colwidth_optimize = 'X'.
    ENDFORM.                    " ALV_LAYOUT_BUILD
    *&      Form  ALV_TOOLBAR_EXCLUDING
    *       text
    FORM alv_toolbar_excluding  USING   p_it_excluding TYPE slis_t_extab
                                        p_wa_excluding TYPE slis_extab.
      p_wa_excluding-fcode = '&GRAPH'.
      APPEND p_wa_excluding TO p_it_excluding.
      p_wa_excluding-fcode = '&ABC'.
      APPEND p_wa_excluding TO p_it_excluding.
      p_wa_excluding-fcode = '%SL'.
      APPEND p_wa_excluding TO p_it_excluding.
    ENDFORM.                    " ALV_TOOLBAR_EXCLUDING
    *&      Form  LOAD-VARIANT
    FORM load-variant  USING    p_v_variant STRUCTURE disvariant
                                p_v_repid
                                p_v_save.
      CLEAR p_v_variant.
      p_v_variant-report = p_v_repid.
      p_v_save = 'A'.
    ENDFORM.                    " LOAD-VARIANT
    *&      Form  info_msg
    *       text
    FORM info_msg .
      MESSAGE i016(rp) WITH 'No Data Selected for the Selection Criteria'.
    ENDFORM.                    "info_msg
    *&      Form  top_of_page
    *       text
    FORM top_of_page.
      DATA:it_listhead TYPE slis_t_listheader.
      DATA:wa_listhead TYPE slis_listheader.
      wa_listhead-typ = 'H'.
      wa_listhead-info = 'Withdrawn Employees Still Active on Commission Plan'.
      APPEND wa_listhead TO it_listhead.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = it_listhead.
    ENDFORM.                    "top_of_page

    Hello,
    You try in this way you will get the solution
    data:
        y_i_events     TYPE STANDARD TABLE OF slis_alv_event,
    constants:
    y_k_top_of_page TYPE slis_alv_event-name VALUE 'TOP_OF_PAGE',
    y_k_top_of_form TYPE slis_alv_event-form VALUE 'Y_F_TOP_OF_FORM'.
        PERFORM y_f_build_events CHANGING  y_i_events.
    FORM y_f_build_events  CHANGING y_li_events TYPE STANDARD TABLE.
      DATA :  y_lwa_events   TYPE slis_alv_event.
      y_lwa_events-name = y_k_top_of_page.
      y_lwa_events-form = y_k_top_of_form.
      APPEND y_lwa_events TO y_li_events.
      CLEAR y_lwa_events.
    ENDFORM.                    " y_f_BUILD_EVENTS
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = y_lv_progname
          is_layout          = y_wa_layout
          it_fieldcat        = y_i_fieldcat[]
          it_events          = y_i_events
        TABLES
          t_outtab           = y_i_error
        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 y_f_top_of_form .
    *To display the date in dd mm yyyy formate
      CLEAR y_v_date.
      MOVE: sy-datum TO y_v_date.
      y_wa_header-typ = y_k_h.
      CONCATENATE text-h01 y_v_date+6(2)
                           y_v_date+4(2)
                           y_v_date+0(4)
                           INTO y_wa_header-info
                           SEPARATED BY space.
      APPEND y_wa_header TO y_i_listheader.
      CLEAR y_wa_header.
    *Top of page
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = y_i_listheader[].
      REFRESH y_i_listheader[].
    ENDFORM.                    " y_f_top_of_form
    Try this you we get the top-of-page.

  • ALV top of page - heading depending upon list output

    Hi All,
    My alv grid report shows the report containing vendor account group and some other details.
    My requirement is to get the page break for every new vendor account group and also print the vendor account group description at the top of the list (in header section).
    I have achieved this by using * in sort table for page break and in top of page , I am reading the vendor acct grp desc table to print the header based on index sy-pagno.
    But this solution is only working in print preview mode. If I print the output, actual page breaks are getting applied and I am not getting the desired output as logic using sy-pagno is giving wrong output.
    My question is is there any way to get the current list in the top of page event? So that depending upon the displayed vendor acct grp per page, I will print its description?
    OR is there any other way to achieve this functionality?

    Any suggestions?

  • ALV - Top of Page Trigger for Each New Page

    Hi Abapers,
    I am using the sortinfo_alv to get page break for each customer.Now my client is asking to display the cutomer name in the top of page insted in the main table. how will i do this .
    I am using alv_commentary_write to display the top of page data.
    Awaiting for reply.
    Regards,
    Rahul

    Hi
    Follow the below steps.
    Include the two forms in your program
    Pass event internal table parameter to FM ALV display.
    Declare the ALV parameter in Declaration part.
    DATA: i_events TYPE slis_t_event.            "(IT) for populating events
               g_header TYPE slis_t_listheader,  "Header for alv
           g_events TYPE slis_alv_event,     "Struc for populating events
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         it_events                         = i_events
    *&      Form  EVENTTAB_BUILD
    *    Building Events table For ALV
    *      -->P_T_EVENTS[]  text
    FORM eventtab_build USING p_i_events.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                i_list_type     = 0
           IMPORTING
                et_events       = i_events
           EXCEPTIONS
                list_type_wrong = 1
                OTHERS          = 2.
      CLEAR: g_events.
      READ TABLE i_events INTO g_events
           WITH KEY name = 'TOP_OF_PAGE'. "slis_ev_top_of_page.
      IF sy-subrc = 0.
        MOVE 'TOP_OF_PAGE' TO g_events-form.
        MODIFY i_events FROM g_events INDEX sy-tabix TRANSPORTING form.
        CLEAR g_events.
      ENDIF.
    ENDFORM.                    " EVENTTAB_BUILD
    *&      Form  top_of_page
    *    Header Data Population
    FORM top_of_page.
      DATA: l_htext TYPE slis_listheader,
            l_text(200) TYPE c,
            ld_lines TYPE i,
            ld_linesc(9) TYPE c.
      REFRESH g_header.
    ****************TOP OF PAGE HEADINGS****************************
    * For Headers, Key is not printed and is irrelevant. Will not cause
    * a syntax error, but is not used.
    * TYP:  Indicator: Header
      l_htext-typ = 'H'.     "H = Header,S = selection,a = action
      CONCATENATE 'Planned Order: -' s_plnum-low 'To' s_plnum-high
      INTO l_text SEPARATED BY space.
    * INFO: Information
      l_htext-info = l_text.
      APPEND l_htext TO g_header.
    * FM for dispalying text at Top of Page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                it_list_commentary = g_header
                i_logo =
                   'ENJOYSAP_LOGO'. " From transaction "OAOR"
    *     I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE

Maybe you are looking for