我想在编辑另一个字段时填充一个字段。所以这是实现中的方法。
当我按Enter键时,什么也没有发生,但是当我双击更改时,将适用。
您有任何想法或解决方法吗?我正在使用cl_salv_table类。
METHOD data_changed_finished.
DATA: ls_inr TYPE LINE OF lvc_t_modi,
lv_stbl TYPE lvc_s_stbl,
gt_out type standard table of SPFLI,
ls_out LIKE LINE OF gt_out.
LOOP AT et_good_cells INTO ls_inr
WHERE fieldname = 'CITYFROM'.
EXIT.
ENDLOOP.
DATA:
ld_REFRESH_MODE TYPE SALV_DE_CONSTANT ,
ld_S_STABLE TYPE LVC_S_STBL.
ld_S_STABLE-row = 'X'.
ld_S_STABLE-col = 'X'.
IF sy-subrc = 0.
LOOP AT et_good_cells INTO ls_inr.
LOOP AT IT_SPFLI INTO ls_out
FROM ls_inr-row_id
TO ls_inr-row_id.
ls_out-DISTANCE = '556'.
MODIFY IT_SPFLI FROM ls_out.
ENDLOOP.
ENDLOOP.
ENDIF.
lv_stbl-row = 'X'.
lv_stbl-col = 'X'.
ld_S_STABLE-row = 'X'.
ld_S_STABLE-col = 'X'.
ld_REFRESH_MODE = 2.
CALL METHOD salv->REFRESH(
EXPORTING
REFRESH_MODE = ld_REFRESH_MODE
S_STABLE = ld_S_STABLE ).
ENDMETHOD.
答案 0 :(得分:1)
因此,正如我在评论中说的那样,对我来说显而易见的是,问题更多地是关于 CL_GUI_ALV_GRID
(不是CL_SALV_TABLE)。默认情况下,Enter键不会触发事件DATA_CHANGED
和DATA_CHANGED_FINISHED
。
如果要使用此功能,则必须调用方法 REGISTER_EDIT_EVENT
,并传递这两个常量之一以同步触发两个事件: