FORM handle_data_changed CHANGING sender TYPE REF TO cl_gui_alv_grid er_data_changed TYPE REF TO cl_alv_changed_data_protocol e_onf4 e_onf4_before e_onf4_after e_ucomm.
DATA ls_mod_cells LIKE LINE OF er_data_changed->mt_mod_cells.
FIELD-SYMBOLS : <lfs_data> LIKE LINE OF gt_data, <lfs_field> TYPE ANY.
LOOP AT er_data_changed->mt_mod_cells INTO ls_mod_cells. READ TABLE gt_data ASSIGNING <lfs_data> INDEX ls_mod_cells-row_id. CHECK sy-subrc IS INITIAL. ASSIGN COMPONENT ls_mod_cells-fieldname OF STRUCTURE gs_data TO <lfs_field>. IF <lfs_field> IS ASSIGNED. <lfs_field> = ls_mod_cells-value. ENDIF. ENDLOOP.
1. field-catalog 에 checkbox 설정
ex) ...
ls_fcat-fieldname = 'CHECK'.
ls_fcat-checkbox = 'X'.
ls_fcat-edit = 'X'.
...
append ls_fcat to gt_fcat.
2. data_changed event 설정
...
SET HANDLER lcl_event->handle_data_changed FOR cl_grid.
cl_grid->register_edit_event(
EXPORTING i_event_id = cl_grid->mc_evt_modified
).
...
3. event(handle_data_changed) 에 대한 코딩
FORM handle_data_changed
CHANGING sender TYPE REF TO cl_gui_alv_grid
er_data_changed TYPE REF TO cl_alv_changed_data_protocol
e_onf4
e_onf4_before
e_onf4_after
e_ucomm.
DATA ls_mod_cells LIKE LINE OF er_data_changed->mt_mod_cells.
FIELD-SYMBOLS : <lfs_data> LIKE LINE OF gt_data,
<lfs_field> TYPE ANY.
LOOP AT er_data_changed->mt_mod_cells INTO ls_mod_cells.
READ TABLE gt_data ASSIGNING <lfs_data>
INDEX ls_mod_cells-row_id.
CHECK sy-subrc IS INITIAL.
ASSIGN COMPONENT ls_mod_cells-fieldname
OF STRUCTURE gs_data
TO <lfs_field>.
IF <lfs_field> IS ASSIGNED.
<lfs_field> = ls_mod_cells-value.
ENDIF.
ENDLOOP.
sender->refresh_table_display( is_stable = gs_stable ).
ENDFORM. "handle_data_changed
대충 이런 방법으로 하시면 internal table에 check한 값이 들어갈 거예요.
좋은 결과 있으시길 바랍니다.