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: 

Changes inside ALVGrid are not marked as changes in ER_DATA_CHANGED

Former Member
0 Kudos

Hello to all!

I got a very specific problem with data changes in alvgrid. Let me tell you.

My problem is: Inside the grid, via a user command, some cell values are changed by a popup window (function module POPUP_GET_VALUES). Now, I want to return the modified values to the grid. I can transfer the data entered in the popup into my data table:

loop at lt_fields into ls_field.

check ls_field-field_attr = '00' or ls_field-field_attr = '01'.

shift ls_field-value left deleting leading space.

assign component ls_field-fieldname

of structure <fs_tab_item> to <fs_field_val>.

<fs_field_val> = ls_field-value.

endloop.

modify <fs_tab_data> index ls_row_no-row_id from <fs_tab_item>.

And I can refresh the display:

ls_stbl-col = ls_stbl-row = 'X'.

call method refresh_table_display

exporting

is_stable = ls_stbl

i_soft_refresh = 'X'.

But on saving, the manually changed data is not visible in the u201Cchanged fieldsu201D-information upon the call of the event HANDLE_DATA_CHANGED (parameter ER_DATA_CHANGED type ref to CL_ALV_CHANGED_DATA_PROTOCOL).

Do you know a way to tell the grid that a cell value was changed, but not by direct user input in the cell, but another way of data change? In the class CL_ALV_CHANGED_DATA_PROTOCOL, there is a method modify_cell, but I need an instance of this class in order to call this method. How do I get an instance of this class? Are there other ways to tell the grid about changed cells?

With kind regards

Stefan Wagenblast

1 REPLY 1

Former Member
0 Kudos

High to all,

I found the solution: you can tell the grid which cells were modified. You have to declare a table that contains the fields changed:


  DATA: lt_delta_cells TYPE lvc_t_modi
      , ls_delta_cells TYPE lvc_s_modi
      .

In the loop over the changed fields you have to collect the changes:


    IF <fs_field_val> <> ls_field-value.
      <fs_field_val> = ls_field-value.
      CLEAR ls_delta_cells.
      ls_delta_cells-row_id    = ls_row_no-row_id.
      ls_delta_cells-fieldname = ls_field-fieldname.
      ls_delta_cells-value     = ls_field-value.
      APPEND ls_delta_cells TO lt_delta_cells.
    ENDIF.

After the loop, inform the grid about changes:


  CALL METHOD me->set_delta_cells
    EXPORTING
      it_delta_cells = lt_delta_cells
      i_modified     = 'X'.

Any suggestions?

Have a nice day

Stefan