ALV GRID的参考文档 ( 9 ) - 管理显示变式

管理显示变式
可以使用方法set_table_for_first_display的参数is_variant和i_save来管理显示变式。下表是变式处理的选项:
Mode
Is_variant
I_save
Change current display variant
SPACE
SPACE
Select and change current display variant
<structure_name>
SPACE
Select, change and save current display variant
<structure_name>
‘U’:only user-specific
“X’:only global
“A’:both
基于事件的其他功能
跟其他面向对象的方法一样,alv grid有些事件用于支持与用户的交互功能。这些事件用来实现其他一些功能。对于这些功能,需要一个类的实例来作为ALV GRID的事件句柄持有者。
下表便是alv grid的一些事件,这个表来自于ALV GRID的文档,HTML列用来说明是否支持web格式的sap gui。
用户自定义文本输出的界面
Event
Application
HTML
Print_end_of_list
Define output text to be printed at the end of the entire list
Print_top_of_list
Define output text to be printed at begin of the entire list
Print_top_of_page
Define output text to be printed at begin of each page
Print_end_of_page
Define output text to be printed at the end of each page
Subtotal_text
Define self-defined subtotal texts
在ALV GRID上的鼠标动作
Event
Application
HTML
Button_click
Query click on a push button in the ALV GRID control
Double_click
Query a double click on a cell of the ALV GRID
Hotspot_click
Query a hotspot click on columns defined for this purpose in advance
ondrag
Collect information when elements of the ALV GRID Control are dragged
×
ondrop
Process information when elements of the ALV GRID Control are dropped
×
ondropComplete
Perform final actions after successful drag&drop
×
ondropGetFlavor
Distinguish between options for drag&drop behavior
×
自定义和标准功能码的处理
Event
Application
HTML
Before_user_command
Query self-defined and standard functions
User_command
Query self-defined function codes
After_user_command
Query self-defined and standard functions codes
自定义功能码的定义
Event
Application
HTML
Tool bar
Change,delete or add gui elements on alv grid
Menu_button
Define menus for menu buttons in the toolbar
Context_menu_request
Change context menu
×
Onf1
Define self-defined f1 help
下面的代码说明了自定义类的定义过程
CLAS lcl_event_handler DEFINITION.
 PUBLIC SECTION.
METHODS:
*--To add new functional buttons to the ALV toolbar
Handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
    IMPORTING e_object e_interactive,
*--To implement user commands
Handle_user_command
       FOR EVENT user_command OF cl_gui_alv_grid
       IMPORTING e_ucomm.
*--Hotspot click control
Handle_hotspot_click
       FOR EVENT hotspot_click OF cl_gui_alv_grid
       IMPORTING e_row_id e_column_id es_row_no.
*--To be triggered before user commands
Handle_before_user_command
   FOR EVENT before_user_command OF cl_gui_alv_grid
        IMPORTING e_ucomm.
*--To be triggered after user commands
Handle_after_user_command
   FOR EVENT after_user_command OF cl_gui_alv_grid
       IMPORTING e_ucomm.
*--Controling data changes where ALV grid is changeable
Handle_data_changed
   FOR EVENT data_changed OF cl_gui_alv_grid
        IMPORTING er_data_changed.
*--To be triggered after data change has been finished
 Handle_data_changed_finished
   FOR EVENT data_changed_finished OF cl_gui_alv_grid
        IMPORTING e_modified.
*--To control menu buttons
Handle_menu_button
   FOR EVENT menu_button OF cl_gui_alv_grid
        IMPORTING e_object e_ucomm.
*--To control button clicks
Handle_button_click
   FOR EVENT button_click OF cl_gui_alv_grid
        IMPORTING e_objec e_ucomm.
 PRIVATE SECTION.
ENDCLASS.
CLASS lcl_event_handler IMPLEMENTATION.
 *-- Handle toolbar
 METHOD handle_toolbar.
    PERFORM handle_toolbar USIGN e_object e_interactive.
 ENDMETHOD.
 *-- Handle hotspot click
 METHOD handle_hotspot_click.
    PERFORM handle_hotspot_click USING e_row_id e_column_id es_row_no.
 ENDMETHOD.
 *-- Handle double click
 METHOD handle_double_click.
    PERFORM handle_double_click USING e_row e_column es_row_no.
 ENDMETHOD.
 *-- Handle after user command
 METHOD handle _after_user_command.
    PERFORM handle_after_user_command USING e_object.
 ENDFORM.
 *-- Handle before user command
 METHOD handle_before_user_command.
    PERFORM handle_before_user_command.
 ENDMETHOD.
 *--Handle data changed
 METHOD handle_data_changed.
    PERFORM handle_data_changed USING er_data_changed.
 ENDMEHTOD.
 METHOD handle_data_changed_finished.
     PERFORM handle_data_chaged USING e_modified.
 ENDMETHOD.
 METHOD handle_menu_button.
     PERFORM handle_menu_button USING e_object e_ucomm.
 ENDMEHTOD.
 MEHTOD handle_button_click.
     PERFORM handle_button_click USING e_objcet e_ucomm.
 ENDMETHOD.
ENDCALSS.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值