Enable Button Configuration on Overview Pages - How to Guide
The button configuration provides an easy way to create, modify, and delete buttons from overview pages without the need to write any ABAP code. It can be used to replace the current implementation of buttons on overview pages, but a few changes to the view controller will be necessary to activate the feature. This how to guide will give an overview of what needs to be done to enable the button configuration, how it can be used and about its constraints.
The feature has been developed in EhP3 and is also available with SP05 of EhP2. It's also possible to implement the correction instructions attached to note 1735540, but due to their complexity this is not advised.
How to Use
How to Use at Customer Site
Implementing the button configuration as enhancement
It's possible to use the enhancement concept to enable an SAP-delivered application component to support the button configuration. To achieve this all steps described above have to be applied to the enhanced view controller.
How to enable the button configuration for an overview page
While rendering the overview page the method IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS of the class CL_BSP_WD_WINDOW will be called to determine the buttons to be displayed in the overview page toolbar. Before the introduction of the button configuration the method implementation forwarded the call to the overview page view controller, which has to be implemented by application development. The method IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS has now been enhanced to check if the view controller implements the marker interface IF_WCF_BUTTON_CONFIG_CALLBACK. This interface indicates that the overview page is running in button configuration mode.
The first step to activate button configuration for an overview page is therefore to implement the interface IF_WCF_BUTTON_CONFIG_CALLBACK on the view controller class Now the configuration will be read to determine the toolbar buttons instead of calling the method IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS on the view controller. Refer to section Marker Interface IF_WCF_BUTTON_CONFIG_CALLBACK for more details.
Once the marker interface is implemented it will be possible to maintain the button configuration in the overview page configuration. A new assignment block Button Configuration will be available, which contains an input field to specify the maximum number of visible buttons and a table of buttons. More details concerning the table maintenance can be found in section Overview Page Configuration Details.
This will now replace the previous toolbar buttons with the buttons configured for this overview page. The only missing piece is now to modify the static configuration depending on runtime information while rendering. The decision if a button is enabled for example can often only be taken at runtime. The marker interface provides therefore two methods that allow developers to modify the configuration data depending on the context. Further details are available in section Marker Interface IF_WCF_BUTTON_CONFIG_CALLBACK.
How to distribute button configurations internally
It has to be considered that the button configuration has a different scope of visibility than the implementation of the overview page toolbar in the view controller's IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS function. This means that a configuration has to be provided for each config key after switching an overview page to button configuration, or otherwise the toolbar will not show any buttons. The report WCF_DISTR_BTN_CONFIG_INTERNAL has been provided to facilitate this work, as it allows to distribute the button configuration for a specified view without modifying the view configuration.
Question: My newly distributed button configuration isn't getting applied?
Answer: <Report BSP_DLC_ADMIN_CONFIG_PRE_PRF01 to clear pre-processed configurations>
Marker Interface IF_WCF_BUTTON_CONFIG_CALLBACK
This marker interface has to be implemented to enable the button configuration. It will also permit the maintenance of buttons in the overview page configuration. The interface defines the two methods MODIFY_BUTTONS and MODIFY_NUM_OF_VISIBLE_BUTTONS, which will be called by the class CL_BSP_WD_WINDOW when rendering the overview page toolbar.
- MODIFY_BUTTONS - The method has a changing parameter CT_BUTTONS of type CRMT_THTMLB_BUTTON_EXT_T, which is the tabular version of the button configuration details. It contains all information required to render the toolbar. It's possible to modify the toolbar data according to the requirements of the application. This can for example be used to activate/deactivate buttons.
- MODIFY_NUM_OF_VISIBLE_BUTTONS - The method has one returning parameter RV_MAX_BUTTON_NUMBER of type I. The returned value will override the configured value for Maximum Number of Buttons Displayed.
Overview Page Configuration Details
The following fields can be maintained per button.
- ID - The id of the button to be configured
- Text - The text to be displayed on the button. If a Type is specified this field can be left blank. It's possible to specify the alias of an OTR text that is to be used to render the button (e.g. OTR(CRM_BSP_UI_FRAME_BRC/AUTHORIZATION_ROLES))
- Tooltip - The tooltip of the button. Like the Text it can be left blank if a Type is specified and OTR texts can be used.
- Icon Source - Enables the user to specify the URL of an icon to be displayed (e.g. /SAP/BC/BSP/SAP/thtmlb_styles/sap_skins/serenity/images/edit.gif)
- Type - Defines the type of a pre-defined standard button (e.g. SAVE, CANCEL). If a type is defined the attributes text, tooltip and icon source will be filled automatically.
- Enabled - Specifies if the button is to be enabled or disabled.
- Backend Event - Defines the name of a backend event, which will be triggered when the button is pressed.