How to give colors to the top-of-page in ALV List Display

how to give colors to the top-of-page in ALV List Display....

Check this blog.........
It provides your required output...........
/people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid
See the point 7 for complete code...
Regards,
Pavan

Similar Messages

  • How to give colors to the top-of-page in ALV Grid

    How to give colors to the top-of-page in ALV Grid
    in table GT_LIST_TOP_OF_PAGE i am filling 3 rows ,i need 3 different colors to be displyed on top-of-page(one color to one row)
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    I_LOGO = 'ENJOYSAP_LOGO'
    IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
    please help mee

    HI Kranthi,
    Check out teh foll. link,
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    Hope this helps.

  • How to gve the colors to the TOP-OF-PAGE in ALV Grid Disply..

    i want to give 3 different colors in the top-of-page(there are three different lines each line should disply in different colors)...
      plaese tell me how can i do that...........

    Hi
    Try like this...
    form build_events.
      clear   gv_event.
      refresh i_events.
    Get the ALV events
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        exporting
          i_list_type     = 0
        importing
          et_events       = i_events
        exceptions
          list_type_wrong = 1
          others          = 2.
      if sy-subrc = 0.
        sort i_events by name.
      endif.
    Form for Top-of-Page ---------------------------------*
      read table i_events with key name = slis_ev_top_of_page
                                          into gv_event
                                          binary search.
      if sy-subrc = 0.
        move gc_top_of_page to gv_event-form.
        modify i_events from gv_event index sy-tabix.
      endif.
    Form for End-of-List ---------------------------------*
      read table i_events with key name = slis_ev_end_of_list
                                          into gv_event
                                          binary search.
      if sy-subrc = 0.
        move gc_end_of_list to gv_event-form.
        modify i_events from gv_event index sy-tabix.
      endif.
    Specify the ALV layout
      wa_layout-max_linesize = gv_linsz.
      wa_layout-min_linesize = gv_linsz.
    endform.                    " build_events
    form top_of_page_d.                                        
      format color col_heading.
      write: / 'Satyanarayana'
      format color col_total.
      write: / 'Sayana'.
      format reset.
    endform.
    Satya.

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

  • How i can show the selection screen input field in the top of page in alv

    hi ,
              how i can show the selection screen input field in the top of page in alv  grid output.
    tell me the process

    Hi,
    excample from my program:
    FORM topof_page.
      DATA: l_it_header   TYPE TABLE OF slis_listheader WITH HEADER LINE,
            l_info        LIKE l_it_header-info.
      DATA: l_it_textpool TYPE TABLE OF textpool WITH HEADER LINE.
      DATA: l_key LIKE l_it_textpool-key.
      READ TEXTPOOL c_repid INTO l_it_textpool LANGUAGE sy-langu.
      DEFINE m_selinfo.
        if not &1 is initial.
          clear l_it_header.
          l_it_header-typ   = 'S'.
          l_key = '&1'.
          translate l_key to upper case.
          read table l_it_textpool with key key = l_key.
          if sy-subrc = 0.
            shift l_it_textpool-entry left deleting leading space.
            l_it_header-key = l_it_textpool-entry  .
          endif.
          loop at &1.
            case &1-option.
              when 'EQ'
                or 'BT'
                or 'CP'.
                write &1-low to l_it_header-info.
              when others.
                write &1-low to l_it_header-info.
                concatenate &1-option
                            l_it_header-info
                       into l_it_header-info
                       separated by space.
            endcase.
            if not &1-high is initial.
              write &1-high to l_info left-justified.
              concatenate l_it_header-info
                          l_info
                     into l_it_header-info
                     separated by space.
            endif.
            if &1-sign = 'E'.
              concatenate ']'
                          l_it_header-info
                     into l_it_header-info.
            endif.
            append l_it_header.
            clear: l_it_header-key,
                   l_it_header-info.
          endloop.
        endif.
      END-OF-DEFINITION.
      m_selinfo: s_trmdat,
                 s_trmext,
                 s_trmint,
                 s_fkdat,
                 s_delno,
                 s_vbeln,
                 s_deact,
                 s_kdmat.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                it_list_commentary = l_it_header[].
    ENDFORM.
    I hope, this will help you.
    Regards
    Nicole

  • Top of page in ALV GRID display

    Hi All,
    Is it possible to have a top of page in ALV grid display?
    If yes, then how?
    Thanks and Regards,
    Sirisha

    hi
    check out the following code:
    report  z_alv2 line-count 20.
    type-pools : slis.
    type-pools : icon.
    tables:
    lfa1, lfb1, lfm1.
    selection-screen begin of block b1  with frame title text-001.
    select-options:
    s_lifnr for lfa1-lifnr, "VENDOR
    s_bukrs for lfb1-bukrs, "COMPANY CODE
    s_ekorg for lfm1-ekorg, "PURCHASING ORGANIZATION
    s_ktokk for lfa1-ktokk. "ACCOUNT GROUP
    selection-screen end of block b1.
    selection-screen begin of block b2  with frame title text-002.
    parameters: r1 radiobutton group g1,
                r2 radiobutton group g1.
    selection-screen end of block b2.
    data:
          v_repid like sy-repid,
          begin of itab occurs 0,
          lifnr like lfa1-lifnr,
          bukrs like lfb1-bukrs,
          ekorg like lfm1-ekorg,
          ktokk like lfa1-ktokk,
          name1 like lfa1-name1,
          stras like lfa1-stras,
          ort01 like lfa1-ort01,
          regio like lfa1-regio,
          pfort like lfa1-pfort,
          pstlz like lfa1-pstlz,
          pstl2 like lfa1-pstl2,
          telf1 like lfa1-telf1,
          end of itab.
    data : itab_event type slis_t_event,
           wa_event   type slis_alv_event.
    data : itab_fld_cat  type slis_t_fieldcat_alv,
           wa_fldcat     type slis_fieldcat_alv.
    data : wa_layout     type slis_layout_alv.
    start-of-selection.
    *PERFORM GET_VARIANT.
    PERFORM data_validation.
      perform select_data.
      perform get_events using itab_event .
      perform fieldcatmerge.
      if r1 = 'X'.
        perform alvlistdisplay.
      elseif r2 = 'X' .
        perform alvgriddisplay.
      endif.
    *&      Form  DATA_VALIDATION
          text
    -->  p1        text
    <--  p2        text
    form data_validation .
      data: v_count type i.
      if s_lifnr is initial and
         s_bukrs is initial and
         s_ekorg is initial and
         s_ktokk is initial.
        message e000(z13325).
      Enter any value in the Selection Screen
      endif.
      select count(*) from lfa1 where lifnr in s_lifnr.
      if sy-subrc <> 0.
        message e000(z13325).
      Enter any value in the Selection Screen
      endif.
      select count(*) from lfb1 where lifnr in s_bukrs.
      if sy-subrc <> 0.
        message e000(z13325).
      Enter any value in the Selection Screen
      endif.
      select count(*) from lfm1 where lifnr in s_ekorg.
      if sy-subrc <> 0.
        message e000(z13325).
      Enter any value in the Selection Screen
      endif.
      select count(*) from lfa1 where lifnr in s_ktokk.
      if sy-subrc <> 0.
        message e000(z13325).
      Enter any value in the Selection Screen
      endif.
    endform.                    " DATA_VALIDATION
    *&      Form  SELECT_DATA
          text
    -->  p1        text
    <--  p2        text
    form select_data .
      select a~lifnr
             b~bukrs
             c~ekorg
             a~ktokk
             a~name1
             a~stras
             a~ort01
             a~regio
             a~pfort
             a~pstlz
             a~pstl2
             a~telf1
          into corresponding fields of table itab
          from lfa1 as a inner join lfb1 as b
                         on alifnr = blifnr
                         inner join lfm1 as c
                         on alifnr = clifnr
                         where a~lifnr in s_lifnr
                         and b~bukrs in s_bukrs
                         and c~ekorg in s_ekorg
                         and a~ktokk in s_ktokk.
      sort itab by lifnr bukrs ekorg.
    endform.                    " SELECT_DATA
    *&      Form  FIELDCATMERGE
          text
    -->  p1        text
    <--  p2        text
    form fieldcatmerge .
      v_repid = sy-repid.
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
       exporting
         i_program_name               =  v_repid
         i_internal_tabname           =  'ITAB'
        I_STRUCTURE_NAME             =
        I_CLIENT_NEVER_DISPLAY       = 'X'
         i_inclname                   = v_repid
        I_BYPASSING_BUFFER           =
        I_BUFFER_ACTIVE              =
        changing
          ct_fieldcat                  = itab_fld_cat
       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.
    endform.                    " FIELDCATMERGE
    *&      Form  ALVLISTDISPLAY
          text
    -->  p1        text
    <--  p2        text
    form alvlistdisplay .
      v_repid = sy-repid.
      call function 'REUSE_ALV_LIST_DISPLAY'
        exporting
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
          i_callback_program             = v_repid
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
      I_STRUCTURE_NAME               =
          is_layout                      = wa_layout
          it_fieldcat                    = itab_fld_cat
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
          i_default                      = 'X'
       I_SAVE                         = 'A'
      IS_VARIANT                     =
          it_events                      = itab_event
       IT_EVENT_EXIT                 = itab_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.
    endform.                    " ALVLISTDISPLAY
    *&      Form  ALVGRIDDISPLAY
          text
    -->  p1        text
    <--  p2        text
    form alvgriddisplay .
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
          i_callback_program                = v_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      = 'GRID DISPLAY'
      I_GRID_SETTINGS                   =
       IS_LAYOUT                         = WS_LAYOUT1
          it_fieldcat                       =  itab_fld_cat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
          it_events                         = itab_event
       IT_EVENT_EXIT                     = itab_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_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
    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.
    endform.                    " ALVGRIDDISPLAY
    *&      Form  GET_EVENTS
          text
    -->  p1        text
    <--  p2        text
    form get_events using itab_event type slis_t_event.
      call function 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      I_LIST_TYPE           = 0
       importing
          et_events             = itab_event
       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 itab_event with key name = slis_ev_top_of_page into wa_event
      if sy-subrc = 0.
        wa_event-form = 'FRM_TOP_OF_PAGE'.
        modify itab_event from wa_event index sy-tabix.
      endif.
    endform.                    " GET_EVENTS
    *&      Form  FRM_TOP_OF_PAGE
          text
    form frm_top_of_page.
    write : 130 'Time:'  ,sy-uzeit  .
      write :/2 'User: ', sy-uname.
      write: 59 sy-title, 130 'Page:' , sy-pagno.
      write:/ 'this is swathi and this is top of page '.
    endform.                    "FRM_TOP_OF_PAGE
    Reward points if helpful.
    Regards
    Swathi

  • TOP OF PAGE in ALV Grid Display in ECC 6.0

    Hi,
    I have an issue with top of page in Alv grid display
    in ECC 6.0. I searched  the forum for this, but
    couldnt fine any solution.
    I am using Reuse_alv_commentary_write to display the header.
    It's working fine in 4.7E but the same code is not working in
    ECC 6.0. The header is shown as  empty.
    I tried to execute some other programs with same FM and
    even standard SAP Prgrms too, even they raise the same issue
    the top of page is empty.
    Please suggest any other FM or approach to use in ECC 6.0 to get the top of page.
    Thanks in advance
    Kaavya.

    hiii
    use following code
    CALL FUNCTION 'REUSE_ALV_GRID_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_CALLBACK_TOP_OF_PAGE            = 'F0020_TOP_OF_PAGE'
    *     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *     I_CALLBACK_HTML_END_OF_LIST       = ' '
         i_structure_name                  = 'I_OUTPUT'
    *     I_BACKGROUND_ID                   = ' '
    *     I_GRID_TITLE                      =
    *     I_GRID_SETTINGS                   =
    *     IS_LAYOUT                       = wa_layout
         it_fieldcat           = i_fieldcat
    *     IT_EXCLUDING                      =
    *     IT_SPECIAL_GROUPS                 =
    *     IT_SORT                           =
    *     IT_FILTER                         =
    *     IS_SEL_HIDE                       =
         i_default                         = 'X'
         i_save                            = 'X'
         is_variant                        = wa_variant
    *     IT_EVENTS                         =
    *     IT_EVENT_EXIT                     =
    *     IS_PRINT                          =
    *     IS_REPREP_ID                      =
    *     I_SCREEN_START_COLUMN             = 0
    FORM f0020_top_of_page.
      DATA: i_listheader TYPE slis_t_listheader WITH HEADER LINE,
            w_date like sy-datum.
      move:
        'H'   TO i_listheader-typ,
        '                 Corporation'   TO i_listheader-info.
    *    text-021    TO i_listheader-info.
    *write: 'Camtura Corporations'.
      APPEND i_listheader.
      WRITE sy-datum TO w_date.
      move:
        'S'   TO i_listheader-typ,
        'Execution date'   TO i_listheader-key,
        w_date     TO i_listheader-info.
      APPEND i_listheader.
    regards
    twinkal

  • How To avoid column heading for only total line in ALV list Display

    Hi,
    How To avoid column heading for only total line in ALV list Display.

    Hi,
    to change colunm header field catlog is built
    look at the example below
    Changing column text headers
    use this to change, hide, or alter the ALV columns
    CLEAR: gt_fcat.
    READ TABLE gt_fcat WITH KEY fieldname = 'TEXT1' " ***
    *TEXT1 is your field name
       ASSIGNING <gtfcat>.
    IF sy-subrc = 0.
       <gtfcat>-coltext   = 'Date Type'.
       <gtfcat>-no_out    = ' '.
       <gtfcat>-tooltip   = 'Date Type Text from IT0019'.
       <gtfcat>-seltext   = 'IT0019'.
    keep seltext to '' if u want to hide
    ENDIF.
    regards
    austin

  • How to write strings with an underline on the TOP-OF-PAGE of ALV

    How to write strings with an underline on the TOP-OF-PAGE of ALV

    if u r using classes and methods it can be done
    but if u r using normal fms and then u have to use HTML_TOP_OF_PAGE but the drawback for this it cannot be printed when the report is printed .

  • Can we create the longer lines in the top-of-page in ALV Grid

    Dear Experts,
    I want to display longer characters in the TOP-OF-PAGE in the ALV GRID .
    ( more than 60 character up to 150 ).
    Is there any possible FM.
    Kindly provide.
    Regards
    R.Rajendran

    hI rANGA,
    I think upto 60 char is possible.
    Thanks
    Vincent

  • How to add interactive feature in top of page in ALV .

    Hi All ,
    There is immediate requirement , I have to add interactive feature in top of page in ALV grid .
    Can anyone sort this out ?
    Reward points will be given.

    hi,
    check this example:
    REPORT  ZSR_ALV_INTERACTIVE2.
    TYPE-POOLS: SLIS.
    *DATA DECLARATION.
    TYPES: BEGIN OF I_VBAK,
    VBELN TYPE VBELN_VA,
    AUGRU TYPE AUGRU,
    END OF I_VBAK.
    TYPES: BEGIN OF I_VBAP,
    VBELN TYPE VBELN_VA,
    AUGRU TYPE AUGRU,
    POSNR TYPE POSNR_VA,
    MATNR TYPE MATNR,
    ZMENG TYPE DZMENG,
    END OF I_VBAP.
    TYPES: BEGIN OF I_MAKT,
    MATNR TYPE MATNR,
    MAKTX TYPE MAKTX,
    END OF I_MAKT.
    TYPES: BEGIN OF I_LIPS,
    POSNR TYPE POSNR_VL,
    MATNR TYPE MATNR,
    LFIMG TYPE LFIMG,
    END OF I_LIPS.
    TYPES: BEGIN OF I_REASON,
    SPRAS TYPE SPRAS,
    AUGRU TYPE AUGRU,
    BEZEI TYPE BEZEI40,
    END OF I_REASON.
    TYPES: BEGIN OF I_VBPA,
    VBELN TYPE VBELN,
    PARVW TYPE PARVW,
    KUNNR TYPE KUNNR,
    END OF I_VBPA.
    TYPES: BEGIN OF I_KNA1,
    KUNNR TYPE KUNNR,
    NAME1 TYPE NAME1_GP,
    END OF I_KNA1.
    TYPES: BEGIN OF I_FINAL,
    VBELN TYPE VBELN_VA,
    POSNR TYPE POSNR_VA,
    MATNR TYPE MATNR,
    ZMENG TYPE DZMENG,
    MAKTX TYPE MAKTX,
    LFIMG TYPE LFIMG,
    SPRAS TYPE SPRAS,
    AUGRU TYPE AUGRU,
    BEZEI TYPE BEZEI40,
    PARVW TYPE PARVW,
    KUNNR TYPE KUNNR,
    NAME1 TYPE NAME1_GP,
    END OF I_FINAL.
    *INTERNAL TABLES
    DATA: IT_VBAK TYPE STANDARD TABLE OF I_VBAK.
    DATA: IT_VBAP TYPE STANDARD TABLE OF I_VBAP.
    DATA: IT_MAKT TYPE STANDARD TABLE OF I_MAKT.
    DATA: IT_LIPS TYPE STANDARD TABLE OF I_LIPS.
    DATA: IT_VBPA TYPE STANDARD TABLE OF I_VBPA.
    DATA: IT_KNA1 TYPE STANDARD TABLE OF I_KNA1.
    DATA: IT_FINAL TYPE STANDARD TABLE OF I_FINAL.
    DATA: IT_REASON TYPE STANDARD TABLE OF I_REASON.
    DATA : V_FLAG.
    *WORK AREA
    DATA: WA_VBAK TYPE I_VBAK.
    DATA: WA_VBAP TYPE I_VBAP.
    DATA: WA_MAKT TYPE I_MAKT.
    DATA: WA_LIPS TYPE I_LIPS.
    DATA: WA_VBPA TYPE I_VBPA.
    DATA: WA_KNA1 TYPE I_KNA1.
    DATA: WA_FINAL TYPE I_FINAL.
    DATA: WA_REASON TYPE I_REASON.
    *DATA DECLARATION.
    DATA: V_PROGNAME TYPE SY-REPID.
    DATA: V_VBELN TYPE VBAK-VBELN.
    DATA: V_GRIDTITLE TYPE LVC_TITLE.
    ***PARAMETERS: D_VARI LIKE DISVARIANT-VARIANT.
    *DATA: I_VARIANT LIKE DISVARIANT.
    *DATA: P_VARI LIKE DISVARIANT-VARIANT.
    *DATA DECLARATION FOR CATALOGS LAYOUT SORT EVENTCATALOG TOPOFPAGE.
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA: I_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA: I_SORTINFO TYPE SLIS_T_SORTINFO_ALV.
    DATA: I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA: I_EVENTCAT TYPE SLIS_T_EVENT.
    INITIALIZATION.
      V_PROGNAME = SY-REPID.
      V_FLAG = SPACE.
    *SELECTION SCREEN
      SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-002.
      SELECT-OPTIONS: S_VBELN FOR V_VBELN.
      SELECTION-SCREEN END OF BLOCK BLK1.
    *AT SLECTION-SCREEN.
    AT SELECTION-SCREEN.
      PERFORM Z_VALIDATIONS.
    *START OF SELECTION.
    START-OF-SELECTION.
      PERFORM Z_SELECT.
      PERFORM CHECK_VALIDATION_FLAG.
      PERFORM Z_FIELDCAT USING I_FIELDCAT.
      PERFORM Z_LAYOUT.
      PERFORM Z_SORTINFO USING I_SORTINFO.
      PERFORM Z_EVENTCAT USING I_EVENTCAT.
      PERFORM Z_GRIDTITLE.
      PERFORM Z_LISTHEADER USING I_LISTHEADER.
      PERFORM Z_DISPLAY.
    *& Form Z_VALIDATIONS
    FORM Z_VALIDATIONS .
      SELECT VBELN INTO V_VBELN
      UP TO 1 ROWS
      FROM VBAK
      WHERE VBELN IN S_VBELN.
      ENDSELECT.
      IF SY-SUBRC <> 0.
        MESSAGE I002(SY) WITH 'No Records'.
        V_FLAG = 'X'.
      ENDIF.
    ENDFORM. " Z_VALIDATIONS
    *& Form Z_FIELDCAT
    FORM Z_FIELDCAT USING P_I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
      DATA: I_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    *VBAK-VELN
      I_FIELDCAT-COL_POS = '1'. " POSITION OF THE COLUMN.
      I_FIELDCAT-FIELDNAME = 'VBELN'. " FIELD FOR WHICH CATALOG ID FILLED.
      I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
    *BELONGS TO.
      I_FIELDCAT-KEY = 'X'. " SO THAT THIS FIELD IS NOT SCROLLABLE AND
    *HIDDABLE.
      I_FIELDCAT-JUST = 'C'. " FOR JUSTIFICATION.
      I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
      I_FIELDCAT-SELTEXT_L = 'SALES ORDER'. " LONG TEXT FOR HEADER.
      I_FIELDCAT-OUTPUTLEN = 15. " SET THE OUTPUT LENGTH.
      I_FIELDCAT-REF_TABNAME = 'VBAK'. " FOR F1 & F4 HELP AS REFERNCED TO
    *THE DDIC TABLE.
      APPEND I_FIELDCAT TO P_I_FIELDCAT.
    *VBAP-SPRAS
      I_FIELDCAT-COL_POS = '2'. " POSITION OF THE COLUMN.
      I_FIELDCAT-FIELDNAME = 'SPRAS'. " FIELD FOR WHICH CATALOG ID FILLED.
      I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
    *BELONGS TO.
      I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
      I_FIELDCAT-SELTEXT_L = 'LANGUAGE'. " LONG TEXT FOR HEADER.
      I_FIELDCAT-OUTPUTLEN = 5. " SET THE OUTPUT LENGTH.
      I_FIELDCAT-REF_TABNAME = 'TVAUT'. " FOR F1 & F4 HELP AS REFERNCED TO
    *TABLE.
      APPEND I_FIELDCAT TO P_I_FIELDCAT.
    *VBAP-AUGRU
      I_FIELDCAT-COL_POS = '3'. " POSITION OF THE COLUMN.
      I_FIELDCAT-FIELDNAME = 'AUGRU'. " FIELD FOR WHICH CATALOG ID FILLED.
      I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
    *BELONGS TO.
      I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
      I_FIELDCAT-SELTEXT_L = 'REASON'. " LONG TEXT FOR HEADER.
      I_FIELDCAT-OUTPUTLEN = 5. " SET THE OUTPUT LENGTH.
      I_FIELDCAT-REF_TABNAME = 'VBAK'. " FOR F1 & F4 HELP AS REFERNCED TO
    *TABLE.
      APPEND I_FIELDCAT TO P_I_FIELDCAT.
    *VBAP-bezei
      I_FIELDCAT-COL_POS = '4'. " POSITION OF THE COLUMN.
      I_FIELDCAT-FIELDNAME = 'BEZEI'. " FIELD FOR WHICH CATALOG ID FILLED.
      I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
    *BELONGS TO.
      I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
      I_FIELDCAT-SELTEXT_L = 'DESCRIPTION'. " LONG TEXT FOR HEADER.
      I_FIELDCAT-OUTPUTLEN = 20. " SET THE OUTPUT LENGTH.
      I_FIELDCAT-REF_TABNAME = 'TVAUT'. " FOR F1 & F4 HELP AS REFERNCED TO
    *TABLE.
      APPEND I_FIELDCAT TO P_I_FIELDCAT.
    *VBAP-POSNR
      I_FIELDCAT-COL_POS = '5'. " POSITION OF THE COLUMN.
      I_FIELDCAT-FIELDNAME = 'POSNR'. " FIELD FOR WHICH CATALOG ID FILLED.
      I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
    *BELONGS TO.
      I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
      I_FIELDCAT-SELTEXT_L = 'ITEM'. " LONG TEXT FOR HEADER.
      I_FIELDCAT-OUTPUTLEN = 8. " SET THE OUTPUT LENGTH.
      I_FIELDCAT-REF_TABNAME = 'VBAP'. " FOR F1 & F4 HELP AS REFERNCED TO
    *TABLE.
      APPEND I_FIELDCAT TO P_I_FIELDCAT.
    *VBAP-MATNR.
      I_FIELDCAT-COL_POS = '6'. " POSITION OF THE COLUMN.
      I_FIELDCAT-FIELDNAME = 'MATNR'. " FIELD FOR WHICH CATALOG ID FILLED.
      I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
    *BELONGS TO.
      I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
      I_FIELDCAT-SELTEXT_L = 'MATERIAL'. " LONG TEXT FOR HEADER.
      I_FIELDCAT-OUTPUTLEN = 10. " SET THE OUTPUT LENGTH.
      I_FIELDCAT-REF_TABNAME = 'VBAP'. " FOR F1 & F4 HELP AS REFERNCED TO
    *TABLE.
      APPEND I_FIELDCAT TO P_I_FIELDCAT.
    *VBAP-ZMENG
      I_FIELDCAT-COL_POS = '7'. " POSITION OF THE COLUMN.
      I_FIELDCAT-FIELDNAME = 'ZMENG'. " FIELD FOR WHICH CATALOG ID FILLED.
      I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
    *BELONGS TO.
      I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
      I_FIELDCAT-SELTEXT_L = 'QUANT'. " LONG TEXT FOR HEADER.
      I_FIELDCAT-OUTPUTLEN = 10. " SET THE OUTPUT LENGTH.
      I_FIELDCAT-REF_TABNAME = 'VBAP'. " FOR F1 & F4 HELP AS REFERNCED TO
    *TABLE.
      APPEND I_FIELDCAT TO P_I_FIELDCAT.
    *MAKT-MAKTX
      I_FIELDCAT-COL_POS = '8'. " POSITION OF THE COLUMN.
      I_FIELDCAT-FIELDNAME = 'MAKTX'. " FIELD FOR WHICH CATALOG ID FILLED.
      I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
    *BELONGS TO.
      I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
      I_FIELDCAT-SELTEXT_L = 'DESCRIPTION'. " LONG TEXT FOR HEADER.
      I_FIELDCAT-OUTPUTLEN = 20. " SET THE OUTPUT LENGTH.
      I_FIELDCAT-REF_TABNAME = 'MAKT'. " FOR F1 & F4 HELP AS REFERNCED TO
    *TABLE.
      APPEND I_FIELDCAT TO P_I_FIELDCAT.
    *LIPS-VBELN
      I_FIELDCAT-COL_POS = '9'. " POSITION OF THE COLUMN.
      I_FIELDCAT-FIELDNAME = 'VBELN'. " FIELD FOR WHICH CATALOG ID FILLED.
      I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
    *BELONGS TO.
      I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
      I_FIELDCAT-SELTEXT_L = 'DELIVERY'. " LONG TEXT FOR HEADER.
      I_FIELDCAT-OUTPUTLEN = 15. " SET THE OUTPUT LENGTH.
      I_FIELDCAT-REF_TABNAME = 'LIPS'. " FOR F1 & F4 HELP AS REFERNCED TO
    *TABLE.
      APPEND I_FIELDCAT TO P_I_FIELDCAT.
    *LIPS-LFIMG
      I_FIELDCAT-COL_POS = '10'. " POSITION OF THE COLUMN.
      I_FIELDCAT-FIELDNAME = 'LFIMG'. " FIELD FOR WHICH CATALOG ID FILLED.
      I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
    *BELONGS TO.
      I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
      I_FIELDCAT-DO_SUM = 'X'.
      I_FIELDCAT-SELTEXT_L = 'LFIMG'. " LONG TEXT FOR HEADER.
      I_FIELDCAT-OUTPUTLEN = 18. " SET THE OUTPUT LENGTH.
      I_FIELDCAT-REF_TABNAME = 'LIPS'. " FOR F1 & F4 HELP AS REFERNCED TO
    *TABLE.
      APPEND I_FIELDCAT TO P_I_FIELDCAT.
    *parvw
      I_FIELDCAT-COL_POS = '11'. " POSITION OF THE COLUMN.
      I_FIELDCAT-FIELDNAME = 'PARVW'. " FIELD FOR WHICH CATALOG ID FILLED.
      I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
    *BELONGS TO.
      I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
      I_FIELDCAT-SELTEXT_L = 'PARTNER FUN'. " LONG TEXT FOR HEADER.
      I_FIELDCAT-OUTPUTLEN = 18. " SET THE OUTPUT LENGTH.
      I_FIELDCAT-REF_TABNAME = 'VBPA'. " FOR F1 & F4 HELP AS REFERNCED TO
    *TABLE.
      APPEND I_FIELDCAT TO P_I_FIELDCAT.
    *KUNNR
      I_FIELDCAT-COL_POS = '12'. " POSITION OF THE COLUMN.
      I_FIELDCAT-FIELDNAME = 'KUNNR'. " FIELD FOR WHICH CATALOG ID FILLED.
      I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
    *BELONGS TO.
      I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
      I_FIELDCAT-SELTEXT_L = 'SHIP'. " LONG TEXT FOR HEADER.
      I_FIELDCAT-OUTPUTLEN = 18. " SET THE OUTPUT LENGTH.
      I_FIELDCAT-REF_TABNAME = 'VBPA'. " FOR F1 & F4 HELP AS REFERNCED TO
    *TABLE.
      APPEND I_FIELDCAT TO P_I_FIELDCAT.
    *NAME1
      I_FIELDCAT-COL_POS = '13'. " POSITION OF THE COLUMN.
      I_FIELDCAT-FIELDNAME = 'NAME1'. " FIELD FOR WHICH CATALOG ID FILLED.
      I_FIELDCAT-TABNAME = 'IT_FINAL'. " INTERNAL TABLE TO WHICH THE FIELD
    *BELONGS TO.
      I_FIELDCAT-LZERO = 'X'. " OUTPUT WITH LEADING ZEROS.
      I_FIELDCAT-SELTEXT_L = 'NAME'. " LONG TEXT FOR HEADER.
      I_FIELDCAT-OUTPUTLEN = 18. " SET THE OUTPUT LENGTH.
      I_FIELDCAT-REF_TABNAME = 'KNA1'. " FOR F1 & F4 HELP AS REFERNCED TO
    *TABLE.
      APPEND I_FIELDCAT TO P_I_FIELDCAT.
    ENDFORM. " Z_FIELDCAT
    *& Form Z_SELECT
    FORM Z_SELECT .
      SELECT VBELN
      AUGRU INTO CORRESPONDING FIELDS OF TABLE IT_VBAK
      FROM VBAK
      WHERE VBELN IN S_VBELN.
      IF SY-SUBRC = 0.
        SELECT VBELN
        POSNR
        MATNR
        ZMENG INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
        FROM VBAP
        FOR ALL ENTRIES IN IT_VBAK
        WHERE VBELN = IT_VBAK-VBELN.
        IF SY-SUBRC = 0.
          SELECT SPRAS
          AUGRU
          BEZEI INTO CORRESPONDING FIELDS OF TABLE IT_REASON
          FROM TVAUT
          FOR ALL ENTRIES IN IT_VBAK
          WHERE AUGRU = IT_VBAK-AUGRU.
          IF SY-SUBRC = 0.
            SELECT VBELN
            PARVW
            KUNNR INTO CORRESPONDING FIELDS OF TABLE IT_VBPA
            FROM VBPA
            FOR ALL ENTRIES IN IT_VBAK
            WHERE VBELN = IT_VBAK-VBELN.
            IF SY-SUBRC = 0.
              SELECT KUNNR
              NAME1 INTO CORRESPONDING FIELDS OF TABLE IT_KNA1
              FROM KNA1
              FOR ALL ENTRIES IN IT_VBPA
              WHERE KUNNR = IT_VBPA-KUNNR.
              IF SY-SUBRC = 0.
                SELECT POSNR
                MATNR
                LFIMG INTO CORRESPONDING FIELDS OF TABLE IT_LIPS
                FROM LIPS
                FOR ALL ENTRIES IN IT_VBAP
                WHERE POSNR = IT_VBAP-POSNR.
                IF SY-SUBRC = 0.
                  SELECT MATNR
                  MAKTX INTO CORRESPONDING FIELDS OF TABLE IT_MAKT
                  FROM MAKT
                  FOR ALL ENTRIES IN IT_VBAP
                  WHERE MATNR = IT_VBAP-MATNR.
                ENDIF.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
      ELSE.
        MESSAGE I002(SY) WITH 'No Data found'.
        LEAVE LIST-PROCESSING.
      ENDIF.
      IF SY-SUBRC = 0.
        LOOP AT IT_VBAP INTO WA_VBAP.
          READ TABLE IT_VBAK INTO WA_VBAK WITH KEY VBELN = WA_VBAP-VBELN
    BINARY SEARCH.
          IF SY-SUBRC = 0.
    *MOVE DATA INTO IT_FINAL.
            MOVE: WA_VBAK-VBELN TO WA_FINAL-VBELN,
            WA_VBAK-AUGRU TO WA_FINAL-AUGRU,
            WA_VBAP-POSNR TO WA_FINAL-POSNR,
            WA_VBAP-MATNR TO WA_FINAL-MATNR,
            WA_VBAP-ZMENG TO WA_FINAL-ZMENG.
          ENDIF.
          READ TABLE IT_LIPS INTO WA_LIPS WITH KEY POSNR = WA_FINAL-POSNR
    BINARY SEARCH.
          IF SY-SUBRC = 0.
            MOVE: WA_LIPS-LFIMG TO WA_FINAL-LFIMG.
          ENDIF.
          READ TABLE IT_REASON INTO WA_REASON WITH KEY AUGRU =
    WA_FINAL-AUGRU BINARY SEARCH.
          IF SY-SUBRC = 0.
            MOVE: WA_REASON-SPRAS TO WA_FINAL-SPRAS,
            WA_REASON-BEZEI TO WA_FINAL-BEZEI.
          ENDIF.
          READ TABLE IT_MAKT INTO WA_MAKT WITH KEY MATNR = WA_FINAL-MATNR
    BINARY SEARCH.
          IF SY-SUBRC = 0.
            MOVE: WA_MAKT-MAKTX TO WA_FINAL-MAKTX.
          ENDIF.
          READ TABLE IT_VBPA INTO WA_VBPA WITH KEY VBELN = WA_FINAL-VBELN
    BINARY SEARCH.
          IF SY-SUBRC = 0.
            MOVE: WA_VBPA-PARVW TO WA_FINAL-PARVW,
            WA_VBPA-KUNNR TO WA_FINAL-KUNNR.
          ENDIF.
          READ TABLE IT_KNA1 INTO WA_KNA1 WITH KEY KUNNR = WA_FINAL-KUNNR
    BINARY SEARCH.
          IF SY-SUBRC = 0.
            MOVE: WA_KNA1-NAME1 TO WA_FINAL-NAME1.
          ENDIF.
          APPEND WA_FINAL TO IT_FINAL.
          CLEAR WA_FINAL.
        ENDLOOP.
      ENDIF.
    ENDFORM. " Z_SELECT
    *& Form Z_LAYOUT
    FORM Z_LAYOUT .
      I_LAYOUT-ZEBRA = 'X'.
      I_LAYOUT-TOTALS_TEXT = 'Total'(A00).
      I_LAYOUT-SUBTOTALS_TEXT = 'SubTotal'(A01).
      I_LAYOUT-BOX_TABNAME = 'IT_FINAL'.
    ENDFORM. " Z_LAYOUT
    *& Form Z_SORTINFO
    FORM Z_SORTINFO USING P_I_SORTINFO TYPE SLIS_T_SORTINFO_ALV.
      DATA: I_SORTINFO TYPE SLIS_SORTINFO_ALV.
      CLEAR I_SORTINFO.
      I_SORTINFO-SPOS = '1'.
      I_SORTINFO-FIELDNAME = 'VBELN'.
      I_SORTINFO-TABNAME = 'IT_FINAL'.
      I_SORTINFO-UP = 'X'.
      I_SORTINFO-GROUP = 'UL'. " I.E UNDERLINE AFTER EVERY GROUP
      I_SORTINFO-SUBTOT = 'X'.
      APPEND I_SORTINFO TO P_I_SORTINFO.
    ENDFORM. " Z_SORTINFO
    *& Form Z_EVENTCAT
    FORM Z_EVENTCAT USING P_I_EVENTCAT TYPE SLIS_T_EVENT.
      DATA: I_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE     = 0
        IMPORTING
          ET_EVENTS       = P_I_EVENTCAT
        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.
      CLEAR I_EVENT.
      READ TABLE P_I_EVENTCAT WITH KEY NAME = SLIS_EV_TOP_OF_PAGE INTO
      I_EVENT.
      IF SY-SUBRC = 0.
        MOVE 'TOP_OF_PAGE' TO I_EVENT-FORM.
        APPEND I_EVENT TO P_I_EVENTCAT.
      ENDIF.
      READ TABLE P_I_EVENTCAT WITH KEY NAME = SLIS_EV_PF_STATUS_SET INTO
    I_EVENT.
      IF SY-SUBRC = 0.
        MOVE 'SET_PF_STATUS' TO I_EVENT-FORM.
        APPEND I_EVENT TO P_I_EVENTCAT.
      ENDIF.
      CLEAR I_EVENT.
      READ TABLE P_I_EVENTCAT INTO I_EVENT WITH KEY NAME =
    SLIS_EV_USER_COMMAND .
      IF SY-SUBRC = 0.
        MOVE 'USER_COMMAND' TO I_EVENT-FORM.
        APPEND I_EVENT TO P_I_EVENTCAT.
      ENDIF.
    ENDFORM. " Z_EVENTCAT
    *& Form Z_DISPLAY
    FORM Z_DISPLAY .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
      I_CALLBACK_PROGRAM = V_PROGNAME
    *I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
      I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
      I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
      I_GRID_TITLE = V_GRIDTITLE
      I_SAVE = 'A'
      IS_LAYOUT = I_LAYOUT
      IT_FIELDCAT = I_FIELDCAT[]
      IT_SORT = I_SORTINFO
      IT_EVENTS = I_EVENTCAT
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
      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.
    ENDFORM. " Z_DISPLAY
    *& Form Z_GRIDTITLE
    FORM Z_GRIDTITLE .
      V_GRIDTITLE = 'ALV FOR SALES ORDER DISPLAY'.
    ENDFORM. " Z_GRIDTITLE
    *TOP OF PAGE.
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = I_LISTHEADER.
    ENDFORM. "TOP_OF_PAGE
    *MENU SETTINGS.
    FORM SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'ALV_MENU'.
    ENDFORM. "SET_PF_STATUS
    *USER-COMMAND
    FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
      DATA : VBELN TYPE VBELN_VA.
      CASE P_UCOMM.
        WHEN 'BACK'.
          LEAVE PROGRAM.
        WHEN '&IC1'.
          CLEAR : VBELN.
          VBELN = RS_SELFIELD-VALUE.
          SET PARAMETER ID: 'AUN' FIELD VBELN.
          CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
      ENDCASE.
    ENDFORM. " USER_COMMAND
    *& Form Z_LISTHEADER
    FORM Z_LISTHEADER USING P_I_LISTHEADER TYPE SLIS_T_LISTHEADER.
      DATA: L_LISTHEADER TYPE SLIS_LISTHEADER.
      REFRESH P_I_LISTHEADER.
      CLEAR L_LISTHEADER.
      L_LISTHEADER-TYP = 'H'.
      L_LISTHEADER-INFO = TEXT-001.
      APPEND L_LISTHEADER TO P_I_LISTHEADER.
      CLEAR L_LISTHEADER.
      L_LISTHEADER-TYP = 'H'.
      L_LISTHEADER-INFO = TEXT-002.
      APPEND L_LISTHEADER TO P_I_LISTHEADER.
    ENDFORM. " Z_LISTHEADER
    *& Form check_validation_flag
    text
    --> p1 text
    <-- p2 text
    FORM CHECK_VALIDATION_FLAG .
      IF NOT V_FLAG IS INITIAL.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM. " check_validation_flag

  • Top of page in alv list

    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,
    Priya

    Hi Priya,
    here is the example code for your reference
    *ALV Header declarations
      DATA: t_header TYPE slis_t_listheader,
            wa_header TYPE slis_listheader.
    * Title
      wa_header-typ  = 'H'.
      wa_header-info = text-h01.
      APPEND wa_header TO t_header.
      CLEAR wa_header.
    * Date
      wa_header-typ  = gc_s.
      wa_header-key = text-h02.
      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.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = t_header.
    Reward points if it helps,
    Satish

  • To get top-of-page in alv list

    How get top-of-page using reuse_alv_list_display ?
    How to get checkbox into that top-of-page ? And how to access that checkbox whether it is checked or not ? And if checked to get into next step of program promptly ?

    hai  Anirban Datta,
    REPORT YBALV_FULLSCREEN_DEMO NO STANDARD PAGE HEADING.
    *"General Data
    TYPE-POOLS: SLIS.
    DATA: BEGIN OF GT_OUTTAB OCCURS 0.
            INCLUDE STRUCTURE SFLIGHT.
    DATA: END OF GT_OUTTAB,
          GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
          G_EXIT_CAUSED_BY_CALLER,
          GS_EXIT_CAUSED_BY_USER TYPE SLIS_EXIT_BY_USER,
          G_REPID LIKE SY-REPID.
    *"Callback
    DATA:
        GT_EVENTS      TYPE SLIS_T_EVENT,
        GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
        G_STATUS_SET   TYPE SLIS_FORMNAME VALUE 'PF_STATUS_SET',
        G_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND',
        G_TOP_OF_PAGE  TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
        G_TOP_OF_LIST  TYPE SLIS_FORMNAME VALUE 'TOP_OF_LIST',
        G_END_OF_LIST  TYPE SLIS_FORMNAME VALUE 'END_OF_LIST'.
    *"Variants
    DATA: GS_VARIANT LIKE DISVARIANT,
          G_SAVE.
    INITIALIZATION.
    G_REPID = SY-REPID.
    PERFORM LAYOUT_INIT USING GS_LAYOUT.
    PERFORM EVENTTAB_BUILD USING GT_EVENTS[].
    GS_VARIANT-REPORT = G_REPID.
    G_SAVE           = 'A'.
    START-OF-SELECTION.
    *"Data Selection
      PERFORM SELECT_DATA TABLES GT_OUTTAB.
    END-OF-SELECTION.
    *"List Header for Top-Of-Page
    PERFORM COMMENT_BUILD USING GT_LIST_TOP_OF_PAGE[].
    *"Display List
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
           I_BACKGROUND_ID    = 'ALV_BACKGROUND'
           i_buffer_active    = 'X'
           I_CALLBACK_PROGRAM = G_REPID
           I_STRUCTURE_NAME   = 'SFLIGHT'
           IS_LAYOUT          = GS_LAYOUT
           I_SAVE             = G_SAVE
           IS_VARIANT         = GS_VARIANT
           IT_EVENTS          = GT_EVENTS[]
         I_SCREEN_START_COLUMN    = 0     "Use coordinates for
         I_SCREEN_START_LINE      = 0     "display as dialog box
         I_SCREEN_END_COLUMN      = 0
         I_SCREEN_END_LINE        = 0
      IMPORTING
           E_EXIT_CAUSED_BY_CALLER = G_EXIT_CAUSED_BY_CALLER
           ES_EXIT_CAUSED_BY_USER  = GS_EXIT_CAUSED_BY_USER
      TABLES
           T_OUTTAB = GT_OUTTAB
      EXCEPTIONS
           PROGRAM_ERROR = 1
           OTHERS        = 2.
    IF SY-SUBRC = 0.
      IF G_EXIT_CAUSED_BY_CALLER = 'X'.
    *"  Forced Exit by calling program
    *"  <do_something>.
      ELSE.
    *"  User left list via F3, F12 or F15
        IF GS_EXIT_CAUSED_BY_USER-BACK = 'X'.       "F3
    *"    <do_something>.
        ELSE.
          IF GS_EXIT_CAUSED_BY_USER-EXIT = 'X'.     "F15
    *"      <do_something>.
          ELSE.
            IF GS_EXIT_CAUSED_BY_USER-CANCEL = 'X'. "F12
    *"        <do_something>.
            ELSE.
    *"        should not occur!
    *"        <do_Abnormal_End>.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.
    ELSE.
    *"Fatal error callin ALV
    MESSAGE AXXX(XY) WITH ...
    ENDIF.
    *"Form routines
    FORM SELECT_DATA TABLES RT_OUTTAB LIKE GT_OUTTAB[].
    *"- Selection of data to be displayed
      SELECT * FROM SFLIGHT INTO CORRESPONDING FIELDS
                       OF TABLE RT_OUTTAB
                       UP TO 00030 ROWS.
    ENDFORM.
    FORM LAYOUT_INIT USING RS_LAYOUT TYPE SLIS_LAYOUT_ALV.
    *"Build layout for list display
      RS_LAYOUT-DETAIL_POPUP      = 'X'.
    ENDFORM.
    FORM EVENTTAB_BUILD USING RT_EVENTS TYPE SLIS_T_EVENT.
    *"Registration of events to happen during list display
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
          EXPORTING
               I_LIST_TYPE = 0
          IMPORTING
               ET_EVENTS   = RT_EVENTS.
      READ TABLE RT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE G_TOP_OF_PAGE TO LS_EVENT-FORM.
        APPEND LS_EVENT TO RT_EVENTS.
      ENDIF.
    ENDFORM.
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
               I_LOGO             = 'ENJOYSAP_LOGO'
                IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
    ENDFORM .
    FORM COMMENT_BUILD USING LT_TOP_OF_PAGE TYPE
                                            SLIS_T_LISTHEADER.
      DATA: LS_LINE TYPE SLIS_LISTHEADER.
    LIST HEADING LINE: TYPE H
      CLEAR LS_LINE.
      LS_LINE-TYP  = 'H'.
    LS_LINE-KEY:  NOT USED FOR THIS TYPE
      LS_LINE-INFO = TEXT-100.
      APPEND LS_LINE TO LT_TOP_OF_PAGE.
    STATUS LINE: TYPE S
      CLEAR LS_LINE.
      LS_LINE-TYP  = 'S'.
      LS_LINE-KEY  = TEXT-101.
      LS_LINE-INFO = TEXT-102.
      APPEND LS_LINE TO LT_TOP_OF_PAGE.
      LS_LINE-KEY  = TEXT-103.
      LS_LINE-INFO = TEXT-104.
      APPEND LS_LINE TO LT_TOP_OF_PAGE.
    ACTION LINE: TYPE A
      CLEAR LS_LINE.
      LS_LINE-TYP  = 'A'.
    LS_LINE-KEY:  NOT USED FOR THIS TYPE
      LS_LINE-INFO = TEXT-105.
      APPEND LS_LINE TO LT_TOP_OF_PAGE.
    ENDFORM.
    Regards.
    Eshwar.

  • How to print header lines at the top of every page with Alv list display?

    Dear all,
    I need a requirement with printing issue. A program list should be printed with the function reuse_alv_list_display.
    The list has several pages and then can be printed but the header lines appear only first page when they printed. The other pages don't have header lines, they continue with the next record of the list remaining from previous page. I use the alv parameters as below:
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program       = l_repid
          i_callback_pf_status_set = 'ALV_PF_STATUS'
          is_layout                = ls_layo
          it_fieldcat              = lt_fcat
          i_default                = 'X'
          i_save                   = 'A'
          is_variant               = ls_variant
          it_events                = lt_events
        TABLES
          t_outtab                 = lt_data
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
    and lt_events as below:
      ls_event-name = 'END_OF_LIST'.
      ls_event-form = 'ALV_END_OF_LIST'.
      APPEND ls_event TO lt_events.
      ls_event-name = 'END_OF_PAGE'.
      ls_event-form = 'ALV_END_OF_PAGE'.
      APPEND ls_event TO lt_events.
      ls_event-name = 'TOP_OF_LIST'.
      ls_event-form = 'ALV_TOP_OF_LIST'.
      APPEND ls_event TO lt_events.
      ls_event-name = 'TOP_OF_PAGE'.
      ls_event-form = 'ALV_TOP_OF_PAGE'.
      APPEND ls_event TO lt_events.
    So, how can I print header lines for every page?
    Best Regards,

    Hello Saba,
    Your point might be very close to solution.
    Because in the selection screen of the program there are two radio buttons, one of them visits 'REUSE_ALV_COMMENTARY_WRITE' function and the other doesn't. The one which visits has a problem with header liens in every page when printing. But I couldn't find out the solution yet.
    reuse_alv_list_display uses 4 event and of course I call subroutine. There are end_of_list, end_of_page, top_of_list and top_of_page. I use in the subroutine for top_of_page:
      CALL FUNCTION 'LVC_TRANSFER_TO_SLIS'
        EXPORTING
          it_fieldcat_lvc         = gt_fcat
        IMPORTING
          et_fieldcat_alv         = lt_fcat
        EXCEPTIONS
          it_data_missing         = 1
          it_fieldcat_lvc_missing = 2
          OTHERS                  = 3.
      CALL FUNCTION 'REUSE_ALV_LIST_WIDTH_GET'
        EXPORTING
          it_fieldcat = lt_fcat
        IMPORTING
          e_width     = l_width.
    WRITE l_reptx TO l_reptx CENTERED.
      NEW-LINE.
      WRITE: AT (l_width) l_reptx CENTERED.
      SUBTRACT 10 FROM l_width.
      WRITE: AT l_width sy-pagno RIGHT-JUSTIFIED.
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
            it_list_commentary       = lt_header
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
    Do you have other suggestions ?

  • How to put a push button in the top of page of ALV

    Hi at all,
    I need to put a push button in TOP OF PAGE .
    My code is below and i'd like to put a push button to do something.
    FORM top_of_page USING r_ddoc TYPE REF TO cl_dd_document.
      DATA: text TYPE sdydo_text_element.
      DATA: text_table TYPE sdydo_text_table.
      CALL METHOD r_ddoc->initialize_document.
    Title
      text = text-301.
      CALL METHOD r_ddoc->add_text
        EXPORTING
          text          = text
          sap_style     = 'HEADING'.
      CLEAR text.
    endform.
    Thanks at all.
    ENDFORM.

    Hi Domenico,
    For pushbuttons on Dynamic Documents please refer to this link:
    http://help.sap.com/saphelp_nw70/helpdata/EN/b6/ab3a7503ac11d4a73f0000e83dd863/frameset.htm
    Regards
    Marcin

Maybe you are looking for