每個ALV功能被實現爲簡單的ALV一個單獨的類,所以你必須單獨處理它們。您不需要自定義控件。
爲了添加工具欄:
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
+1爲你的全面例子 – mydoghasworms
感謝您的詳細迴應,完美的作品! – digibit
值得注意的是,如果您不想要所有導出選項,則還有其他方法可用於設置較小的工具欄功能集。 **所有排序選項的SET_GROUP_SORT **,**打印的SET_PRINT **。大多是不言自明的。 – nath