很久没用居然忘记了,现在记下来,到时候拿来就用,省的再去翻资料:
1.OOALV增加删除工具条:
其中设置一个参数it_toolbar_excluding,就可以把不需要的按钮删除了.
首先声明变量:data: gt_exclude TYPE ui_functionsgt_exclude T
* DATA ls_exclude TYPE ui_func.
**排除打印按钮
* ls_exclude = cl_gui_alv_grid=>mc_fc_print .
* APPEND ls_exclude TO gt_exclude.
**排除添加、删除、插入、复制按钮
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row .
* APPEND ls_exclude TO gt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row .
* APPEND ls_exclude TO gt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy .
* APPEND ls_exclude TO gt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut .
* APPEND ls_exclude TO gt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row .
* APPEND ls_exclude TO gt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row .
* APPEND ls_exclude TO gt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row .
* APPEND ls_exclude TO gt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste .
* APPEND ls_exclude TO gt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row .
* APPEND ls_exclude TO gt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo .
* APPEND ls_exclude TO gt_exclude.
CALL METHOD wcl_alv->set_table_for_first_display
EXPORTING
i_save = 'A'
i_default = 'X'
is_layout = gs_layout
it_toolbar_excluding = gt_exclude
CHANGING
it_outtab = gt_itab[]
it_fieldcatalog = g_itab_fieldcat_lvc
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-sUbrc <> 0.
ENDIF.
以上就是OOALV的工具条删除显示的方法。
下面介绍一下FMALV的工具条隐藏的方法。
FM就是在创建GUI_STATUS的时候自己去定义,需要的工具条就写上去,不需要的就不写,很方便。。