728x90
반응형
set handler
CALL METHOD g_alv->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified. "체크박스같은거 클릭시 바로 체인지드이벤트 탈수있게
select data 처음 체크박스 안보이게 모드 i로 준다
LOOP AT gt_tab INTO gs_tab.
gs_tab-mode = 'I'.
MODIFY gt_tab FROM gs_tab.
ENDLOOP.
체인지드 이벤트때 모드 변경해주고 pbo 타게한다
FORM data_changed USING er_data_changed TYPE REF TO cl_alv_changed_data_protocol
e_ucomm TYPE sy-ucomm.
DATA: ls_mod_cells TYPE lvc_s_modi.
LOOP AT er_data_changed->mt_good_cells INTO ls_mod_cells.
CASE ls_mod_cells-fieldname.
WHEN 'DEL_FLAG'.
CALL METHOD er_data_changed->get_cell_value
EXPORTING
i_row_id = ls_mod_cells-row_id
i_fieldname = ls_mod_cells-fieldname
IMPORTING
e_value = gs_tab-del_flag.
gs_tab = gt_tab[ ls_mod_cells-row_id ].
IF gs_tab-mode = 'E'.
gs_tab-mode = 'D' .
ELSE. "D, I..
gs_tab-mode = 'E'.
ENDIF.
MODIFY gt_tab FROM gs_tab INDEX ls_mod_cells-row_id.
ENDCASE.
ENDLOOP.
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'ENTER'.
ENDFORM.
필드카탈로그 구성한부분 뒤에 control_fcat 퍼폼문 해주고 이후 else에서도 해당 퍼폼문 탈수 있도록 퍼폼문 추가해준다
MODULE set_alv OUTPUT.
IF g_alv IS NOT BOUND.
PERFORM create_obj.
PERFORM set_handler.
PERFORM make_fcat.
PERFORM layo.
PERFORM sort.
PERFORM display_alv.
ELSE.
PERFORM control_fcat.
PERFORM alv_refresh.
ENDIF.
ENDMODULE.
control_fcat
FORM control_fcat .
DATA: lt_celltab TYPE lvc_t_styl,
ls_celltab TYPE lvc_s_styl,
l_index TYPE i.
LOOP AT gt_tab INTO gs_tab.
CLEAR gs_tab-style.
l_index = sy-tabix.
REFRESH lt_celltab.
CASE gs_tab-mode.
WHEN 'I'.
ls_celltab-fieldname = 'RATE'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT ls_celltab INTO TABLE lt_celltab.
WHEN 'E'.
ls_celltab-fieldname = 'RATE'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
INSERT ls_celltab INTO TABLE lt_celltab.
WHEN 'D'.
ls_celltab-fieldname = 'RATE'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT ls_celltab INTO TABLE lt_celltab.
ENDCASE.
INSERT LINES OF lt_celltab INTO gs_tab-style INDEX 1.
MODIFY gt_tab FROM gs_tab INDEX l_index.
* MODIFY gt_tab FROM gs_tab INDEX L_tabix TRANSPORTING style. "전체컬럼 변경
ENDLOOP.
ENDFORM.
728x90
반응형
'ABAP' 카테고리의 다른 글
ALV All select (0) | 2023.02.24 |
---|---|
ALV Fieldcatalog Using Field-symbol (0) | 2023.02.21 |
Dynamic table Calculation (0) | 2023.02.21 |
RANGES 변수 (0) | 2023.02.21 |
ALV F4 (Possible entry) (0) | 2023.02.21 |
댓글