ABAP OOALV删除TOOLBAR按钮

OOALV (单标题展示)方法如下:

其中设置一个参数it_toolbar_excluding 就可以把不需要的按钮删除了。

DATA GR_GRID TYPE REF TO CL_GUI_ALV_GRID.

.....定义CONTAINER...."用于展示EnjoySAP 所有控件的容器,视窗。

.....定义GR_GRID....." 要在CONTAINER中使用哪种EnjoySAP控件,选择了:GR_GRID (CL_GUI_ALV_GRID)
                     " ALV单层标题展示控件技术.

.....实例化...create object  GR_GRID exporting  ......(参数皆为 CONSTRUCTOR方法参数,并且只能有传入参数)。

.....调用实例GR_GRID的方法,最终展示ALV..

*----------------------------------------------------------------------------------*

展示方法如下:

ABAP OOALV删除TOOLBAR按钮===>传入参数置为黄色.

 CALL METHOD GR_GRID->set_table_for_first_display
    EXPORTING
      is_variant           = gs_variant
      i_save               = ' '
      is_layout            = gs_layout
      it_toolbar_excluding = gt_exclude
    CHANGING
      it_outtab            = gt_result1[]
      it_fieldcatalog      = gt_fcat_lvc.

gt_exclude 如何设置呢?他的技术属性如何呢?

1.技术属性:

定义内表 用于传入参数

DATA : gt_exclude TYPE ui_functions.

注意:ui_functions是一个由CHAR70构成的表结构。

故GT_EXCLUDE内表是一个只有一个字段的CHAR70的内表。

2.怎么赋值:

DATA: ls_exclude TYPE ui_func.

注意:ui_func 是构成ui_functions 的结构。
  DATA: ls_exclude TYPE ui_func.
  ls_exclude = cl_gui_alv_grid=>mc_fc_maximum .
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_minimum .
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_subtot .
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_sum .
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_average .
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_mb_sum .
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_mb_subtot .
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_sort_asc.
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_sort_dsc .
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_find .
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_filter .
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_print .
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_print_prev .
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_mb_export .
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_graph .
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_mb_view .
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_detail .
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_help .
  APPEND ls_exclude TO pt_exclude.
  ls_exclude = cl_gui_alv_grid=>mc_fc_info .
  APPEND ls_exclude TO pt_exclude.

   ls_exclude = cl_gui_alv_grid=>MC_MB_VARIANT.
  APPEND ls_exclude TO pt_exclude.

注意:cl_gui_alv_grid=>mc_fc_maximum 这些类似的静态变量存的是什么东西呢?

我们进入SE24 ,输入CL_GUI_ALV_GRID.

进去后进入ATTRIBUTES标签页,就会看到这些变量,当然也在程序中双击直接导航进去,查询默认值.

你可能感兴趣的:(SAP&Ehancement)