Hallo everyone
I am currently working on an editable ALV Grid, that listens to the on data changed handler and assigns default values to the new inserted rows.
So far so good, but for some reason the internal table of the ALV gets changed after the "on data changed"-event. Could you please give me some advice?
Here is the relevant code section in the on_data_changed-event:
W_JOBSTEP
Note: GW_JOBSTEP / GT_JOBSTEP are the internal table / work area for the ALV grid.
<fs> is a fieldsymbol for p_data_changed->mp_mod_row.p_data_changed->mp_mod_rows->*p_data_changed->mp_mod_rows->*<fs>p_data_changed->mp_mod_rows->*
* V-----------------set default Value for new row---------------------------V* " Loop at the inserted rows table and assign default values LOOP AT p_data_changed->mt_inserted_rows INTO dl_ins_row. ASSIGN p_data_changed->mp_mod_rows->* TO <fs>. READ TABLE <fs> INTO GW_JOBSTEP INDEX sy-tabix. "set default values GW_JOBSTEP-MANDT = sy-mandt. GW_JOBSTEP-JOBNAME = ZBC_JOB-JOBNAME. GW_JOBSTEP-STEPCOUNT = sy-tabix. GW_JOBSTEP-XPGFLAG = K_DEFAULT_XPGFLAG. GW_JOBSTEP-PRNEW = 'X'. GW_JOBSTEP-PDEST = K_DEFAULT_PRINTER. GW_JOBSTEP-LANGUAGE = sy-LANGU. "Find row index for GW_JOBSTEP Table according to matching table READ TABLE p_data_changed->MT_ROID_FRONT WITH KEY ROW_ID = DL_INS_ROW-ROW_ID TRANSPORTING NO FIELDS. ""sy-tabix now contains row ID of MT_ROID_FRONT with the matching row. IF sy-subrc EQ 0. DATA: idx TYPE sy-tabix. idx = sy-tabix. ENDIF. "update field symbol MODIFY <fs> FROM GW_JOBSTEP INDEX sy-tabix. INSERT GW_JOBSTEP INTO GT_JOBSTEP INDEX idx. ENDLOOP. "Loop at the inserted rows PERFORM JOBSTEP_DISABLE_FIELDS. "also calls G_ALV_GRID_REF->REFRESH_TABLE_DISPLAY.
After these lines, the GT_JOBSTEP table looks fine. But if I resume the programme, the internal table gets changed (not in the z-programme). I assume the problem lies in the field symbol, but I don't see the error.
If I let the debugger stop, when ever GT_JOBSTEP[] got changed it stops at my handler (ok), 2 CONVERSION_EXIT (ok) and the MODIFY_PROTOCOL_ENTRY Method of CL_ALV_CHANGED_DATA_PROTOCOL==CP.
If more details are needed, please just ask.
I thank everyone for their efforts in advance.
Best regards
Fabio