Scroll Bar in ALV Top Of Page

Hi Ppl,
I am using REUSE_ALV_COMMENTARY_WRITE to display top of page in ALV. The issue is i want to restrict the top-of-page height.
As of now if i have 10 lines to print...the top-of-page comes with 10 lines in display.
But i want some (say 4 or 5) to be visible with scroolbar and rest can be viewed by use of the scroll--bar movement!!
Any soln?? Please reply
Regards,
Santosh!!

Hi Santosh,
I am not sure if that is possible by using FM approach. - REUSE_ALV_COMMENTARY_WRITE
But yes its possible if you are using Docking Container. with split container approach. ie. OOPs .
Refer sample code.
Constants Declaration
CONSTANTS: c_x             TYPE c          VALUE 'X',
           c_mode          TYPE char1      VALUE 'O',
           c_mask          TYPE char9      VALUE ',*.*,*.*.',
           c_error_log     TYPE tabname    VALUE 'ZERROR_LOG',
           c_succ          TYPE iconname   VALUE '@01@',    "#EC *
           c_fail          TYPE iconname   VALUE '@02@',
           c_object        TYPE emg_object VALUE 'PARTNER'," Legacy obj
           c_opbuk         TYPE opbuk_kk   VALUE 'UK01',
           c_split         TYPE c
                           VALUE cl_abap_char_utilities=>horizontal_tab,
           c_path          TYPE char100
                           VALUE '/local/data/interface/A28/DM/OUT'.
*Variables Declaration
DATA:  flg_pre     TYPE c,             " Flag -  Presentation browse
       flg_x       TYPE c,
       cnt_total   TYPE char8,         " Total Records processed
       cnt_success TYPE char8,         " Total Records success
       cnt_failed  TYPE char8,        " Total Records failed
       cnt_repeat  TYPE char8.
*-- ALV Grid data declaration
      CLASS v_lcl_event_receiver DEFINITION
CLASS lcl_event_receiver DEFINITION.
  PUBLIC SECTION.
    METHODS:
     handle_print_top_of_page FOR EVENT print_top_of_page OF
                                        cl_gui_alv_grid,
     handle_top_of_page       FOR EVENT top_of_page OF
                                        cl_gui_alv_grid.
ENDCLASS.                    "o_lcl_event_receiver DEFINITION
      ALV Data declaration
DATA : o_alvgrid          TYPE REF TO cl_gui_alv_grid,
       o_split            TYPE REF TO cl_gui_easy_splitter_container,
       o_dockingcontainer TYPE REF TO cl_gui_docking_container,
      <b> o_container_top    TYPE REF TO cl_gui_container,
       o_container_bot    TYPE REF TO cl_gui_container,
       o_html             TYPE REF TO cl_dd_document,</b>       o_event_receiver   TYPE REF TO lcl_event_receiver,
       ok_code            LIKE sy-ucomm,
       i_fieldcat         TYPE lvc_t_fcat,
       wa_fieldcat        TYPE lvc_s_fcat,
       wa_layout          TYPE lvc_s_layo.
      CLASS LCL_EVENT_RECEIVER IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
*-- Top of Page
  METHOD handle_print_top_of_page.
  ENDMETHOD.                    "handle_print_top_of_page
  METHOD handle_top_of_page.
  ENDMETHOD.                    "handle_top_of_page
ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
*-- ALV List data declaration
DATA:  i_field_cat1       TYPE slis_t_fieldcat_alv,
       w_lay_out1         TYPE slis_layout_alv,
       w_field_cat        TYPE slis_fieldcat_alv,
       i_events1          TYPE slis_t_event,
       w_event            TYPE slis_alv_event,
       w_print            TYPE slis_print_alv.
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'STANDARD'.
  SET TITLEBAR 'TITLE'.
*-- Create Instances
  PERFORM f0040_create_object.
*-- Create Field catalog
  PERFORM f0050_field_catalog
                    TABLES i_fieldcat
                    USING c_error_log.
*-- Modify Field Catalog
  PERFORM f0060_modify_fldcatalog
                    TABLES i_fieldcat.
*-- Set ALV Layout
  PERFORM f0070_layout.
*-- Generate ALV Grid
  PERFORM f0080_display_list
                    TABLES  i_error
                            i_fieldcat
                      USING wa_layout.
ENDMODULE.                 " STATUS_0100  OUTPUT
*&      Form  f0040_create_object
FORM f0040_create_object .
  IF cl_gui_alv_grid=>offline( ) IS INITIAL.
