Skip to Content
0
Former Member
Apr 06, 2011 at 11:18 AM

Problem in modifying the cell values in Editable ALV Grid.

648 Views

Hi,

I have a editable ALV Grid display Where the User can append rows at the end of the table or In between the existing Lines.

I have a Serial Number field which is non editable. If the user inserts a record in between the existing data, I have to reset the SNO of the following lines in accordance with the added record.

But When I try to change the values of the records which are unedited by the user the system is throwing a dump.

How to change the values of the records which are not edited by the user.

Source code extract


    LOOP AT er_data_changed->mt_roid_front INTO lw_roid.
      l_index = sy-tabix.
      READ TABLE er_data_changed->mt_inserted_rows INTO lw_inserted_rows WITH KEY row_id = lw_roid-row_id.
      IF sy-subrc EQ 0.
        l_flag = abap_true.
        lw_final-sno = l_index.
        INSERT lw_final INTO t_final INDEX lw_final-sno.
      ENDIF.
    ENDLOOP.

    IF l_flag IS NOT INITIAL.
      LOOP AT t_final ASSIGNING <fs>.
        <fs>-sno = sy-tabix.
        READ TABLE er_data_changed->mt_roid_front INTO lw_roid INDEX sy-tabix.
        IF sy-subrc EQ 0.
            CALL METHOD er_data_changed->modify_cell           " I am trying to edit values here.
              EXPORTING
                i_row_id    = lw_roid-row_id
                i_fieldname = 'SNO'
                i_value     = <fs>-sno.
        ENDIF.
      ENDLOOP.
    ENDIF.

Note: I am doing the change in the DATA_CHANGED Event of the CL_GUI_ALV_GRID