Copyright 2024 - BV TallVision IT

Add functionality to the menu of your ALV list and respond to it, or remove functionality you don't need/want.

Show or hide menu options

You have control over the functions that are available in ALV lists. The will apply logic to determine whether functions should be available, such as the ∑-button (only available when at least 1 column with numeric values is available). If you want to deny your user the sort functions, because your output is very time-relevant, follow this example (where go_salv is an instance of class CL_SALV_TABLE): 

data: lrf_functions_list type ref to CL_SALV_FUNCTIONS_LIST.
* Set the functions lrf_functions_list = go_salv->get_functions( ). lrf_functions_list->set_all( ). "Use all available

 The CL_SALV_FUNCTIONS_LIST class holds numerous methods with which settings can be made available or hidden. Some examples: SET_EXPORT_SEND and SET_EXPORT_SPREADSHEET, but also SET_SORT_ASC or SET_PRINT_PREVIEW can all be switched on or off individually.

  lrf_functions_list->set_group_sort( abap_false ). 

.. will hide all sort functionality of the ALV report.

Add custom menu options

To add new menu options, you will need to create your own menu. E.g. copy the menu from the user interface SAPLSLVC_FULLSCREEN interface STANDARD_FULLSCREEN, and do your changes (additions) on the copied version. Note that this approach only works with full screen ALV reporting. 

To use the menu, call method SET_SCREEN_STATUS which can be found on your instance of CL_SALV_TABLE

Check out the article on "Interactive ALV", which will explain how responding to a (new) menu command is done.