*-- Create Container
    CREATE OBJECT o_dockingcontainer
      EXPORTING
        ratio                     = '95'
     EXCEPTIONS
      cntl_error                  = 1
      cntl_system_error           = 2
      create_error                = 3
      lifetime_error              = 4
      lifetime_dynpro_dynpro_link = 5
      OTHERS                      = 6.
    IF sy-subrc NE 0.
      MESSAGE i000 WITH text-013.   " Error in object creation
      LEAVE LIST-PROCESSING.
    ENDIF.
*--Create Splitter Container
    CREATE OBJECT o_split
      EXPORTING
        parent            = o_dockingcontainer
        sash_position     = 20
        with_border       = 0
      EXCEPTIONS
        cntl_error        = 1
        cntl_system_error = 2
        OTHERS            = 3.
*--Get the containers of the splitter control
    o_container_top = o_split->top_left_container.
    o_container_bot = o_split->bottom_right_container.
  ENDIF.
  CREATE OBJECT o_alvgrid
     EXPORTING
       i_parent = o_container_bot.
*-- Print Top of Page
  PERFORM f0041_top_of_page.
ENDFORM.                    " f0040_create_object
<b>&----
*&      Form  f0041_top_of_page</b>
FORM f0041_top_of_page .
  DATA: lws_text  TYPE sdydo_text_element.
  IF cl_gui_alv_grid=>offline( ) IS INITIAL.
*-- Object for HTML top container
    CREATE OBJECT o_html
        EXPORTING style            = 'ALV_GRID'
                  background_color = 35.
*-- Top of Page
    CALL METHOD o_alvgrid->list_processing_events
      EXPORTING
        i_event_name = 'TOP_OF_PAGE'
        i_dyndoc_id  = o_html.
*-- Total Record Text
    CALL METHOD o_html->add_text
      EXPORTING
        text         = text-014
        sap_emphasis = text-017.
    CALL METHOD o_html->add_gap
      EXPORTING
        width = 8.
**-- Total record Value
    lws_text = cnt_total.
    CALL METHOD o_html->add_text
      EXPORTING
        text         = lws_text
        sap_emphasis = text-017.
    CLEAR  lws_text.
    CALL METHOD o_html->new_line
      EXPORTING
        repeat = 1.
**-- Total Success text
    CALL METHOD o_html->add_text
      EXPORTING
        text         = text-015
        sap_emphasis = text-017
        fix_lines    = c_x.
    CALL METHOD o_html->add_gap
      EXPORTING
        width = 12.
    lws_text = cnt_success.
    CALL METHOD o_html->add_text
      EXPORTING
        text         = lws_text
        sap_emphasis = text-017
        fix_lines    = c_x.
    CLEAR  lws_text.
    CALL METHOD o_html->new_line
      EXPORTING
        repeat = 1.
*-- Total Failed text
    CALL METHOD o_html->add_text
      EXPORTING
        text         = text-016
        sap_emphasis = text-017
        fix_lines    = c_x.
    CALL METHOD o_html->add_gap
      EXPORTING
        width = 16.
    lws_text = cnt_failed.
    CALL METHOD o_html->add_text
      EXPORTING
        text         = lws_text
        sap_emphasis = text-017
        fix_lines    = c_x.
    CLEAR  lws_text.
*-- Display Report Header
<b>    CALL METHOD o_html->display_document
      EXPORTING
        parent = o_container_top.</b>
  ENDIF.
ENDFORM.                    " f0041_top_of_page
*&      Form  f0050_field_catalog
FORM f0050_field_catalog  TABLES   p_fieldcat STRUCTURE lvc_s_fcat
                          USING value(p_structure).
  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name       = p_structure
    CHANGING
      ct_fieldcat            = p_fieldcat[]
    EXCEPTIONS
      inconsistent_interface = 1
      program_error          = 2
      OTHERS                 = 3.
  IF sy-subrc <> 0.
    MESSAGE i000(zo_spa) WITH text-017.
    LEAVE LIST-PROCESSING.
  ENDIF.
ENDFORM.                    " f0050_field_catalog
*&      Form  f0070_layout
FORM f0070_layout .
  wa_layout-zebra      = c_x.
  wa_layout-cwidth_opt = c_x.
ENDFORM.                    " f0070_layout
*&      Form  f0080_display_list
FORM f0080_display_list  TABLES  p_output
                                 p_fieldcat
                         USING value(p_layout).
