Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in modifying the cell values in Editable ALV Grid.

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Try using DATA_CHANGE_FINISHED event of the same class.

Regards,

Ernesto.

Edited by: Ernesto Caballero on Apr 6, 2011 1:59 PM

10 REPLIES 10

Former Member
0 Kudos

Hi,

Try using DATA_CHANGE_FINISHED event of the same class.

Regards,

Ernesto.

Edited by: Ernesto Caballero on Apr 6, 2011 1:59 PM

huseyindereli
Active Contributor
0 Kudos

Hi ,

Try editing fields at DATA_CHANGED_FINISHED event.

Regards

0 Kudos

Hi,

I feel that this not a suitable event.

The data required i.e the row id not available.... and the option to change the data in the cell is also not available.

0 Kudos

Changes should affected on this event and i think you can see your internal table modified. Loop at your internal table and modify fields as you wish. Maybe you can get key fields to access new records at DATA_CHANGED event.

0 Kudos

Hi,

changes are not getting affected.

Regards

0 Kudos

Hi,

If you do the following:


FORM data_changed_finished USING e_modified TYPE char01
                  		 et_good_cells TYPE lvc_t_modi.

  DATA: l_good_cells TYPE lvc_s_modi.

  CHECK NOT e_modified IS INITIAL.

  READ TABLE et_good_cells INTO l_good_cells
  INDEX c_1.

  CHECK sy-subrc IS INITIAL.

   LOOP AT t_final into wa_final.

        wa_final-sno = sy-tabix.

	modify t_final from wa_final.

    ENDLOOP.

ENDFORM.

Regards,

Ernesto

0 Kudos

I can get my inserted rows.

Take a look at this example report BCALV_TEST_GRID_EVENTS .

Regards

0 Kudos

Hi,

I can get my inserted rows. but in my row there is a non editable column where I have to change the values.

It is a serial number column which is non editable. If the user inserts a row in between the serial numbers for the following records must be altered.

But as the other rows are not edited/changed by user system is not allowing to change the serial num of that rows.

I am able to change the serial number of the newly added row..... or the rows where the user made some changes to already existing record. But if the records are un altered I am unable to modify the values....

Hope I am clear

Edited by: SAP LEARNER on Apr 6, 2011 5:03 PM

0 Kudos

Hi,

I wrote the code as follows:


  METHOD data_changed_finished.

    FIELD-SYMBOLS:<fs> TYPE ty_e_kna1.
    LOOP AT t_final ASSIGNING <fs>.
      <fs>-sno = sy-tabix.
    ENDLOOP.

  ENDMETHOD.                    "DATA_CHANGED_FINISHED

I had set the handler also.... But the o/p is not getting altered

0 Kudos

Using REFRESH_TABLE_DISPLAY solved the issue....

Thanks guys for the help

Regards