Alv Grid method get_grid_modified

Hi,
Method get_grid_modified is returning true after  making  any changes in Grid.
Please help me to make it working.
Regards,
Venkat

Hi,
Use sy-subrc to check and then debug.The function module seems to be not associated with want actually you want to ahcive .could you ellaborate your problem more ?

Similar Messages

  • ALV Grid: method double_click provides wrong information with 'totals line'

    Hi together,
    I´m using 'method double_click' with an ALV grid...like:
    CLASS lcl_events IMPLEMENTATION.
      METHOD double_click.
        READ TABLE it_outtab INDEX e_row-index INTO s_datatab.
    Everything works perfect as long as I don´t use totals with it.
    Using totals /subtotals lines 'READ TABLE...' provides a wrong row-index.
    Any idea how to resolve this problem?
    Thanks for any help

    Hi, this is a big problem when you use OO to build an ALV, to resolve your problem, you have to implement an event TOOLBAR_BUTTON_CLICK to get button function, when your code pass by this method you have to use the method
    CALL METHOD gcl_grid->set_function_code
        CHANGING
            c_ucomm = l_ucomm.
    l_ucomm is the function code of button, the method set_function_code sort your internal table dynamically and you get the correct index when you use double_click.
    Regards.
    David Carballido
    PD: Sry for my bad english ^^

  • Alv grid / method cl_alv_changed_data_protocol-add_protocol_entry

    I used the demo program BCALV_GRID_EDIT to implement my editable grid and now I got stuck in the
    method data_changed, where I do that loop:
    LOOP AT rr_data_changed->mt_good_cells INTO ls_mod_cells.
    where I check, get the values and modify the cells.
    If something is wrong, I call the alv error protocol like this:
              CALL METHOD rr_data_changed->add_protocol_entry
                EXPORTING
                  i_msgid     = '0K'
                  i_msgno     = '000'
                  i_msgty     = 'E'
                  i_msgv1     = text-004 "Buchungskreis
                  i_msgv2     = l_rbukrs
                  i_msgv3     = text-006 "exisitiert nicht
                  i_fieldname = ls_mod_cells-fieldname
                  i_row_id    = ls_mod_cells-row_id.
    The right wrong value is highlighted in red, the message is displayed, everything works fine until I change the value back to normal.
    Then I get a run time error TSV_TNEW_PAGE_ALLOC_FAILED because MT_GOOD_CELLS couldn't be expanded.
    It happened in class CL_ALV_CHANGED_DATA_PROTOCOL, in method MODIFY_STYLE in line 41.
    append ls_modi to mt_good_cells.
    I already tried to debug that method, to see what went wrong, but the debugger doesn't work any more at this point.
    I guess I use the method wrong.
    Does it has got something to do with
    cl_gui_control=>www_active which is not active in my test? (p_loce in BCALV_GRID_EDIT)
    I tried already many things with refresh_protocol and protocol_is_visible but the problem does not change.
    Any suggestions? Should I simply choose to a message_list class and do the highlighting manually?

    My problem is solved, because the method modify_style was the reason for the run time error.
    I called for one special field in the loop at mt_good_cells the method modify style
    which tried to append a line to it.
    append ls_modi to mt_good_cells.
    in a loop to change the internal table the loop is based on isn't a good idea.
    So the memory ran out and the system hang up when the memory size for the table was overrun.
    Thanks for listening, the problem is solved.

  • ALV GRID -- METHOD set_selected_cells

    Dear all.
    I have a program with ALV_GRID  in which, with event DBL_CLICK in one cell, I show data with function REUSE_ALV_POPUP_TO_SELECT to select the data with the objective fill this cell only with data I suggest in it.
    But I don't know, when I use this method  set_selected_cells , don't save the value data..., and in ALV don't show the change...
    What happen??... Why don't save this method the value???
    Before I execute Method SET ..., I execute Method GET... and the value of cell it's null... don't save the data.
    Can you help me??
    I put my code in resume...
    FORM f_handle_double_click1  USING p_row    TYPE lvc_s_row
                                                             p_column TYPE lvc_s_col.
      DATA: it_cells TYPE lvc_t_cell,
                 wa_cells TYPE lvc_s_cell.
    *Read the line of the internal table of the ALV
      READ TABLE i_datos INDEX p_row-index.
      IF sy-subrc = 0.
      CASE p_column-fieldname.
        WHEN 'COD_MODELO_AFIS'.
    *POP UP with data to select .
          CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
            EXPORTING
              i_selection          = 'X'
              i_zebra              = 'X'
              it_fieldcat          = lt_fieldcat
              i_tabname            = 'TB_MODELOS'
              i_checkbox_fieldname = 'CHECKBOX'
              is_private           = ls_private
            IMPORTING
              e_exit               = l_exit
            TABLES
              t_outtab             = tb_modelos.
          CHECK l_exit = space.
          READ TABLE tb_modelos WITH KEY checkbox = 'X'.
          wa_cells-col_id = p_column.
          wa_cells-row_id = p_row.
          wa_cells-value = tb_modelos-nom_modelo_afis.
          APPEND wa_cells TO it_cells.
    *Save the data in cell
          CALL METHOD g_grid1->set_selected_cells
            EXPORTING
              it_cells = it_cells.
          REFRESH it_cells.    .
    *Verify if the data have been saved
          CALL METHOD g_grid1->get_selected_cells
            IMPORTING
              et_cell = it_cells.
      ENDCASE.
    ENDFORM.                    " F_HANDLE_DOUBLE_CLICK1

    -

  • Display listbox key value in ALV GRID method

    Hi All,
    I have a program in which columns are generted dynamically based on number of fields. The column name is dynamic as it depends on its text while The value in Column's can be 1, 2, 3, 4, 5.
    I am trying to display this in a list box along with the text which are maintained as fixed values at domain level.
    space Walking
    1       Archery   
    2       Boxing
    3       Cycling
    4       Rowing
    Also I am displaying by using 'DD_DOMVALUEs_GET, looping through all the fixed values and concatenate
    domvalue_l   ddtext separated by cl_abap_char_utilities=>horizontal_tab. No tab space is coming between key and value.
    Also for the 1st value which is space it is not coming properly as space is condensed.
    The point is that after I am putting values in the grid. The system event data changed is called where the value selected is  1 Archery and it is going to bad cells, error protocol display . I want only the 1st character. How to modify the content in the grid before the system event gets called.
    Regards,
    DPM

    Hi,
    try follow code to setup fieldcat of that DROP DOWN field.
    FCAT-DOMNAME = ' '.
    FCAT-CHECKTABLE= '!'.

  • Control of ALV Grid displayed on 2 screens

    Hi all,
    I'm working on a program that does the following:
    1. Select option screen is displayed for user to query DB table.
    2. Query results are stored in an internal table and displayed on second program screen within an ALV grid. Some columns in this grid are editable.
    3. User edits columns in grid and selects rows to process. When the user pesses a button the data is processed and a third screen is displayed containing the selected and processed rows...again within an ALV grid.
    All works well with one exception...I use one container and one grid to display the data on both screens. If I navigate to the second screen and then try to return from the second screen to the select option screen by pressing the BACK button all is good in the world...I go back. If I am on the third screen and I try to return to the second screen, again all is good, I return to the second screen. The problem is when I try to go back one more screen. It seems it takes me 3 clicks to get back to the select option screen at this point. Any ideas folks?

    Hi Ankur,
    Let me give some more detail.
    1. Each screen has a custom container embedded within it. I have defined one container handle and one alv grid handle in my program. I use a call to the custom container method link to point my container handle to the correct screen.
    2. I call alv grid method set_table_for_first_display only...no call to refresh_table_display...as I insert a different table and layout in the grid on each screen.
    3. I call flush after each call to set_table_for_first_display
    4. Following are my pai events:
    MODULE user_command_9000 INPUT.
      save_okcode = okcode.
      CLEAR okcode.
      CASE sy-dynnr.
        WHEN 9000.
          CASE save_okcode.
            WHEN 'CONVERT'.
              PERFORM convert_orders.
              CALL SCREEN 9100.
              LEAVE SCREEN.
            WHEN 'BACK'.
              SET SCREEN 0.
              LEAVE SCREEN.
            WHEN 'CANCEL'.
              SET SCREEN 0.
              LEAVE SCREEN.
            WHEN 'EXIT'.
              PERFORM free_objects.
              LEAVE PROGRAM.
          ENDCASE.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_9000  INPUT
    MODULE user_command_9100 INPUT.
      save_okcode = okcode.
      CLEAR okcode.
      CASE sy-dynnr.
        WHEN 9100.
          CASE save_okcode.
            WHEN 'BACK'.
              SET SCREEN 9000.
              LEAVE SCREEN.
            WHEN 'CANCEL'.
              SET SCREEN 9000.
              LEAVE SCREEN.
            WHEN 'EXIT'.
              PERFORM free_objects.
              LEAVE PROGRAM.
          ENDCASE.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_9100  INPUT
    Again...the trouble is navigating from screen 9000 to 0 after I have already navigated from screen 9100 back to screen 9000 via the back button.  If I am on screen 9000 and click the bakckbutton I end up on screen 9100 again. If I click the back button 2 more times, now, I end up back at the selection screen. Thanks.

  • How to validate the columns in dynamic alv grid

    Hi Friends,
    I want to validatethe value of all the columens (min 1 and max 40) which i create dynamically in alv grid.
    value must be between 0 and 1 only.
    Please help ,, need urgently.

    method handle_data_changed.
         data: ls_good type lvc_s_modi,
               li_diff type i,
               value type p DECIMALS 3,
               old_value type p DECIMALS 3,
               lw_outtab1 type gt_tab.
    clear value.
           loop at er_data_changed->mt_good_cells into ls_good.
           value = ls_good-value.
           old_value = ls_good-value.
            if value lt 0 or value gt 1.
               MESSAGE 'Value is out of range' TYPE 'I'.
              Read table gt_outtab1 into lw_outtab1 index ls_good-row_id .
               perform show_alv.
               clear ls_good.
            ENDIF.
          ENDCASE.
           ENDLOOP.
    I again created the table.. actually data is not changed in the internal table but still it shows the changed value in the alv grid. even in build the table again and call the refersh alv grid method..

  • Alv grid with data

    hey,
    alv grid method for export data from alv grid  to itab.
    regards,
    purna

    Hey,
    Any methods for exporting  alv grid data into itab.

  • Dynamic Columns in ALV GRID

    Hi Folks,
    can any body please give some input on the follwoing.
    i want to display material created by and material
    created on for each material based on material selection
    from selction screen dynamically.
    like s_mat = 1, 2,3.
    o/p must be
    mat1 |creted by | creted on| mat2 |creted by | creted on|mat3 |creted by | creted on|
    like if iam inputting 3 materials i need 3*3 = 9 columns in my alv grid o/p.
    I have alreaady searched SDN  I am not gettting any thing related to my requirement, please post some sample caode as I am new ot OOABAP.
    Thanks,
    Shwetha.
    Moderator message : Not enough re-search before posting, specification dumping not allowed.  Thread locked.
    Edited by: Vinod Kumar on Nov 24, 2011 1:31 PM

    method handle_data_changed.
         data: ls_good type lvc_s_modi,
               li_diff type i,
               value type p DECIMALS 3,
               old_value type p DECIMALS 3,
               lw_outtab1 type gt_tab.
    clear value.
           loop at er_data_changed->mt_good_cells into ls_good.
           value = ls_good-value.
           old_value = ls_good-value.
            if value lt 0 or value gt 1.
               MESSAGE 'Value is out of range' TYPE 'I'.
              Read table gt_outtab1 into lw_outtab1 index ls_good-row_id .
               perform show_alv.
               clear ls_good.
            ENDIF.
          ENDCASE.
           ENDLOOP.
    I again created the table.. actually data is not changed in the internal table but still it shows the changed value in the alv grid. even in build the table again and call the refersh alv grid method..

  • Multiple Selection in ALV grid

    HI All,
    I am displaying output using ALV grid method. On screen i am selecting multiple rows & based on selection i want process further. How can i determine whcih rows user has selected ?
    Regards,
    Rahul

    Hi,
    In IT_FIELDCAT you can pass one field with attributes of check box.
    for example.
    Declare:
    DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    FIELDCAT_LN LIKE LINE OF GT_FIELDCAT.
    Pass the below values.
    FIELDCAT_LN-FIELDNAME = 'CHECK'.
    FIELDCAT_LN-TABNAME = 'ITAB1'.
    FIELDCAT_LN-KEY = ' '. "SUBTOTAL KEY
    FIELDCAT_LN-NO_OUT = ' '.
    FIELDCAT_LN-SELTEXT_L = 'Check Box'.
    FIELDCAT_LN-CHECK-BOX = 'X'.
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    <b>rEWARD IF USEFULL</b>

  • Check_changed_data method on editable ALV Grid ( class cl_gui_alv_grid)

    Hi guys,
    I use the following method (register_edit_event) in the PBO soon after first display of an editable ALV grid to register enter as an event to do validations on fields like qty. If user enters some character like 'abc' for qty and hits enter on keyboard, ALV grid pop's up a standard message ( I haven't coded for this.Since I use DDIC structure in field catalog, the Std. ALV program takes care of it. ). THis takes care of the validation before I click on save.
    call method alv_grid->register_edit_event
                            exporting
                               i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    This works fine. But I want this validation to run when I also click the SAVE button of the screen. Is it possible to run this standard validation in my PAI event eg. SAVE ? I thought I will be, by calling the method check_changed_data in my PAI event. But this is doing nothing. Does this method conflict with register_edit_event or something ? So , basically what I am looking for is to trigger the event or call the method which does the same work as the "check" button on ALV grid.
    Any advice or tips or sample code is greatly appreciated.
    Thanks,
    Shareen

    Hi Shareen,
    Handle the data_changed event in the grid.
    Whenever you make changes in the data in ALV Grid this event would be triggered. Here you can perform additional validations that you may need to perform.
        METHODS handle_data_changed
          FOR EVENT data_changed OF cl_gui_alv_grid
          IMPORTING er_data_changed.
    Implementation:
      METHOD handle_data_changed.
        PERFORM validations USING er_data_changed.
      ENDMETHOD.
    FORM validations USING er_data_changed TYPE REF TO cl_alv_changed_data_protocol.
      DATA: ls_good TYPE lvc_s_modi.
      DATA  wa LIKE LINE OF lt_good_cells.
      CALL METHOD g_grid->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>mc_evt_modified.
      LOOP AT er_data_changed->mt_good_cells INTO ls_good.
        CASE ls_good-fieldname.
        WHEN 'FIELDNAME'. "Your fieldname
            CALL METHOD er_data_changed->get_cell_value "Get the changed value
              EXPORTING
                i_row_id    = ls_good-row_id
                i_fieldname = ls_good-fieldname
              IMPORTING
                e_value     = temp. "Your temp variable
            "Make your validations here.
        ENDCASE.
    Ps: Reward points if helpful.
    Regards,
    Wenceslaus.

  • How to make a field manadatory within ALV Grid using methods and classes

    Hi,
    I am using ALV Grid using set_table_for_first_display
    inside my dialog programming. I have a field called project number inside my grid which has to be made as mandatory field.
    I have defined a method called catch_data_changed inside my class lcl_event_receiver. This method captures the changes made to one of the fields inside my ALV grid and displays all the default values of the other fields from the grid.
    Now, i have to make project number which is one of my fields inside my ALV grid as mandatory. At the field catalog level i did not find any such option for making a field as required field.
    Is there any other way, i can accomplish this within the ALV grid?

    from my understanding from ur question, i understood that u want the editable field inside alvgrid to be mandatory.
    i dont know anthing in fieldcat, but u can try the following logic.
    FORM DATA_CHANGED  USING P_ER_DATA_CHANGED TYPE REF TO
    CL_ALV_CHANGED_DATA_PROTOCOL .
      DATA: L_VALUE TYPE LVC_VALUE,
        ls_mod_cell type lvc_s_modi.
      READ TABLE P_ER_DATA_CHANGED->MT_MOD_CELLS INTO LS_MOD_CELL.
    if sy-subrc = 0.
        CALL METHOD P_ER_DATA_CHANGED->GET_CELL_VALUE
          EXPORTING
            I_ROW_ID    = LS_MOD_CELL-row_id
            I_FIELDNAME = LS_MOD_CELL-fieldname
          IMPORTING
            E_VALUE     = L_VALUE.
    IF LS_MOD_CELL-FIELDNAME <> 'fieldname what u want'
    MESSAGE 'ENTER VALUE INTO (fieldname u want) ' TYPE 'I'.
    ENDIF.
    ELSE.
    MESSAGE 'ENTER VALUE INTO (fieldname u want) ' TYPE 'I'.
    ENDIF.

  • How to handle user command method in module ALV Grid

    HI Experts,
                     I have 3 containers grid. 
                     GR_GRID              TYPE REF TO CL_GUI_ALV_GRID,
                     GR_GRID1              TYPE REF TO CL_GUI_ALV_GRID,
                     GR_GRID2              TYPE REF TO CL_GUI_ALV_GRID.
                     Please advise me how can I insert, save, delete 3 Module ALV Grid in method user command. How can i get which grid button (save, insert, delete) is clicked and how can i control those grid.
                    Thks in advance.
    CLASS LCL_EVENT_RECEIVER DEFINITION.
      PUBLIC SECTION.
        METHODS :
            HANDLE_TOOLBAR
                  FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
                                IMPORTING E_OBJECT E_INTERACTIVE SENDER,
            HANDLE_USER_COMMAND
                  FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
                                IMPORTING E_UCOMM,
            HANDLE_DATA_CHANGED
                    FOR EVENT DATA_CHANGED OF CL_GUI_ALV_GRID
                          IMPORTING ER_DATA_CHANGED
                                    E_ONF4
                                    E_ONF4_BEFORE
                                    E_ONF4_AFTER,
            HANDLE_DOUBLE_CLICK
                     FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                     IMPORTING E_ROW
                               E_COLUMN,
            HANDLE_HOTSPOT_CLICK
                      FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                           IMPORTING E_ROW_ID
                                     E_COLUMN_ID
                                     ES_ROW_NO.
    ENDCLASS. "(LCL_EVENT_RECEIVER DEFINITION) 
    METHOD HANDLE_USER_COMMAND.
         CLEAR G_CODE.
        G_CODE = E_UCOMM.
        CASE G_CODE.
          WHEN 'INSERT'.
            MESSAGE 'insert' TYPE 'I'.
           APPEND INITIAL LINE TO GT_MAIN.
          WHEN 'SAVE'.
           MODIFY ZTNBOOK FROM GT_MAIN.
            MESSAGE 'save' TYPE 'I'.
          WHEN 'DELETE'.
           DELETE FROM ZTNBOOK WHERE B_ID EQ GT_ZTBOOK-B_ID.
            MESSAGE 'delete' TYPE 'I'.
        ENDCASE.
        IF NOT G_CODE IS INITIAL.
      PBO, PAI
         CALL METHOD CL_GUI_CFW=>SET_NEW_OK_CODE
           EXPORTING
             NEW_CODE = G_CODE.
         CLEAR G_CODE.
        ENDIF.
      ENDMETHOD.

    Hi,
    Before posting, Search in SDN.
    See the below tread it will help you.
    Re: Get table for cl_gui_alv_grid

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

  • Can we call ALV grid in a method?

    hello everybody,
    Is it possible to display the output in ALV from a <b>class-method(Global class)</b>?
    in a class-method wee cannot call a screen, so is there any other possibility to display the grid??
    thanx in advance,
    abhilash.

    Don't USE ALV Function modules wherever possible.  Go OO --it's simple once you get the hang of it.
    Of course you can do it.
    Here's a general class including an event handler in the SAME class. This can be used for DYNAMIC tables, DYNAMIC FCATS and custom events. The method DISPLAY_GRID here will do what you want.
    Your structure list and fcat data are in the field-symbols  <fs1> and <fs2>
    Here's the code. This program just reads 200 lines from KNA1 and displays some data in a GRID with a toolbar. Press the EXIT arror to quit the program.
    You need to define a blank screen (SE51) with a custom control on it called CCONTAINER1.
    The screen logic as follows
    PBO.
    MODULE status_0100 OUTPUT.
    You don't need a PAI as we are using the toolbar with events.
    OK here goes.
    The CLASS bit first
    FIELD-SYMBOLS :
      <fs1>          TYPE  ANY,
      <fs2>          TYPE  STANDARD TABLE,
      <dyn_table>    TYPE  STANDARD TABLE,
      <dyn_field>,
      <dyn_wa>.
    CLASS zcl_dog DEFINITION.
    PUBLIC SECTION.
    METHODS:
      constructor
          IMPORTING       z_object type ref to zcl_dog,
      return_structure,
      create_dynamic_fcat
          EXPORTING       it_fldcat TYPE lvc_t_fcat,
      display_grid
          CHANGING        it_fldcat type lvc_t_fcat,
      on_user_command FOR EVENT before_user_command OF cl_gui_alv_grid
          IMPORTING       e_ucomm
                          sender,
      on_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
          IMPORTING      e_object
                       e_interactive.
      PRIVATE SECTION.
    DATA:
        lr_rtti_struc   TYPE REF TO cl_abap_structdescr,        "RTTI
        zog             LIKE LINE OF lr_rtti_struc->components, "RTTI
        wa_it_fldcat    TYPE lvc_s_fcat,
        grid_container1 TYPE REF TO cl_gui_custom_container,
        grid1           TYPE REF TO cl_gui_alv_grid.
    TYPES:
       struc            LIKE  zog.
    DATA:
        zogt           TYPE TABLE OF struc.
    ENDCLASS.
    CLASS zcl_dog IMPLEMENTATION.
    METHOD constructor.
        CREATE OBJECT grid_container1
            EXPORTING
                container_name = 'CCONTAINER1'.
        CREATE OBJECT  grid1
            EXPORTING i_parent = grid_container1.
        SET HANDLER z_object->on_user_command for grid1.
        SET HANDLER z_object->on_toolbar for grid1.
    ENDMETHOD.
    METHOD return_structure.
      lr_rtti_struc ?= cl_abap_structdescr=>DESCRIBE_BY_DATA( <fs1> ).
      zogt[]  = lr_rtti_struc->components.
      ASSIGN zogt[] TO <fs2>.
    ENDMETHOD.
    METHOD create_dynamic_fcat.
        LOOP AT <fs2>  INTO zog.
          CLEAR wa_it_fldcat.
          wa_it_fldcat-fieldname = zog-name .
          wa_it_fldcat-datatype = zog-type_kind.
          wa_it_fldcat-inttype = zog-type_kind.
          wa_it_fldcat-intlen = zog-length.
          wa_it_fldcat-decimals = zog-decimals.
          wa_it_fldcat-coltext = zog-name.
          wa_it_fldcat-lowercase = 'X'.
          APPEND wa_it_fldcat TO it_fldcat .
        ENDLOOP.
    ENDMETHOD.
    METHOD display_grid.
    CALL METHOD grid1->set_table_for_first_display
        CHANGING
             it_outtab       = <dyn_table>
             it_fieldcatalog = it_fldcat.
    ENDMETHOD.
    METHOD on_user_command.
        CASE e_ucomm.
          WHEN 'EXIT'.
            LEAVE PROGRAM.
           WHEN 'SAVE'.
       ENDCASE.
    ENDMETHOD.                    "on_user_command
    METHOD on_toolbar.
    DATA: ls_toolbar TYPE stb_button.
         CLEAR ls_toolbar.
         MOVE 0 TO ls_toolbar-butn_type.
         MOVE 'EXIT' TO ls_toolbar-function.
         MOVE SPACE TO ls_toolbar-disabled.
         MOVE icon_system_end TO ls_toolbar-icon.
         MOVE 'Click2Exit' TO ls_toolbar-quickinfo.
         APPEND ls_toolbar TO e_object->mt_toolbar.
         CLEAR ls_toolbar.
         MOVE  0 TO ls_toolbar-butn_type.
         MOVE 'SAVE' TO ls_toolbar-function.
         MOVE SPACE TO ls_toolbar-disabled.
         MOVE  icon_system_save TO ls_toolbar-icon.
         MOVE 'Save data' TO ls_toolbar-quickinfo.
         APPEND ls_toolbar TO e_object->mt_toolbar.
       ENDMETHOD.
    ENDCLASS.
    Now the program is incredibly simple and will work for almost ANY table with just a call to the methods in the class . Saves Zillions of coding different ABAPS.
    start of program data to demo use of above class ************
    INCLUDE  <icon>.
    TABLES : kna1.
    TYPES:  BEGIN OF s_elements,
      kunnr   TYPE kna1-kunnr,
      name1   TYPE kna1-name1,
      stras   TYPE kna1-stras,
      telf1   TYPE kna1-telf1,
      ort01   TYPE kna1-ort01,
      pstlz   TYPE kna1-pstlz,
    END OF  s_elements.
    DATA:  z_object type ref to zcl_dog,  "Instantiate our class
           t_elements   TYPE TABLE OF s_elements, "refers to our ITAB
           wa_elements   TYPE s_elements,
           wa_dyn_table_line TYPE REF TO DATA,
           it_fldcat TYPE lvc_t_fcat,
           new_table TYPE REF TO DATA,
           dy_table TYPE REF TO data,
           dy_line  TYPE REF TO data.
    START-OF-SELECTION.
    CALL SCREEN 100.
    END-OF-SELECTION..
    MODULE status_0100 OUTPUT.
    ASSIGN  wa_elements TO <fs1>.
    *Instantiate our zcl_dog class
    CREATE OBJECT
         z_object
           EXPORTING
            z_object = z_object.
    Get structure of your ITAB
    CALL METHOD z_object->return_structure.
    build fcat.
    CALL METHOD z_object->create_dynamic_fcat
          IMPORTING
            it_fldcat = it_fldcat.
    build dynamic table
    CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fldcat
        IMPORTING
          ep_table        = dy_table.
    ASSIGN dy_table->* TO <dyn_table>.
    Create dynamic work area and assign to FS
      CREATE DATA dy_line LIKE LINE OF <dyn_table>.
      ASSIGN dy_line->* TO <dyn_wa>.
    fill it
    PERFORM populate_dynamic_itab.
    Display ALV grid with our EXIT tool button
    CALL METHOD z_object->display_grid
           CHANGING it_fldcat = it_fldcat.
    ENDMODULE.
    MODULE user_command_0100 INPUT.
    PAI not needed as we are using EVENTS
    ENDMODULE.
    FORM populate_dynamic_itab.
    just read 200 lines as a demo from KNA1
    assign dynamic table created to <field symbol> so you can fill it
    with data.  Table also now acessible to methods in the classes
    defined in this program.
    SELECT kunnr name1 stras telf1 ort01 pstlz
        UP TO 200 rows
        FROM kna1
        INTO  CORRESPONDING FIELDS OF TABLE <dyn_table>.
    ENDFORM.
    If you save the class  with SE24 you can see all you need to do in the program is
    1)  Define your data
    2) Instantiate the class
      CREATE OBJECT
         z_object
           EXPORTING
            z_object = z_object.
    3) Get structure of your ITAB (can be ANY itab including deep structures)
    CALL METHOD z_object->return_structure.
    4)  build your FCAT automatically using the structure returned from 3).
    CALL METHOD z_object->create_dynamic_fcat
          IMPORTING
            it_fldcat = it_fldcat.
    5)  build dynamic table
    CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fldcat
        IMPORTING
          ep_table        = dy_table.
    6) * Create dynamic work area and assign to FS
    ASSIGN dy_table->* TO <dyn_table>.
      CREATE DATA dy_line LIKE LINE OF <dyn_table>.
      ASSIGN dy_line->* TO <dyn_wa>.
    7) Fill it
    PERFORM populate_dynamic_itab.
    8)  Now display Display ALV grid with our EXIT tool button
    CALL METHOD z_object->display_grid
           CHANGING it_fldcat = it_fldcat.
    If you look in the method display_grid you'll see that the method can call ALV classes and functions.
    Isn't the above much easier than messing around with obsolete function modules --and you can write virtually the same code for ANY table. You can also in the events add eitable functions etc.
    In fact we could even make it simpler.
    I'll try and post the code later but in fact we could get the CLASS to do almost the entire thing so the only statements you would actually need in your ABAP would be
    Your Data
    Instantiate the class.
    Call the class with a new method to do all the coding up to generating the ITAB.
    Populate your Itab
    call the method to display your ITAB.
    So your new abap would basically just have DATA, your ITAB structure,  2 method calls and a proceedure to fill your ITAB.
    (Now your Boss won't take any excuses if it takes you longer than 20 Mins to code an ABAP containing even a complex table display. !!!!).
    Cheers
    Jimbo

Maybe you are looking for