REGARDING horizontal scroller in alv grid o/p

hi,
   i have developed a report in alv grid its wrking fine..
  i want one thing >>>>in the o/p screen the plantid  is the first column, the second column is the plant name what i want is that, horizontal  scroller will work from plant name not from plantid for this what parameters sud i pass in the fieldcat for plantid.plz help me.

Hi,
U have to put for that particular plant id
wfieldcat-key = 'X'.
Thanks,
Sankar M

Similar Messages

  • Horizontal Scroll in ALV Trees

    Is it possible to have horizontal scrolling in ALV Trees ,
    If possible suggest please.

    With the current version of VC there is no horizontal scroll bar in the Flex tables possible.

  • Regarding Horizontal Scroll bar in ALV

    Hi Experts,
    I am using FM " Reuse_alv_grid_display" to dsplay the output. But defaultly it is not showing all the output in single view .I have large no of columns to show up.horizontal scroll bar is not set up defaultly.
    I would like to use CL_GUI_ALV_GRID->SET_HORIZONTAL_SCROLLBARS method
    is this is the right way to do it ? suggest best and simple way to do it.
    regards
    Vishnu

    hi,
    there was exception raised  "raise exception type cx_salv_not_found"
    i have used the fallowing code:
    cl_salv_table=>factory(
        IMPORTING
          r_salv_table = gr_table
        CHANGING
          t_table      = INT_FINAL ).
      DATA: lr_columns TYPE REF TO cl_salv_columns_table,
            lr_column  TYPE REF TO cl_salv_column_table.
      lr_columns = gr_table->get_columns( ).
      lr_columns->set_optimize( gc_true ).
          lr_column ?= lr_columns->get_column( 'SYMBOL' ).
          lr_column->set_symbol( if_salv_c_bool_sap=>true ).
          lr_column->set_long_text( 'SYMBOL' ).
      gr_table->display( ).
    Please let me know how to proceed
    regards
    vishnu

  • Regarding PF Status In ALV Grid Dispaly

    Hi..
    Can you please tell me how to set PF status in ALV Grid Display.
    Regards
    Sandeep.

    hi,
    if u use REUSE_ALV_LIST_DISPLAY copy the standard GUI-Status named STANDARD from function group SALV in your program
    if u use REUSE_ALV_GRID_DISPLAY_LVC or REUSE_ALV_GRID_DISPLAY copy the standard GUI-Status named STANDARD_FULLSCREEN from function group SLVC_FULLSCREEN in your program
    after  that you cas set the pf-status in this way:
    >CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'                   
    > EXPORTING                                               
    >    i_callback_program                = sy-cprog         
    >    i_callback_pf_status_set          = 'STATUS'
    >    i_callback_user_command           = 'USERCOMMAND'    
    >   is_layout                           = st_layout         
    >   it_fieldcat                          = st_fieldcat      
    >  TABLES                                      
    >    t_outtab                          = outtab 
    or
    >CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'              
    > EXPORTING                                              
    >    i_callback_program                = sy-cprog         
    >    i_callback_pf_status_set          = 'STATUS'  
    >    i_callback_user_command           = 'USERCOMMAND'   
    >    is_layout_lvc                     = wa_slis_layout  
    >    it_fieldcat_lvc                   = tb_slis_fieldcat
    >  TABLES                                                
    >    t_outtab                          = tb_app          
    where USERCOMMAND and STATUS are 2 forms in your program.
    >FORM status USING pfstat TYPE slis_t_extab.
    > SET PF-STATUS 'STANDARD' EXCLUDING pfstat.
    >ENDFORM.
    >
    > ...
    >
    >FORM usercommand USING okcode LIKE sy-ucomm
    >                       wa_selfield TYPE slis_selfield.
    >  CASE okcode.
    >      .... 
    >  ENDCASE
    >ENDFORM.
    Bye.
    Marco

  • Removing scroll in alv grid

    Hi all,
    Iam displaying alv grid using containers.
    It is restricting the ouput to 26 lines and giving scroll bar if i get more records,
    What we need to do for avoiding that vertical scroll bar.
    Thanks,
    Anil.
    A suggestion can make a difference.

    Hi,
    refer to the link
    Link: [removing of vertical scroll bar in table control]
    thanks
    ravi

  • Regarding column editing in alv grid

    hi experts,
    i m using alv grid display for my report layout what i want that after the output dispaly when the user will select my customized button "change the amount column" then after pressing this my amount column will become editable and user can put there new aount for this i have used this codes but it is not working plz help me to sort out this,
    for u here is my code.
    FORM DISPLAY_LIST .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = sy-cprog
          is_layout                = i_layout
          it_fieldcat              = i_fieldtab
          i_grid_title             = 'Production Incentive Details'
          I_CALLBACK_PF_STATUS_SET = 'SET_PFSTATUS'
          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
          it_events                = global_events
        TABLES
          t_outtab                 = itab_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.                    " DISPLAY_LIST
    *&      Form  SET_PFSTATUS
          text
         -->RT_EXTAB   text
    FORM SET_PFSTATUS USING rt_extab TYPE slis_t_extab..
      SET PF-STATUS 'ZPINCENTIVE' .
    EXCLUDING rt_extab..
    ENDFORM.                    " CREATE_PFSTATUS
    *&      Form  user_command
          text
         -->R_UCOMM      text
         -->RS_SELFIELD  text
    form user_command using r_ucomm like sy-ucomm
                                         rs_selfield type slis_selfield.
      case r_ucomm.
    *BREAK-POINT.
        when  '&CHANGED'.        "for change the amount button.
          read table i_fieldtab into s_fieldtab with key FIELDNAME = 'AMOUNT'.
          if sy-subrc = 0.
            move:sy-tabix to index,
                 'X' to s_fieldtab-edit.
            modify:i_fieldtab index index from s_fieldtab.
            clear:s_fieldtab.
          endif.

    solved by own

  • Horizontal Scroll on ALV last column

    Hi gurus,
    Let see I can explain my issue.
    I have an ALV with 20 fields, I have put scrolling for 5 columns, to first two ones are frozen. I have set 150px as width for each column. Scrolling is working fine but when I reach the final scroll I can't see the LAST COLUMN (FIELD20), I mean, the column doesn't have the proper width (150px), for the rest columns the width is appearing properly.
    I copy my source code and a image link to more details:
      DATA lo_column TYPE REF TO cl_salv_wd_column.
      lo_column = lo_value->if_salv_wd_column_settings~get_column( 'FIELD' ).
      lo_column->set_fixed_position( cl_wd_abstr_table_column=>e_fixed_position-left ).
      lo_column = lo_value->if_salv_wd_column_settings~get_column( 'FIELD_OCULTO' ).
      lo_column->set_fixed_position( cl_wd_abstr_table_column=>e_fixed_position-left ).
      DATA: lt_columns TYPE salv_wd_t_column_ref,
            ls_column  TYPE salv_wd_s_column_ref.
      CALL METHOD lo_value->if_salv_wd_column_settings~get_columns
        RECEIVING
          value = lt_columns.
      LOOP AT lt_columns INTO ls_column.
        lo_column = lo_value->if_salv_wd_column_settings~get_column( ls_column-id ).
        lo_column->set_width( '150PX' ).
      ENDLOOP.
      lo_value->if_salv_wd_table_settings~set_fixed_table_layout( abap_true ).
    * Cantidad de columnas que ocupan el scroll.
      CALL METHOD lo_value->if_salv_wd_table_settings~set_first_visible_scroll_col
        EXPORTING
          value  = 'FIELD'.
      lo_value->if_salv_wd_table_settings~set_scrollable_col_count( 5 ).
    [http://imageshack.us/photo/my-images/836/abap.jpg/]
    Any idea?
    Regards

    Hi,
    Try adding this:
    DATA l_table TYPE REF TO cl_salv_wd_config_table.
    l_table->if_salv_wd_table_settings~set_fixed_table_layout( abap_true ).
    In case this doesn't help, does the problem remain when you try changing the column width to, let's say, 75PX?
    Cheers, Lukas

  • Regarding layout in the alv grid report

    hi gurus,
    i  have created a ALV report in which the output is coming allrt having 13 fields.now i have saved my layout depending upon some columns in the output name "AVI layout" containg 3 fileds.
    when ever i execute the report the layout having 13 fields is coming what i want that whenever i execute the report the  layout which i saved means "AVI layout" will come automatically.
    please help me................

    Hi,
    You use in your fieldcatlog NO_OUT option for all fields except those 3 fields which u want display when the report executes...
    fieldcatlog-no_out = 'X'.
    In out put when ever they want to see other fields they can select in output itself and display them....

  • Alv grid error

    hi all,
    I have simple issue in alv grid,
    I have designed an alv grid, by default it has scroll bars.
    when i scroll the alv grid, the last executed status message (ie in pai) is executed on every page and the message shows in
    the status bar on every scroll...
    how can i avoid this .
    thanks and regards
    Jose

    Hi Jijo,
               Declare a flag variable ..
    DATA: GV_FLAG TYPE C.
    then put this folowing pseudo code and it will work..
    IF GV_FLAG IS INITAL.
    MESSAGE 'XSYZ'.
    GV_FLAG = 'X'.
    ENDIF.
    Then what it will do is the status message when it is displayed for first time the Flag is set to ''X' and as the flag is set once the code will not execute again to show the message.
    Regards,
    Raghav

  • Exporting ALV Grid output to Excel sheet

    Hi All,
           How can i export the output displayed using Grid to an Excel sheet. I tried with default option from list->export->excel sheet/local file but i am not getting complete data and the data which i am getting also notin proper format. Please help me in this regard.
    Best Regards,
    Sunil

    Check out the ALV grid toolbar for export options.
    Regards
    Raja

  • Change Layout in Selection Screen for OO ALV-Grid

    Hello everyone,
    I got a problem regarding layouts for objectoriented ALV Grid. I want to make it possible that user can take the layout for ALV he wants to on the selection screen. So far thats no problem and it works. But there are some little problems which I do not know how to fix them. But first the facts:
    (1) I got my parameter for layout
    PARAMETER: p_vari  TYPE disvariant-variant.
    (2) I fill my global layout structure in initialization
    INITIALIZATION.
    * Variante vorbelegen
       gs_variant-username = sy-uname.
       gs_variant-report   = sy-repid.
    * Layout holen
       CALL FUNCTION 'LVC_VARIANT_DEFAULT_GET'
         EXPORTING
           i_save        = 'A'
         CHANGING
           cs_variant    = gs_variant
         EXCEPTIONS
           wrong_input   = 1
           not_found     = 2
           program_error = 3
           OTHERS        = 4.
       IF sy-subrc = 0.
         p_vari = gs_variant-variant.
       ENDIF.
    (3) I got my handling for F4-value help on variant parameter
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
       CALL FUNCTION 'LVC_VARIANT_F4'
         EXPORTING
           is_variant    = gs_variant
           i_save        = 'A'
         IMPORTING
           es_variant    = gs_variant
         EXCEPTIONS
           not_found     = 1
           program_error = 2
           OTHERS        = 3.
       IF sy-subrc <> 0.
         MESSAGE text-m01 TYPE 'S'.
       ELSE.
         p_vari = gs_variant-variant.
       ENDIF.
    (4) I give back my parameters content into the variant structure at start of selection
    START-OF-SELECTION.
       gs_variant-username = sy-uname.
       gs_variant-report   = sy-repid.
       gs_variant-variant  = p_vari.
    This works all fine but I got some problems when using default variants/layouts. For example I got a default variant only for me. When starting the selection screen it works fine that the default layout was written. It is displayed automatically in the variant parameter. But I want that if i I empty the content (blank it out) from my variant parameter, that report should start with "normal" layout how it was written in the report and NOT with default layout.
    When I clear the gs_variant it works like I want it, but then the alv layout button looks like (without functions for layout), because I do not have the reference to my report.
    So what to do? :-)
    Regards
    Michael

    Wow that was fast, works great, thanks :-)
    I did not use this parameter in set table method but now I fill it dynamically.
    Ok next problem, one step harder ;-)
    Now I have one selection screen for one ALV-Grid, but four radio buttons which control with which data the ALV gets filled (four different fieldcats, data tables and so on). Each Grid got an own HANDLE so that the layouts can be separated in four categories.
    Now I want that by changing the radio button the individual standard layout for the chosen alv grid is getting filled.
    This works fine when using it in selection screen output.
    AT SELECTION-SCREEN OUTPUT.
       CLEAR gs_variant.
    * Layout-Handles individuell für Klausel-Radiobuttons setzen
       IF     p_py IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLPY'.
       ELSEIF p_rh IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLRH'.
       ELSEIF p_aj IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLAJ'.
       ELSEIF p_sr IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLSR'.
       ENDIF.
    * Layout holen
       CALL FUNCTION 'LVC_VARIANT_DEFAULT_GET'
         EXPORTING
           i_save        = 'A'
         CHANGING
           cs_variant    = gs_variant
         EXCEPTIONS
           wrong_input   = 1
           not_found     = 2
           program_error = 3
           OTHERS        = 4.
       IF sy-subrc = 0.
         p_vari = gs_variant-variant.
       ELSE.
         CLEAR p_vari.
       ENDIF.
    But unfortunately selection screen output is getting passed by EACH changing in the selection screen. This means when I try to clear the default layout in my parameter field, it gets refilled automatically with default layout. If I do a condition around the filling (only if not initial) the default value filling does not work fine in every case, e.g. when clearing the parameters field and then change the radiobutton -> then it does not get filled automatically.

  • ALV GRID Using oo abap example

    Hi Friends,
    I am new to oo abap, Can any one give me a basic example how i can create alv grid in oo abap.
    regards,
    DVNS

    HI,
    Programming for ALV grid display using the classes involves  creation of a screen and calling it for display.
    Since there has to be a linking between the program and the screen we have created , this comes in the form of a container. We use two important classes during the programming for displaying ALV grid, CL_GUI_ALV_GRID and CL_GUI_CUSTOM_CONTAINER.
    Steps To Use ALV Grid in a Program
    1. Declare reference variables for,
           Container (class CL_GUI_CUSTOM_CONTAINER) and
           Grid (class CL_GUI_ALV_GRID)
    Example
    DATA: grid  TYPE REF TO cl_gui_alv_grid,
                custom_container  TYPE REF TO cl_gui_custom_container
    2. Create Standard Screen and a container on that screen  and give a name to that container ( Use custom control button from tool bar) . This name will be used to link the container we have created on the screen with the object reference of class CL_GUI_CUSTOM_CONTAINER, which we have declared in the first step
    3. Call the screen which has been created
    4. Instantiate the container control and the ALV Grid Control in PBO of the screen.
    Example
    IF custom_container IS INITIAL.
      CREATE OBJECT custom_container
             EXPORTING
            CONTAINER_NAME = ‘MY_CONTAINER'.
    CREATE OBJECT grid
           EXPORTING
           I_PARENT = custom_container.
    ENDIF
    5. For displaying the data, call the method set_table_for_first_display of object reference of CL_GUI_ALV_GRID.
    Example
    CALL METHOD grid->set_table_for_first_display
    EXPORTING
    I_BUFFER_ACTIVE               =
    I_BYPASSING_BUFFER            =
    I_CONSISTENCY_CHECK           =
    I_STRUCTURE_NAME              =
    IS_VARIANT                    =
    I_SAVE                        =
    I_DEFAULT                     =
    IS_LAYOUT                     =
    IS_PRINT                      =
    IT_SPECIAL_GROUPS             =
    IT_TOOLBAR_EXCLUDING          =
    IT_HYPERLINK                  =
    IT_ALV_GRAPHICS               =
    IT_EXCEPT_QINFO               =
    CHANGING
    IT_OUTTAB                     =
    IT_FIELDCATALOG               =
    IT_SORT                       =
    IT_FILTER                     =
    EXCEPTION
    INVALID_PARAMETER_COMBINATION =
    PROGRAM_ERROR                 =
    TOO_MANY_LINES                =
    others                        =
    EXPLANATION OF SOME IMPORTANT PARAMETERS.
    I_BYPASSING_BUFFER & I_BUFFER_ACTIVE :
    When the program is run for the first time, the fields present in the output table and their positions are stored in a buffer.  So the buffer is taken as reference for the successive executions.  In order to bypass this buffer the above parameter values should be ‘X’ and  ‘ ‘(space)  respectively. If these values are not passed  to the function module, the changes made in the structure of the internal table will not be reflected in the output.
    I_STRUCTURE_NAME:
    If the structure of your output table corresponds to a structure stored in the Data Dictionary (DDIC), the ALV Grid Control can use this information to generate the field catalog automatically. Pass the table structure as parameter. In this case, all fields of this DDIC structure are displayed in the list.
    IS_VARIANT :
    It allows the user to save and reuse the layout. It is a structure of type DISVARIANT and contain the display variant name. It  facilitates pre-assignment for a layout, rather than displaying report and then choosing displaying variant.
    I_SAVE:
    This single character variable specifies whether the user specific display variants can be saved or not.
    The I_SAVE "Options for saving layouts" parameter can have the following values:
    U Only user specific layouts can be saved
    X Only global layouts can be saved
    A Both user specific and global layouts can be saved
    Space Layouts can not be saved
    IS_LAYOUT:
    This structure of type LVC_S_LAYO
    is used to control the layout of the ALV.  Two important fields are:
    GRID TITLE. : Title of grid
    ZEBRA : Alternate lines in list are displayed in different colors.
    IT_FIELDCATALOG:
    This internal table of type LVC_T_FCAT
    is used to specify the position of various fields in the report itab.
    There are three ways we can fill the field catalog table
    1. Automatically through data dictionary structure (DDIC). In this case we pass the table structure to I_STRUCTURE_NAME.
    2. Manually in ABAP program. Filling the internal table of type LVC_T_FCAT
    1.                  . With each row corresponding to each column of output table. Each row of this table will hold value like
    i). TABNAME & FIELDNAME specifies the reference fields for F1 help
    ii). CTABNAME & CFIELDNAME specifies the reference fields for currency formatting
    iii). QTABNAME & QFIELDNAME specifies the reference fields for quantity formatting
    iv). SELTEXT_L holds the long description of the field
    v).  SELTEXT_M holds the medium description of the field
    vi). SELTEXT_S holds the small description of the field
    vii). KEY specifies the Key field ( cannot be hidden )
    viii). OUTPUTLEN species the output length of the field
    ix). DO_SUM specifies that subtotal is required on this field
    x). NO_OUT specifies a hidden field
    3.  Semi-Automatically by combining the above 2 procedures.
    Call function Module REUSE_ALV_FIELDCATALOG_MERGE and pass DDIC
    structure or the output table to generate the field catalog.
    Add additional Rows or modify existing properties of the fields to be displayed.
    METHODS OF IMPLEMENTING SOME EXTRA FEATURES
    Set focus to the grid
    After CALL METHODgrid->set_table_for_first_display insert the following stament:
    CALL METHOD cl_gui_control=>set_focus EXPORTING control = grid
    Refresh grid display
    Use the grid method REFRESH_TABLE_DISPLAY
    Example:
    CALL METHOD grid->refresh_table_display.
    Set the title of the grid
    Fill the grid_title field of structure lvc_s_layo.
    DATA:
    gs_layout TYPE lvc_s_layo.
    gs_layout-grid_title = 'TITLE'.
    CALL METHOD go_grid->set_table_for_first_display
    EXPORTING i_structure_name = 'structure name'
    is_layout               = gs_layout
    CHANGING   it_outtab               = Output table.
    The structure lvc_s_layo contains fields for setting graphical properties, displaying exceptions, calculating totals and enabling specific interaction options
    Event Handling
    We can handle the events triggered by
    1. User defined Text Output
    2. Mouse-controlled Actions
    3. Self-defined and Standard Functions
    Steps for Event Handling
    1. Define a (local) class for event handling
    2. Define a method for each event you need to handle
    3. Implement your event handler methods.
    4. Create Object of the above class
    5. Link used events and event handler methods of the  receiver object and the grid
    object.
    Example program : Handling “Double Click” Event
    Step1.Define a class.
    class lcl_my_event_receiver definition.
    public section.
    methods:
    handle_double_click
    for event double_click of cl_gui_alv_grid.
    endclass.
    Step 2. Implement the class
    class lcl_my_event_receiver implementation.
    method handle_double_click.
    message i001(zz) with ' double click event - Triggerd '.
    endmethod.
    endclass.
    Step 3. Declare and create Object for the local class defined and implemented in steps 1 and 2 respectively
    o_receiver   TYPE REF TO lcl_my_event_receiver   (Declaration)
    create object o_receiver.                                            (Instantiation)
    Step 4. Link the method for handling the event with the grid object in the PBO of screen after instantiating the grid object
    set handler o_receiver->handle_double_click for grid.
    EXAMPLE PROGRAM TO CHANGE A CLASSICAL REPORT OUTPUT TO A ALV GRID
    This can be used as a template program to convert a classical report layout to a ALV grid.
    Report<Report name>
    Grid data Declarations----------------------------------------------*
      INCLUDE ZVINALVD.
    Internal table for ALV grid
    TYPES: BEGIN OF T_ALV,
             Field1 like table-field1,
             Field2 like table-field2,
           END OF T_ALV.
    DATA: I_ALV  TYPE TABLE OF T_ALV.
    DATA: WA_ALV TYPE T_ALV.
    -Class declarations----
      INCLUDE ZVINALVE.
    Add a checkbox in selection screen for ALV grid display. If it is unchecked
    output will be of classical type.
    SELECTION-SCREEN BEGIN OF BLOCK box01.
    SELECTION-SCREEN: BEGIN OF LINE.                           
    SELECTION-SCREEN: COMMENT 4(30) ‘To display repot output as a ALV grid’.                  
    PARAMETERS: p_alv AS CHECKBOX.                             
    SELECTION-SCREEN: END OF LINE.                             
    SELECTION-SCREEN END OF BLOCK box01.
    START-OF-SELECTION.
    Fill the ALV grid internal table
    END-OF-SELECTION.
    IF P_ALV = ‘X’.
      PERFORM ALV_DISPLAY.
    ELSE.
      PERFORM CLASSICAL_DISPLAY.
    ENDIF.
    Alv Display
    FORM ALV_DISPLAY.
      CALL SCREEN 100.
    ENDFORM.
    Module  STATUS_0100  OUTPUT
    PBO for ALV Grid
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'GRID_DISPLAY'.
      DATA:
    For parameter IS_VARIANT that is used to set up options for storing
    the grid layout as a variant in method set_table_for_first_display
      l_layout TYPE disvariant.
      GS_LAYOUT-SEL_MODE = 'B'.
    Optimize column width
      GS_LAYOUT-CWIDTH_OPT = 'X'.
    Read data and create objects
      IF go_custom_container IS INITIAL.
    Create objects for container and ALV grid
        CREATE OBJECT go_custom_container
          EXPORTING container_name = 'ALV_CONTAINER'.
        CREATE OBJECT go_grid
          EXPORTING i_parent = go_custom_container.
    Create object for event_receiver class
    and set handlers
        CREATE OBJECT o_event_receiver.
        SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
        SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
    Layout (Variant) for ALV grid
        l_layout-report = sy-repid. "Layout to report
    To built fieldcatalog
        PERFORM alv_build_fieldcatalog.
    Grid setup for first display
        CALL METHOD go_grid->set_table_for_first_display
          EXPORTING
                    is_variant      = l_layout
                    i_save          = 'A'
                    is_layout       = gs_layout
          CHANGING  it_outtab       = I_ALV
                    it_fieldcatalog = fieldcat.
    Raise event toolbar to show the modified toolbar
        CALL METHOD go_grid->set_toolbar_interactive.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    Form ALV_BUILD_FIELDCATALOG.
    Store contents of selected line in a internal table
    FORM alv_build_fieldcatalog.
      CLEAR afield.
      afield-fieldname = 'FIELD1'.
      afield-tabname   = 'I_ALV'.
      afield-coltext   = ‘Field Name 1’.
      afield-lzero     = ' '.
      afield-key       = 'X'.
      afield-outputlen =  XX.
      APPEND afield TO fieldcat.
      CLEAR afield.
      afield-fieldname = 'FIELD2'.
      afield-tabname   = 'I_ALV'.
      afield-coltext   = ‘Field Name 2’.
      APPEND afield TO fieldcat.
    ENDFORM.                    " alv_build_fieldcatalog
    Module  USER_COMMAND_0100  INPUT
    PAI for ALV Grid
    MODULE USER_COMMAND_0100 INPUT.
      CASE OK_100.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Form  SELECT_LINE
    Store contents of selected line in a internal table
    FORM SELECT_LINE.
      DATA:l_lines TYPE i.
      REFRESH gi_index_rows.
      CLEAR   g_selected_row.
    Read index of selected rows
      CALL METHOD go_grid->get_selected_rows
        IMPORTING et_index_rows = gi_index_rows.
    Check if any row are selected at all. If not
    table  gi_index_rows will be empty
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      IF l_lines = 0.
        CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
             EXPORTING
                  textline1 = 'You must choose a line'.
        EXIT.
      ENDIF.
    Read indexes of selected rows.
      LOOP AT gi_index_rows INTO g_selected_row.
        IF sy-tabix = 1.
          READ TABLE I_ALV INDEX g_selected_row-index INTO
                         WA_ALV.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " SELECT_LINE
    Includes:
    1. ZVINALVD for data declarations
    INCLUDE ZVINALVD .
    Type pool for icons - used in the toolbar
    TYPE-POOLS: icon.
    To allow the declaration of o_event_receiver before the
    lcl_event_receiver class is defined, decale it as deferred in the
    start of the program
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    GLOBAL DATA FOR ALV GRID
    DATA:
    OK code for alv grid screen
      OK_100(4)           TYPE C,
    ALV control: Layout structure
      gs_layout           TYPE   lvc_s_layo,
    Declare reference variables to the ALV grid and the container
      go_grid             TYPE REF TO cl_gui_alv_grid,
      go_custom_container TYPE REF TO cl_gui_custom_container,
      o_event_receiver    TYPE REF TO lcl_event_receiver,
    Data for storing information about selected rows in the grid
    Internal table
      gi_index_rows       TYPE lvc_t_row,
    Information about 1 row
      g_selected_row      LIKE lvc_s_row.
    fieldcatalog
    DATA: fieldcat        TYPE LVC_T_FCAT,
          afield          TYPE LVC_S_FCAT.
    2. ZVINALVE for Class/object declarations
    INCLUDE ZVINALVE.
    C L A S S E S
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
          handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
            IMPORTING e_object e_interactive,
          handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
            IMPORTING e_ucomm.
    ENDCLASS.
    CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_toolbar.
    Event handler method for event toolbar.
        CONSTANTS:
    Constants for button type
            c_button_normal           TYPE i VALUE 0,
            c_menu_and_default_button TYPE i VALUE 1,
            c_menu                    TYPE i VALUE 2,
            c_separator               TYPE i VALUE 3,
            c_radio_button            TYPE i VALUE 4,
            c_checkbox                TYPE i VALUE 5,
            c_menu_entry              TYPE i VALUE 6.
        DATA: ls_toolbar              TYPE stb_button.
    Append seperator to the normal toolbar
        CLEAR ls_toolbar.
        MOVE c_separator TO ls_toolbar-butn_type..
        APPEND ls_toolbar TO e_object->mt_toolbar.
    Append a new button that to the toolbar. Use E_OBJECT of
    event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.
    This class has one attribute MT_TOOLBAR which is of table type
    TTB_BUTTON. The structure is STB_BUTTON
        CLEAR ls_toolbar.
        MOVE 'DISPLAY'        TO ls_toolbar-function.
        MOVE  icon_DISPLAY    TO ls_toolbar-icon.
        MOVE 'Displaying customer' TO ls_toolbar-quickinfo.
        MOVE 'Display'        TO ls_toolbar-text.
        MOVE ' '             TO ls_toolbar-disabled.
        APPEND ls_toolbar    TO e_object->mt_toolbar.
      ENDMETHOD.
      METHOD handle_user_command.
    Handle own functions defined in the toolbar
        CASE e_ucomm.
          WHEN 'DISPLAY'.
            PERFORM SELECT_LINE.
        ENDCASE.
    ENDMETHOD.
    Reward if useful

  • Setting ALV grid Graphic properties from program

    Hi all,
    Could any one tell me how to set the properties of the histogram generated by ALV output from program.
    I want to display the value on top of the bar, by setting this property from program.
    Manually i can do this by selecting the graph icon from the alv toolbar, and in the graph, right-click the bar, and from the context menu, select 'format data series', then choose 'Data labels' tab and then select 'Show value'.
    Thanks in advance.
    regards,
    Anup

    Hi Anup
    Yes, ALV Grid uses GFW for the graphics. However, it encapsulates the graphic object and let's your intervention to some extent. To do so, you can use the parameter at the interface of the method "<b>set_table_for_first_display</b>". Here is the information about the parameter:
    <u><b>IT_ALV_GRAPHICS</b></u>
    <i> Settings for displaying the ALV list as a diagram (for example, axis labels). The row type of the table has two fields (variables/value pairs):
    PROP_ID : Assign a constant attribute of the class CL_ALV_GRAPHICS_CU with prefix CO_PROPID_ to this field to determine the changes to be made to the graphic. Use the CL_ALV_GRAPHICS_CU=>CO_PROPID_TITLE attribute, for example, to refer to the title of the diagram.
    PROP_VAL : The value of the relevant topic, for example, 'My Title'.</i>
    You can also find <b>GFW</b> programs as "<b>GFW_DEMO_*</b>". If you want, you can prepare your own graphics and override the standard graphics function of the ALV Grid or add your own graphics functionality. For these you can refer to <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an%20easy%20reference%20for%20alv%20grid%20control.pdf">"An Easy Reference for ALV Grid Control"</a>.
    Kind regards...
    *--Serdar

  • Capture Changes on ALV Grid Display

    Hi,
    I am displaying a check box on ALV Grid Display. I have to provide a push button on the application tool bar through which i have to perform some other action. How can i capture the changes made to that check box?
    I am using the FM 'REUSE_ALV_GRID_DISPLAY'.
    Thanks in Advance.
    Best Regards,
    Phani
    Message was edited by:
            Sivapuram Phani Kumar

    Hi Amit,
    Solved the problem... Thank you very much.
    Yesterday i have raised one more thread regarding an issue with ALV Grid... Can u please check and help me out. Here is the link for that issue...
    Issue with ALV Display
    Regards,
    Phani

  • Possible to have vertical scroll bar for a cell in ALV Grid (using methods)

    Hi All,
    I have a field with length 100 characters on a ALV Grid (using methods)..User doesn't want to scroll all the 100 characters horizontally to see the whole text rather he wants to have a vertical scroll bar for the cell so that he can scroll vertically.
    Is it possible to have split the cell text into lines and have a vertical scroll bar for a cell in ALV Grid?
    Regards
    Jaker.

    Thanks for the suggestion Balu.I tried this , but while scrolling,headers also getting scrolled.
    Becoz of this , if i scroll down to the last row,headers are getting hidden.
    Headers should always be static.only the data should scroll.
    Since h:datatable is being rendered as one table , i can div tag for this table alone.
    If i have seperate datatable for headers alone i can do this .But i should not use two datatables.

Maybe you are looking for