gpt4 book ai didi

toolbar - 全屏缺少ALV网格工具栏

转载 作者:行者123 更新时间:2023-12-04 13:43:29 24 4
gpt4 key购买 nike

我创建了一个简单的ALV网格,并用数据填充了网格,现在在选择屏幕之后显示了该网格。我没有使用自定义容器,而是以全屏显示网格。

是否有ALV网格对象的属性,该属性使工具栏具有通常位于网格顶部的按钮过滤器排序等?

到目前为止,这就是我所拥有的:

TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = gr_alv
CHANGING
t_table = tbl_data
).
CATCH cx_salv_msg.
ENDTRY.

* initialize the alv settings - nothing done here for the moment.
PERFORM define_settings USING gr_alv.

* Display the ALV
gr_alv->display( ).

最佳答案

每个ALV功能在Simple ALV中都实现为单独的CLASS,因此您必须分别处理它们。您不需要自定义控件。

为了添加工具栏:

data: lr_func TYPE REF TO CL_SALV_FUNCTIONS_LIST.
"Functions
lr_func = gr_alv->get_functions( ).
lr_func->set_all( ).

完整的ALV显示:
form display_results.

data: ls_key type salv_s_layout_key,

lo_table type ref to cl_salv_table,
lo_cols type ref to cl_salv_columns_table,
lo_events type ref to cl_salv_events_table,
lo_funcs type ref to cl_salv_functions_list,
lo_layout type ref to cl_salv_layout,
lo_display type ref to cl_salv_display_settings,
lo_selections type ref to cl_salv_selections.

try.
call method cl_salv_table=>factory
exporting
list_display = abap_false
importing
r_salv_table = lo_table
changing
t_table = gt_list.
catch cx_salv_msg . "#EC NO_HANDLER
endtry.
"Events
create object go_events.
lo_events = lo_table->get_event( ).
set handler go_events->double_click for lo_events.

"Layouts
ls_key-report = sy-repid.
lo_layout = lo_table->get_layout( ).
lo_layout->set_key( ls_key ).
lo_layout->set_default( abap_true ).
lo_layout->set_save_restriction( ).
lo_layout->set_initial_layout( p_var ).

lo_cols = lo_table->get_columns( ).
perform change_columns changing lo_cols.

"Functions
lo_funcs = lo_table->get_functions( ).
lo_funcs->set_all( ).

"Display Settings
lo_display = lo_table->get_display_settings( ).
lo_display->set_striped_pattern( abap_true ).

"Selections
lo_selections = lo_table->get_selections( ).
lo_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).

lo_table->display( ).
endform. " DISPLAY_RESULTS

关于toolbar - 全屏缺少ALV网格工具栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6575155/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com