ABAP面向对象ALV 如何触发toolbar事件
CLASSlcl_event_receiverIMPLEMENTATION.METHODhandle_double_click.MESSAGE'ok'TYPE'I'.EN...
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_double_click.
MESSAGE 'ok' TYPE 'I'.
ENDMETHOD.
METHOD handle_toolbar.
DATA: ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
ls_toolbar-butn_type = 3.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
ls_toolbar-function = 'RESH'.
ls_toolbar-icon = icon_refresh.
ls_toolbar-quickinfo = 'Refresh'.
ls_toolbar-text = ''.
ls_toolbar-disabled = ''.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
调试的时候,双击事件只要双击任意单元格就可以进来了,但是Toolbar事件总是进不去。。 展开
METHOD handle_double_click.
MESSAGE 'ok' TYPE 'I'.
ENDMETHOD.
METHOD handle_toolbar.
DATA: ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
ls_toolbar-butn_type = 3.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
ls_toolbar-function = 'RESH'.
ls_toolbar-icon = icon_refresh.
ls_toolbar-quickinfo = 'Refresh'.
ls_toolbar-text = ''.
ls_toolbar-disabled = ''.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
调试的时候,双击事件只要双击任意单元格就可以进来了,但是Toolbar事件总是进不去。。 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励20(财富值+成长值)
1个回答
展开全部
你没有使用OK_CODE事件
CLASS LCL_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
"双击事件
METHODS:
HANDLE_DOUBLE_CLICK
FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN.
"工具栏增加按钮
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.
ENDCLASS. "lcl_event_receiver DEFINITION
METHOD HANDLE_USER_COMMAND."控制部分
DATA: L_VALID2 TYPE C .
CLEAR L_VALID2 .
CALL METHOD GIT_ALV_CONTROL2->CHECK_CHANGED_DATA
IMPORTING
E_VALID = L_VALID2.
CASE E_UCOMM.
WHEN 'OUT'.”你自定的
ENDCASE .
ENDMETHOD.
CLASS LCL_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
"双击事件
METHODS:
HANDLE_DOUBLE_CLICK
FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN.
"工具栏增加按钮
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.
ENDCLASS. "lcl_event_receiver DEFINITION
METHOD HANDLE_USER_COMMAND."控制部分
DATA: L_VALID2 TYPE C .
CLEAR L_VALID2 .
CALL METHOD GIT_ALV_CONTROL2->CHECK_CHANGED_DATA
IMPORTING
E_VALID = L_VALID2.
CASE E_UCOMM.
WHEN 'OUT'.”你自定的
ENDCASE .
ENDMETHOD.
追问
还是不行,我追加了user_command部分.
现在的问题是,我在
METHOD handle_toolbar.
实现部分设了断点进行调试,程序根本就进去不了创建toolbar部分的流程
追答
哦 还有这段代码忘了给你说了
CREATE OBJECT GIT_RECEIVER.
SET HANDLER GIT_RECEIVER->HANDLE_DOUBLE_CLICK FOR GIT_ALV_CONTROL1.
SET HANDLER GIT_RECEIVER->HANDLE_USER_COMMAND FOR GIT_ALV_CONTROL1.
SET HANDLER GIT_RECEIVER->HANDLE_TOOLBAR FOR GIT_ALV_CONTROL1.
CALL METHOD GIT_ALV_CONTROL1->SET_TOOLBAR_INTERACTIVE.
CALL METHOD GIT_ALV_CONTROL1->SET_USER_COMMAND
EXPORTING
I_UCOMM = OK_CODE.
解决了就好
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询