안녕하세요 기존 add_row 툴바버튼을 exclude해서제거 하고
이벤트로 add_row 버튼 추가한 뒤 행추가 이벤트도 같이 연결했는데 add_row버튼이 안먹히더라구요
행추가 버튼 누르면 작동이 안되는 이유가 뭘까요?? ㅜㅜ
************************************************************************
PUBLIC SECTION.
METHODS :
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
handle_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm,
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
************************************************************************
METHOD handle_toolbar.
DATA : lw_button TYPE stb_button,
lv_disabled TYPE c.
CLEAR lw_button.
lw_button-function = 'ADD_ROW'.
lw_button-icon = icon_insert_row.
lw_button-butn_type = 0.
lw_button-disabled = lv_disabled.
INSERT lw_button INTO e_object->mt_toolbar INDEX 1.
ENDMETHOD.
METHOD handle_user_command.
gv_change_flag = abap_true. " 변경된 경우
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = e_ucomm.
ENDMETHOD.
METHOD handle_data_changed.
gv_change_flag = abap_true. " 변경된 경우
PERFORM data_changed USING er_data_changed.
ENDMETHOD.
************************************************************************
" 3.이벤트 핸들러 메서드 등록
CHECK lcl_event_receiver IS INITIAL.
CREATE OBJECT lcl_event_receiver.
SET HANDLER :
lcl_event_receiver->handle_data_changed FOR go_alv,
lcl_event_receiver->handle_toolbar FOR go_alv,
lcl_event_receiver->handle_user_command FOR go_alv.
***********************************************************************
user_command_0100 (pai)
gv_code_0100 = gv_code.
CLEAR : gv_code.
CASE gv_code_0100.
WHEN 'DISP'.
PERFORM disp_mode.
WHEN 'EDIT'.
PERFORM edit_mode.
WHEN 'SAVE'.
PERFORM save_data.
WHEN 'ADD_ROW'.
PERFORM add_row.
WHEN OTHERS.
ENDCASE.
*****************************************************************
FORM add_row .
DATA : ls_add_line LIKE gs_data.
ls_add_line-bukrs = v_bukrs.
_set_er_data ls_add_line.
_set_ae_data ls_add_line.
INSERT ls_add_line INTO gt_data INDEX 1.
ENDFORM.
안녕하세요.
DISP/EDIT/SAVE 도 호출이 되나요? (어떤 방식으로 호출하고 있는지..)
Screen 0100 속성 중, OKCODE 가 지정이 제대로 되어 있는지 확인해보시기 바랍니다.