Code: Alles auswählen.
IF er_data_changed->mt_good_cells[] IS NOT INITIAL.
LOOP AT er_data_changed->mt_good_cells INTO ls_good.
MOVE-CORRESPONDING ls_good TO ls_good_tmp.
*neue Zeile und deshalb noch nicht in gt_data?
READ TABLE er_data_changed->mt_inserted_rows INTO ls_ins
WITH KEY row_id = ls_good-row_id.
IF sy-subrc = 0.
* ja, neue Zeile
* Zeile zuerst an gt_data anhängen
ASSIGN COMPONENT ls_good-fieldname OF STRUCTURE <ls_data> TO <l_value>.
IF sy-subrc = 0.
<l_value> = ls_good-value.
MODIFY gt_data FROM <ls_data> INDEX ls_good-row_id.
IF sy-subrc <> 0.
* Modify geht schief, da die Zeile noch nicht da ist --> Append
APPEND <ls_data> TO gt_data.
ENDIF.
ENDIF.
ELSE.
* nein, Zeile sollte vorhanden sein.
ENDIF.
READ TABLE gt_data ASSIGNING <ls_data> INDEX ls_good-row_id.
IF <ls_data> IS ASSIGNED.
ASSIGN COMPONENT ls_good-fieldname OF STRUCTURE <ls_data> TO <l_value>.
IF sy-subrc = 0.
<l_value> = ls_good-value.
MODIFY gt_data FROM <ls_data> INDEX ls_good-row_id.
ENDIF.
ENDIF.
ENDLOOP.