*publicattributesandmethodPUBLICSECTION.METHODS:handle_toolbarFOREVENTtoolbarOFcl_gui_alv_gridIMPORTINGe_object,handle_user_commandFOREVENTuser_commandOFcl_gui_alv_gridIMPORTINGe_ucomm,ENDCLASS."lcl_event_receiverDEFINITION注意这个事件处理类中
添加了两个
方法,第一个方法负责往工具栏上添加
按钮,第二个方法用来响应工具栏上按钮的动作步骤二:类的实现CLASSlcl_event_receiverIMPLEMENTATION.*methodtoolbarhandlerMETHODhandle_toolbar.PERFORMset_toolbarCHANGINGe_object.ENDMETHOD."handle_toolbarMETHODhandle_user_command.*HandleownfunctionsdefinedinthetoolbarCASEe_ucomm.WHEN'ADD'.PERFORMxyz. “这里你想干嘛就可以干嘛ENDCASE.ENDMETHOD."handle_user_commandENDCLASS."lcl_event_receiverIMPLEMENTATION步骤三:在FORM-----set_toolbar中添加buttonFORMset_toolbarCHANGINGprf_objectTYPEREFTOcl_alv_event_toolbar_set.CLEARprf_object-mt_toolbar.CLEARgs_toolbar.MOVE'ADD'TOgs_toolbar-function.MOVETOgs_toolbar-quickinfo.MOVETOgs_toolbar-text.MOVE''TOgs_toolbar-disabled.INSERTgs_toolbarINTOprf_object-mt_toolbarINDEX1.ENDFORM."set_toolbar1步骤四:创建事件处理对象--这一步一般在你把SET PF-STATUS '0200' EXCLUDING RT_EXTAB.
改成SET PF-STATUS '0200' 这个看看,
如果还不行
CASE R_UCOMM改成 CASE SY-UCOMM
如果还不行
FUNCTION 'REUSE_ALV_GRID_DISPLAY'多开2个参数再看看
i_save = 'X'
i_callback_program = sy-repid
在GUI STATUS里面去加就行了
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = g_repid
i_callback_pf_status_set = 'F_SET_STATUS'
i_callback_user_command = 'USER_COMMAND'
is_layout_lvc = gs_layout
it_fieldcat_lvc = gt_fieldcat[]
i_save = 'A' " 保存变式
is_variant = gs_variant "
TABLES
t_outtab = gt_itab[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
FORM f_set_status USING p_extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD'.
ENDFORM. "F_SET_STATUS
评论列表(0条)