*-- Display Report
  CALL METHOD o_alvgrid->set_table_for_first_display
    EXPORTING
      i_save                        = 'A'
      is_layout                     = p_layout
    CHANGING
      it_outtab                     = p_output[]
      it_fieldcatalog               = p_fieldcat[]
    EXCEPTIONS
      invalid_parameter_combination = 1
      program_error                 = 2
      too_many_lines                = 3
      OTHERS                        = 4.
  IF sy-subrc <> 0.
    MESSAGE i000(zo_spa) WITH text-022.    " Error in Displaying
    LEAVE LIST-PROCESSING.
  ENDIF.
**-- Create Event object
  CREATE OBJECT o_event_receiver.
  SET HANDLER o_event_receiver->handle_print_top_of_page
                                 FOR o_alvgrid.
ENDFORM.                    " f0080_display_list
*&      Module  USER_COMMAND_0100  INPUT
MODULE user_command_0100 INPUT.
  ok_code = sy-ucomm.
  CASE ok_code.
    WHEN 'EXIT' OR  'CANC'.
      PERFORM f4000_free_objects:
               USING o_alvgrid 'ALV' text-031,
               USING o_dockingcontainer 'DOCKING' text-032.
      LEAVE PROGRAM.
    WHEN 'BACK'.
      PERFORM f4000_free_objects:
               USING o_alvgrid 'ALV' text-031,
               USING o_dockingcontainer 'DOCKING' text-032.
      SET SCREEN '0'.
      LEAVE SCREEN.
    WHEN OTHERS.
      PERFORM f4000_free_objects:
                USING o_alvgrid 'ALV' text-031,
                USING o_dockingcontainer 'DOCKING' text-032.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT
*&      Form  f4000_free_objects
FORM f4000_free_objects  USING pobject
                        value(ptype)
                        value(ptext) TYPE c.
  DATA: lo_objectalv TYPE REF TO cl_gui_alv_grid.
  CASE ptype.
    WHEN 'ALV'.
      lo_objectalv = pobject.
      IF NOT ( lo_objectalv IS INITIAL ).
        CALL METHOD lo_objectalv->free
          EXCEPTIONS
            cntl_error        = 1
            cntl_system_error = 2
            OTHERS            = 3.
        CLEAR: pobject, lo_objectalv.
        PERFORM f4010_error_handle USING ptext.
      ENDIF.
    WHEN 'DOCKING'.
      DATA: lo_objectdock TYPE REF TO cl_gui_docking_container.
      lo_objectdock = pobject.
      IF NOT ( lo_objectdock IS INITIAL ).
        CALL METHOD lo_objectdock->free
          EXCEPTIONS
            cntl_error        = 1
            cntl_system_error = 2
            OTHERS            = 3.
        CLEAR: pobject, lo_objectdock.
        PERFORM f4010_error_handle USING ptext.
      ENDIF.
    WHEN OTHERS.
      sy-subrc = 1.
      PERFORM f4010_error_handle
                   USING text-031.
  ENDCASE.
ENDFORM.                    " f4000_free_objects
*&      Form  f4010_error_handle
FORM f4010_error_handle  USING value(ptext) TYPE c.
  IF sy-subrc NE 0.
    CALL FUNCTION 'POPUP_TO_INFORM'
      EXPORTING
        titel = text-031
        txt2  = sy-subrc
        txt1  = ptext.
  ENDIF.
