我们可以在ALV工具栏中添加,删除按钮,实现我们所需要的功能
Method Description
ADD_FUNCTION 增加一个按钮
REMOVE_FUNCTION 删除一个按钮
ADD_FUNCTION (Parameter TEXT) 定义文本描述在按钮上
ADD_FUNCTION (Parameter ICON) 定义图标
ADD_FUNCTION (Parameter POSITION) 定义位置
ADD_FUNCTION (Parameter TOOLTIP) 定义TIP
代码如下:
DATA: lr_functions TYPE REF TO cl_salv_functions_list.
DATA: l_icon TYPE string,
l_text TYPE string,
l_tooltip TYPE string.
l_icon = icon_customer.
l_text = text-ocd. " only customer data
l_tooltip = text-oct. " only columns with customer data
lr_functions->add_function(
name = 'CODE'
icon = l_icon
text = l_text
tooltip = l_tooltip
position = if_salv_c_function_position=>right_of_salv_functions
).
ENDIF.