ALV Grid editable fields

Hello,
I got a dynpro with 3 ALV grids. I edit a value of grid 3, then I execute a pushbutton of grid 1. The value of grid 3 is resetted then.
What should I do to keep the value?
Reward points guaranteed.
Regards
René

Sounds like the event handler method for event data_changed  is not being fired.  In one of my programs, I am registering the "ENTER" key, the user must hit enter after editing the field to fire the data_changed event. 
* Set for first display
        call method alv_grid->set_table_for_first_display
            exporting
                 is_layout              = lt_layout
                 it_toolbar_excluding   = lt_exclude
            changing
                 it_outtab       = ialv[]
                 it_fieldcatalog = fieldcat[].
* If cancelling points, register "ENTER" as event
* and create the event receiver
<b>          call method alv_grid->register_edit_event
                        exporting
                           i_event_id = cl_gui_alv_grid=>mc_evt_enter.</b>
*   create Event Receiver
          create object event_receiver.
*   handler for ALV grid
          set handler event_receiver->handle_data_changed for alv_grid.
Do this records the changes that the user has made.  I believe that this must be done before you start the processing of the button on Grid1.
Regards,
Rich Heilman

Similar Messages

  • Alv grid Editable field

    Hai friends,
    I am displaying data in ALV Grid, in this 2-fields are editable,so i have to change existing values and input our own values ,but here trouble is i unable to catch new values ,can any one help me that how to catch these input values.
    Thanks in Advance

    Thanku for reply..please see the below code.
      fieldcatalog-fieldname     = 'NEWA'.
      fieldcatalog-just          = 'C'.
      fieldcatalog-key           = 'X'.
      fieldcatalog-input        = 'X'.
      fieldcatalog-edit          = 'X'.
      fieldcatalog-seltext_m     = 'New Aggrement'.
      fieldcatalog-outputlen     = 15.
      append fieldcatalog to fieldcatalog.
      clear fieldcatalog.
      fieldcatalog-fieldname     = 'NEWI'.
      fieldcatalog-just          = 'C'.
      fieldcatalog-key           = 'X'.
      fieldcatalog-edit          = 'X'.
      fieldcatalog-seltext_m     = 'New Item'.
      fieldcatalog-outputlen     = 15.
      append fieldcatalog to fieldcatalog.
      clear fieldcatalog.
    call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          i_callback_program            = gd_repid
          i_callback_pf_status_set  = 'PFSTATUS'
          i_callback_user_command   = 'USER'
          is_layout                 = gd_layout
          it_fieldcat               = fieldcatalog[]
          it_events                 = gi_events
        i_save                    = 'X'
           tables
             t_outtab               = gt_final
           exceptions
             program_error          = 1
           others                   = 2.

  • Multiple Input Rows In ALV Grid (Editable)

    Hi,
    I have an editable ALV grid and need to have multiple blank rows ready for input. Something similar to what happens when you click the "New Entries" button in SM30 (Table Maintainance).
    There is a local function for appending lines in the ALV grid toolbar but this only allows a single entry.
    I have replaced the local function with my own button (same icon etc) and on user_command event, I am appending several blank lines to my output table.
    However these lines are not being shown on the screen. I have looked through the layout and field catalog but there is no field to allow blank lines to be shown.
    My 2 questions are:
    1. Is there some standard way of entering multiple entries in ALV Grid Editable.
    2. If not then how to allow blank lines to be shown as ready for input.
    Also if someone could suggest a way to do error checking for all entries on the screen especially duplicate entries I will be extremely grateful.
    Many Thanks,
    Preet

    Hi, Preet!
    You can easily do whatever checks you wish. You should declare an event handling method for event DATA_CHANGED and call the ADD_PROTOCOL_ENTRY method of the ER_DATA_CHANGED event parameter (it's an object of the class CL_ALV_CHANGED_DATA_PROTOCOL). You must not forget to set handler for your ALV grid.
    For example, this piece of code checks for all changed fields resulting in error message if they are initial. In short, this makes all the fields obligatory.
    METHODS: on_data_changed FOR EVENT data_changed OF cl_gui_alv_grid IMPORTING er_data_changed.
    SET HANDLER your_object->on_data_changed FOR your_alv_grid.
    METHOD on_data_changed.
    DATA: s_mod_cell TYPE lvc_s_modi.
    LOOP AT er_data_changed->mt_mod_cells INTO s_mod_cell.
        IF s_mod_cell-value IS INITIAL.
    *       issue message 'Make an entry in all required fields'
            CALL METHOD er_data_changed->add_protocol_entry
              EXPORTING i_msgid     = '00'
                        i_msgno     = '055'
                        i_msgty     = 'E'
                        i_fieldname = s_mod_cell-fieldname
                        i_row_id    = s_mod_cell-row_id.
        ENDIF.
    ENDMETHOD.
    Furthermore, if you make your class inherited from CL_GUI_ALV_GRID you can make use of protected attribute MT_OUTTAB which is a data object referencing your output table. Then you can have:
    FIELD-SYMBOLS: <outtab> TYPE STANDARD TABLE.
    ASSIGN me->mt_outtab->* TO <outtab>.
    * do whatever you want with <outtab>
    Hope this helps.
    Kind regards,
    Igor
    P.S. Regarding the blank lines that you need, what's wrong with standard ALV grid buttons "Append row" and "Insert row" which appear whenever the grid is editable (unless you deliberately remove them)? They work just fine with me (just like on SM30). I don't see reason for programatically appending lines to your internal table.

  • Reg. can we display alv grid using field groups (extracts)

    Hi,
    can we display alv grid using field groups (extracts). is this possible. i have to develop a blocked alv.
    tnks
    Yerukala Setty

    No, you will need the data in an internal table to use ALV.
    Cheers
    Allan

  • Drill down capabilities for an alv grid display field using oops concept

    Hi All,
    could anyone help me in how to achieve the drill down capabilities for an alv grid display field using oops concept.
    Thanks & Regards,
    padmasri.

    padmasri,
    Hope your requirement is something like, when you click on a sales order number it should display that order (VA03), in a grid output displayed using set_table_for_first_display.
    you can acheive it using event double click.
    *&            L O C A L  C L A S S E S   -   D E F I N I T O N         *
    class lcl_event_receiver: local class to handle event DOUBLE_CLICK
    CLASS LCL_EVENT_RECEIVER DEFINITION.
      PUBLIC SECTION.
        METHODS:
        HANDLE_DOUBLE_CLICK
            FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                IMPORTING E_ROW E_COLUMN.
      PRIVATE SECTION.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    *&    L O C A L  C L A S S E S   -   I M P L E M E N T A T I O N       *
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
      METHOD HANDLE_DOUBLE_CLICK.
        PERFORM HANDLE_DOUBLE_CLICK USING E_ROW
                                          E_COLUMN.
      ENDMETHOD.                           "handle_double_click
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    FORM HANDLE_DOUBLE_CLICK USING E_ROW    TYPE LVC_S_ROW
                                   E_COLUMN TYPE LVC_S_COL.
      DATA: LS_DETAIL LIKE LINE OF T_OUTPUT.
          WHEN 'T_OUTPUT'.
            READ TABLE T_OUTPUT   INDEX E_ROW-INDEX INTO LS_DETAIL.
    If clicked on PO Number or PO Item, call ME23
        IF E_COLUMN-FIELDNAME = 'EBELN' OR
           E_COLUMN-FIELDNAME = 'EBELP' .
          SET PARAMETER ID 'BES' FIELD LS_DETAIL-EBELN.
          SET PARAMETER ID 'BSP' FIELD LS_DETAIL-EBELP.
          CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
    If clicked on sales order number or item, call VA03
        ELSEIF E_COLUMN-FIELDNAME = 'VBELN' OR
               E_COLUMN-FIELDNAME = 'POSNR'.
          SET PARAMETER ID 'AUN' FIELD LS_DETAIL-VBELN.
          SET PARAMETER ID 'APO' FIELD LS_DETAIL-POSNR.
          CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    Hope this helps

  • ALV grid Editable based on a Field value

    Hi,
    I need to make a ALV Grid Row editable based on a particular field of that row.
    For example
    if fields are   A   B   C  D
    and if there are three rows of data
    I must make the Field B editable in all the rows which have D value as X else it must be non Editable.
    I searched in SDN but could not find a suitable answer.
    Hope I am clear with my issue.
    Regards

    this sample code makes the NETPR field editable based on a desired condition.
    this is the solution to your problem.
    * TABLES:     ekko.
    * TYPE-POOLS: slis.
    * TYPES: BEGIN OF t_ekko,
    *  ebeln TYPE ekpo-ebeln,
    *  ebelp TYPE ekpo-ebelp,
    *  netpr TYPE ekpo-netpr,
    *  field_style  TYPE lvc_t_styl,
    * END OF t_ekko.
    *DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    *      wa_ekko TYPE t_ekko.
    *DATA: it_fieldcat TYPE lvc_t_fcat,    
    *      wa_fieldcat TYPE lvc_s_fcat,
    *      gd_tab_group TYPE slis_t_sp_group_alv,
    *      gd_layout    TYPE lvc_s_layo,  
    *      gd_repid     LIKE sy-repid.
    *START-OF-SELECTION.
    *SELECT ebeln ebelp netpr
    *   UP TO 10 ROWS
    *    FROM ekpo
    *    INTO  CORRESPONDING FIELDS OF TABLE it_ekko.
    *  DATA ls_stylerow TYPE lvc_s_styl .
    *  DATA lt_styletab TYPE lvc_t_styl .
    ** The following code sets it to be disabled(display only) if 'NETPR'
    ** is gt than 10.
    *  LOOP AT it_ekko INTO wa_ekko.
    *    IF wa_ekko-netpr GT 10.
    *      ls_stylerow-fieldname = 'NETPR' .
    *      ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
    *      APPEND ls_stylerow  TO wa_ekko-field_style.
    *      MODIFY it_ekko FROM wa_ekko.
    *    ENDIF.
    *  ENDLOOP.
    *  wa_fieldcat-fieldname   = 'EBELN'.
    *  wa_fieldcat-scrtext_m   = 'Purchase Order'.
    *  wa_fieldcat-col_pos     = 1.
    *  APPEND wa_fieldcat TO it_fieldcat.
    *  CLEAR  wa_fieldcat.
    *  wa_fieldcat-fieldname   = 'EBELP'.
    *  wa_fieldcat-scrtext_m   = 'PO Item'.
    *  wa_fieldcat-col_pos     = 2.
    *  APPEND wa_fieldcat TO it_fieldcat.
    *  CLEAR  wa_fieldcat.
    *  wa_fieldcat-fieldname   = 'NETPR'.
    *  wa_fieldcat-scrtext_m   = 'Net Price'.
    *  wa_fieldcat-edit        = 'X'. "sets whole column to be editable
    *  wa_fieldcat-col_pos     = 3.
    *  wa_fieldcat-datatype     = 'CURR'.
    *  APPEND wa_fieldcat TO it_fieldcat.
    *  CLEAR  wa_fieldcat.
    *  gd_layout-stylefname = 'FIELD_STYLE'.
    *  gd_layout-zebra             = 'X'.
    *  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    *       EXPORTING
    *            i_callback_program       = sy-repid
    *            is_layout_lvc            = gd_layout
    *            it_fieldcat_lvc          = it_fieldcat
    *            i_save                   = 'X'
    *       TABLES
    *            t_outtab                = it_ekko

  • ALV Grid Editable

    How to make the ALV grid data as editable ?
    Regards
    Badari

    In the field catalog, set the EDIT field to X for whichever field you want to be editable.
    Regards,
    Ravi
    Note : Please mark all the helpful answers

  • ALV Grid Control -- Field Catalog

    Hi ,
      In the filed catalog for ALV grid control ( LVC_T_FCAT) ,there is a field called CHECKTABLE , can i use this to validate the value entered in that cell of a editable ALV.
    If yes then what are the perquisites of using it.
    Regards
    Arun

    Hi Arun,
    look the help.sap.com documentation, all the field of the field catalog are describe and explain.
    Regards
    Frédéric

  • ALV Grid - mark fields as changed

    I have an editable ALV grid, and when the user changes field values then the data_changed event is called correctly so I can validate the changes.
    I am now implementing an upload method which replaces the values in the data table.  The problem is that the control does not recognise the lines as new or changed, so does not do any checking on them or pass to the data_changed event. 
    I can use method if_cached_prop~set_prop ( propname  = 'GridModified'           propvalue = '1' )
    to set the grid modified flag, but  get_modified_cells returns an empty table so there are no fields passed to my data_changed implementation.
    I think I could use method CHANGE_DATA_FROM_INSIDE to set the new values.  However, it is marked as internal only, and it will be very tedious to fill the tables...
    Is there any way to flag fields as changed?
    Alternatively, if I do my checks in my upload method, is there a way to add messages to the output log? 
    Thanks
    Michael

    I have worked out a solution.
    I can use method CHANGE_DATA_FROM_INSIDE, and as long as layout-val_data = 'X' then the data_changed method is called to do validations.  However, the data in fields with errors is deleted...
    My alternative solution is to store the uploaded values and when checking the data, put the uploaded values manually into er_data_changed->mt_good_cells.  The trick is to manually set the grid status to modified, so that the data_changed handler implementation is called - this is done with METHOD gr_grid_0200->if_cached_prop~set_prop.
    The ALV grid data is in <outtab> which has all fields of <outtab> plus a few extras
    I upload from file into <data_table>.
        data:
          ls_mod_cell     type LVC_S_MODI.
    *     Add correct tabix and celltab fields.
          refresh <outtab>.
          clear <gs_outtab>.
    *     Move to outtab structure and put into grid table
          loop at <data_table> assigning <data>.
            move-corresponding <data> to <gs_outtab>.
            insert <gs_outtab> into table <outtab>.
    *       Store the field data for validations
            ls_mod_cell-row_id = sy-tabix.
            ls_mod_cell-tabix = sy-tabix.
            ls_mod_cell-SUB_ROW_ID = fl_uploaded.
            LOOP AT gt_fieldcat_0200 ASSIGNING <fcat>
                    where tech = '' and no_out = ' '.
              ls_mod_cell-fieldname = <fcat>-fieldname.
              assign component <fcat>-fieldname of structure <data> to <value>.
              if sy-subrc = 0.
                ls_mod_cell-value = <value>.
                insert ls_mod_cell into table t_mod_cells.
              endif.
            Endloop.
          endloop.
    *     Update the table display.  This resets the internal version of the data table.
          CALL METHOD gr_grid_0200->refresh_table_display.
    *     Force the GridModified flag to on
          CALL METHOD gr_grid_0200->if_cached_prop~set_prop
            EXPORTING
              propname           = 'GridModified'
              propvalue          = '1'
            EXCEPTIONS
              others             = 0              .
    In the local method for handle_data_changed, I can then use the stored data
    *   When importing data from file, the fields are not checked
    *   Add uploaded values to the data_changed tables
    *   (First remove any fields which have been subsequently changed by the user)
        if t_mod_cells is not initial.
          loop at er_data_changed->mt_mod_cells into ls_mod_cell.
            delete t_mod_cells
                   where row_id    = ls_mod_cell-row_id
                   and   fieldname = ls_mod_cell-fieldname.
          endloop.
          insert lines of t_mod_cells into table er_data_changed->mt_good_cells.
          insert lines of t_mod_cells into table er_data_changed->mt_mod_cells.
        endif.
       ....  Validation code ...
    *   Remove uploaded fields.  Otherwise any without error will blank out the value in the grid...
        delete er_data_changed->mt_good_cells where SUB_ROW_ID = fl_uploaded.
        delete er_data_changed->mt_mod_cells where SUB_ROW_ID = fl_uploaded.
    *   If no errors, remove uploaded data
        if error_in_data EQ space.
          clear t_mod_cells.
        endif.

  • ALV GRID Edit Validations (how to do your own)

    Hi folks, I am using ALV Grid to enter some data, I would like to do some validations on save and also adjust data in the table and validate it upon another few buttons.
    All is good and works fine using the standard events, however these events are only triggered if you directly change the data yourself, <b>I need validates once a button is hit</b>.
    I have been playing with the following methods, and the cells are returned in the "good" list and the mod list (as expected), but the cell on the screen is not highlighted in red, and if you change something on the screen, the messages you have added are then lost.
      CALL METHOD p_grid->change_data_from_inside
        EXPORTING
          it_style_cells = lt_modi.
    Has anyone added there own custom validations upon hitting a button - in a manner that the red cell border is shown?
    I have tried both of these handlers:
    CALL METHOD p_defn-grid->register_edit_event
       EXPORTING
         i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    **Own event on enter or ucomm
      CALL METHOD p_defn-grid->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    I am adding in my messages in event data_changed, using method add_protocol_entry of class cl_alv_changed_data_protocol - this is passed to me in the data_changed event.
    I have also looked at the data_changed_finished event, but cant get anything from that either - it doesn’t even keep my good fields.
    Ps I have also played with the layout setting layout-val_data = 'X' and space and "C" - but the messages are still not kept, and cells not bordered in red.
    The solution may have something to do with triggering the event manually somehow - but i cant find a way to call a method that would do it as they are all private!
    thanks in advance - this is a tricky one!

    Adobe Pat 206
    You cannot create a Premiere Elements (any version) DVD Template from scratch using Photoshop Elements (any version). To do that you need Photoshop CS or higher. The reason for "higher" is that earlier Photoshop versions do not support Layers Groups within the Layer Groups.
    But, providing you find a version of Photoshop Elements on a given computer operating system that will open the Photoshop Layer Groups in its key structure (.psd file), you can use Photoshop Elements to edit (not create from scratch) the .psd file for the main and scene menus of a given existing Adobe theme. I am careful on my language here since there have been recent difficulties getting Photoshop Elements to do this job which it once did without issue.
    The process is easy enough, but very detail dependant, with strict requirements for names files as well as Layer Groups, sublayers groups, and layers in the .psd file. To give you an idea of what is involved, please check out two articles I have written related to Premiere Elements DVD Template creation and customization.
    http://www.elementsvillage.com/forums/showthread.php?t=56244
    http://www.atr935.blogspot.com/2013/05/pe-one-page-14-scene-buttons-dvd-menu.html
    Not placing the new menu in the correct directory and any error in spelling and such are just some of the ingredients for failure in this type of project.
    Unless you want to add extra buttons to a menu, it might be easier for you to explore customization opportunties in the Movie Menu section of the program. See Tools/Movie Menus. The Movie Menus customization area should look like this
    Note that the Adjustments...Menu Background shows Video or Stills among other things.
    If you have questions on anything that I have written, please ask me here in your thread.
    You can also check out the Adobe documentation on this type of topic.
    http://help.adobe.com/en_US/premiereelements/using/WS09e4b3c48f3a79fc19b622510385d4355c-7e 0c.html
    Thanks.
    ATR

  • ALV Grid editing cell cursor position

    Hello !
    i hope i can get the answer to my question here.
    i have an alv-grid with editable cells
    when i click in one cell (it is a textfield) where there is no more written text it marks the hole cell and when i start to write, it overwrites the whole text.
    i would like the cursor to be placed at the end of the field in this case.
    when i click in the cell where there is written text it is ok - it puts the cursor to the clicked position.
    thanks very much for your help
    Helmut

    Hi, i am also facing same probelm.
    after  call method sender->refresh_table_display.
    i am using
    call method sender->set_current_cell_via_id
          exporting
            is_row_id    = l_rowid
            is_column_id = l_colid.
    this will simply select the cell. i am not able to see curser in end or front of the cell.Can anybody please suggest me how to it.
    Thanks
    Sudhakar

  • ALV Grid - Printnig field names.

    Hi Gurus,
    I have a requirement for a report which has the format for display as shown below.
    Sr. No | Mat No. |  Material grp | some material types | COLUMN HEADINGS
    |*********|*************** | 10g | 20g | 30g | 40g | COLUMN HEADINGS
    000001 |xyz*****|ABCDEFGHIJ | 005 | 0004| 002 | 003 | From this data start
    As u can see, there is two level fields description printing... We can do it in List,
    I want to know whether we can achieve it using ALV.  
    As shown above, field column "some material types" having sub types as 10g, 20g, 30g and 40g.  So I want one column to be split into four or five columns.
    *Points will be granted.
    Regards,
    Shailesh.

    Hi Shailesh,
    The short answer is no, you cannot.
    It would not make sense to do such a thing, anyway.  After all, "some material types" is there as a heading for a group of four columns, but using the usual ALV-grid functionality, the user would be able, for instance, to move the 30g column to the left of the Mat No column, say.
    The requirement may make sense in an ABAP list, where the columns are fixed, but not in an ALV, where the columns can be moved.
    They will have to change the requirement!
    John

  • ALV Grid: Alternate Field Catalog per Line Type possible?

    I'm using the ALV Grid Classes: Is it possible to change the Field Catalog per line type? I have two different line types: 1) Interspersed headers and 2) data lines. The Interspersed headers should have no_zero = 'x' and the data lines no_zero = space.

    It can be done by REUSE_ALV_HIERSEQ_LIST_DISPLAY in classic ALV .
    Alternately, it can be done by ALV object model. Try SALV* and look into sample programs.

  • Alv grid mandatory field.

    hi...
    I have a ALV grid  that is displayed ... i fill up the entries in this and then save them.
    i need to declare  some fields as mandatory
    how shall i do it
    thanks

    Hi,
    Check the fieldcatalog, if there is any option .. I don;t think we have option for it..
    Other wise u have to take care in ur program by checking if there is any value entered in the field , if not throw error message , something like this..
    This iam telling reagrding by using FM REUSE_ALV_GRID_DISPLAY..
    Regards,
    Nagaraj

  • Need help in ALV grid editable cells

    Hi,
    I have created a ALV Grid program in which i made certain cells as editable cells.Now my question is if suppose i have 2 rows in my output then if i change the 2nd rows some cells, then some calculation has to perform till this it is fine but nw i want to modify the 3rd rows some cells as per the changes in 2nd row.
    How to do it with ALV oops concepts.
    I have refered BCALV_EDIT_02 and BCALV_EDIT_03 these std programs.
    Thanks & Regards
    Madhuri

    Hello Madhuri
    I recommend to do any post-processing of the changed data OUTSIDE your event handler method (HANDLE_DATA_CHANGED).
    Within the event handler method do all required validations and the trigger PAI by calling method CL_GUI_CFW=>SET_NEW_OK_CODE (for an example refer to my sample report ZUS_SDN_TWO_ALV_GRIDS in alv)
    Now at PAI of your screen you can do any kind of post-processing, calculation, etc. within the itab used for the ALV list.
    Regards
      Uwe

Maybe you are looking for