ENDFORM.                    " f4010_error_handle
Reward points if this Helps.
Manish

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.

  • Moving Scroll bar in ALV?

    Hi,
    Is it possible to move scroll bar in ALV table programatically,  if i have more fields?
    Thanks,
    GS

    Hi Sathish,
    I think you can try have a workaround by using the following method of class
    CL_SALV_WD_CONFIG_TABLE~IF_SALV_WD_TABLE_SETTINGS~SET_FIRST_VISIBLE_ROW
    It takes Integer as input for Row Number to be displayed as first row. So put your coding within a button up on pressing which you want the scrolling to take place. I however haven't tried it out myself ever...
    Regards,
    Uday

  • ALV top-of-page remove scroll bar

    Hi!
    In my ALV i have a header with some information and a logo. With the logo it creates a vertical scroll bar. I can't reduce the size of the logo because it as to be that size.
    So...i've been searching for some way to remove the scroll bar from the header, butt i didn't found anything that could help me.
    I'm using 'REUSE_ALV_GRID_DISPLAY' with i_callback_top_of_page   = 'TOP-OF-PAGE'. And in form top-of-page i use
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = t_header
          i_logo             = 'LOGO'.
    to call the logo.
    Is there a way to remove or set the header to a fix size?
    Thanks in advance,
       RT

    Hi!
    In my ALV i have a header with some information and a logo. With the logo it creates a vertical scroll bar. I can't reduce the size of the logo because it as to be that size.
    So...i've been searching for some way to remove the scroll bar from the header, butt i didn't found anything that could help me.
    I'm using 'REUSE_ALV_GRID_DISPLAY' with i_callback_top_of_page   = 'TOP-OF-PAGE'. And in form top-of-page i use
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = t_header
          i_logo             = 'LOGO'.
    to call the logo.
    Is there a way to remove or set the header to a fix size?
    Thanks in advance,
       RT

  • Inserting logo into ALV TOP-OF-PAGE

    Hello friends,
                         I would like to insert a self made logo into top-of-page of ALV reports.I know the function module that is REUSE_ALV_COMMENTARY_WRITE but how to specify the link used where the image has been stored.
      Regards
      Ashish.

    Hi,
    goto se78 tcode.
    GRAPHICS->BMAP double click on bmap.
    press import button in application tool bar.
    one window will come. give the image path,some name(say ABC),description of the logo and press enter
    <b>in program</b>
    REPORT ZBHALV_LIST1.
    TABLES:MARA.
    SELECT-OPTIONS: MATNR FOR MARA-MATNR.
    DATA:BEGIN OF ITAB OCCURS 0,
         MATNR LIKE MARA-MATNR,
         ERSDA LIKE MARA-ERSDA,
         MTART LIKE MARA-MTART,
         MBRSH LIKE MARA-MBRSH,
    END OF ITAB.
    SELECT * FROM MARA INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE MATNR
    IN MATNR.
    TYPE-POOLS SLIS.
    DATA:FCAT TYPE slis_t_fieldcat_alv.
    DATA:LAYOUT TYPE slis_layout_alv.
    <b>DATA:EVE TYPE slis_t_event WITH HEADER LINE.</b>
    DATA:HEAD TYPE slis_t_listheader WITH HEADER LINE.
    DATA:SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    SORT-UP = 'X'.
    SORT-SPOS = 1.
    SORT-FIELDNAME = 'ERSDA'.
    SORT-tabname = 'MARA'.
    APPEND SORT.
    SORT-SPOS = 2.
    SORT-FIELDNAME = 'MTART'.
    SORT-tabname = 'MARA'.
    APPEND SORT.
    <b>EVE-NAME = 'TOP_OF_PAGE'.
    EVE-FORM = 'TOPOFPAGE'.
    APPEND EVE.</b>
    EVE-NAME = 'TOP_OF_LIST'.
    EVE-FORM = 'TOPOFLIST'.
    APPEND EVE.
    EVE-NAME = 'END_OF_LIST'.
    EVE-FORM = 'ENDOFLIST'.
    APPEND EVE.
    LAYOUT-ZEBRA = 'X'.
    LAYOUT-no_hline = 'X'.
    LAYOUT-NO_VLINE = 'X'.
    LAYOUT-window_titlebar = 'MATERIAL DETAILS'.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = SY-REPID
       I_INTERNAL_TABNAME           = 'ITAB'
       I_INCLNAME                   = SY-REPID
      CHANGING
        CT_FIELDCAT                  = FCAT.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM             = SY-REPID
       IS_LAYOUT                      = LAYOUT
       IT_FIELDCAT                    = FCAT
       IT_SORT                        = SORT[]
       IT_EVENTS                      = <b>EVE[]</b>
      TABLES
        T_OUTTAB                       = ITAB.
    <b>FORM TOPOFPAGE.
    REFRESH HEAD.
        HEAD-TYP = 'H'.
        HEAD-INFO = 'MATERIALS'.
        APPEND HEAD.
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
            IT_LIST_COMMENTARY       = HEAD[]
            I_LOGO                   = 'ABCD'
          I_END_OF_LIST_GRID       =
    ENDFORM.</b>
    FORM TOPOFLIST.
    REFRESH HEAD.
        HEAD-TYP = 'H'.
        HEAD-INFO = 'MATERIALS-LISTTOP'.
        APPEND HEAD.
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
            IT_LIST_COMMENTARY       = HEAD[]
          I_LOGO                   =
          I_END_OF_LIST_GRID       =
    ENDFORM.
    FORM ENDOFLIST.
    REFRESH HEAD.
        HEAD-TYP = 'H'.
        HEAD-INFO = 'MATERIALS-LISTEND'.
        APPEND HEAD.
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
            IT_LIST_COMMENTARY       = HEAD[]
          I_LOGO                   =
          I_END_OF_LIST_GRID       =
    ENDFORM.
    rgds,
    bharat.

  • 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

Maybe you are looking for