ABAP-ALV-如何去掉OO方法中的ALV的标准按钮详解编程语言

SAP在做报表开发中,不同公司对报表的风格往往各异,为此经常在使用OO方法做ALV报表中需要去掉自带的工具栏而自行添加一些工具按钮,下面将简单介绍一些其实现过程与原理:

步骤一: DATA : gt_exclude TYPE ui_functions.
步骤二:写一个FORM将要去掉的按钮添加到上面定义的表(gt_exclude)        

 1 perform exclude_tb_functions  tables gt_exclude   
 2  
 3 FORM exclude_tb_functions  TABLES pt_exclude TYPE ui_functions . 
 4   DATA: ls_exclude TYPE ui_func. 
 5   ls_exclude = cl_gui_alv_grid=>mc_fc_maximum . 
 6   APPEND ls_exclude TO pt_exclude. 
 7   ls_exclude = cl_gui_alv_grid=>mc_fc_minimum . 
 8   APPEND ls_exclude TO pt_exclude. 
 9   ls_exclude = cl_gui_alv_grid=>mc_fc_subtot . 
10   APPEND ls_exclude TO pt_exclude. 
11   ls_exclude = cl_gui_alv_grid=>mc_fc_sum . 
12   APPEND ls_exclude TO pt_exclude. 
13   ls_exclude = cl_gui_alv_grid=>mc_fc_average . 
14   APPEND ls_exclude TO pt_exclude. 
15   ls_exclude = cl_gui_alv_grid=>mc_mb_sum . 
16   APPEND ls_exclude TO pt_exclude. 
17   ls_exclude = cl_gui_alv_grid=>mc_mb_subtot . 
18   APPEND ls_exclude TO pt_exclude. 
19   ls_exclude = cl_gui_alv_grid=>mc_fc_sort_asc. 
20   APPEND ls_exclude TO pt_exclude. 
21   ls_exclude = cl_gui_alv_grid=>mc_fc_sort_dsc . 
22   APPEND ls_exclude TO pt_exclude. 
23   ls_exclude = cl_gui_alv_grid=>mc_fc_find . 
24   APPEND ls_exclude TO pt_exclude. 
25   ls_exclude = cl_gui_alv_grid=>mc_fc_filter . 
26   APPEND ls_exclude TO pt_exclude. 
27   ls_exclude = cl_gui_alv_grid=>mc_fc_print . 
28   APPEND ls_exclude TO pt_exclude. 
29   ls_exclude = cl_gui_alv_grid=>mc_fc_print_prev . 
30   APPEND ls_exclude TO pt_exclude. 
31   ls_exclude = cl_gui_alv_grid=>mc_mb_export . 
32   APPEND ls_exclude TO pt_exclude. 
33   ls_exclude = cl_gui_alv_grid=>mc_fc_graph . 
34   APPEND ls_exclude TO pt_exclude. 
35   ls_exclude = cl_gui_alv_grid=>mc_mb_view . 
36   APPEND ls_exclude TO pt_exclude. 
37   ls_exclude = cl_gui_alv_grid=>mc_fc_detail . 
38   APPEND ls_exclude TO pt_exclude. 
39   ls_exclude = cl_gui_alv_grid=>mc_fc_help . 
40   APPEND ls_exclude TO pt_exclude. 
41   ls_exclude = cl_gui_alv_grid=>mc_fc_info . 
42   APPEND ls_exclude TO pt_exclude.   
43  
44   ls_exclude = cl_gui_alv_grid=>MC_MB_VARIANT. 
45   APPEND ls_exclude TO pt_exclude. 
46 ENDFORM.                    " exclude_tb_functions

步骤三: 

1 CALL METHOD grf_grid1->set_table_for_first_display 
2     EXPORTING 
3       is_variant           = gs_variant 
4       i_save               = ' ' 
5       is_layout            = gs_layout 
6       it_toolbar_excluding = gt_exclude 
7     CHANGING 
8       it_outtab            = gt_result1[] 
9       it_fieldcatalog      = gt_fcat_lvc.

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/19722.html

(0)
上一篇 2021年7月19日
下一篇 2021年7月19日

相关推荐

发表回复

登录后才能评论