Entering content frameProcess documentation Using Static Dropdown Menus Locate the document in its SAP Library structure

Purpose

Pushbuttons in the SAP Toolbar that have a dropdown menu (type cntb_btype_dropdown or cntb_btype_menu ) normally trigger the event DROPDOWN_CLICKED when the user chooses them. In this event, you assign a context menu to the button, which the system then displays as a dropdown menu to the button. This happens every time the user chooses the button, even if the menu does not change from one time to the next.

To avoid this situation, which can be particularly inefficient in the SAPGUI for HTML environment, it is now possible to assign a context menu statically to a button with a dropdown menu. When you do this, the context menu remains assigned to the pushbutton for the entire lifetime of the toolbar, and the DROPDOWN_CLICKED event is no longer triggered, which reduces the number of round trips required.

Should you change the contents of the context menu after assigning it to a button in the toolbar, the system ensures that the dropdown menu in the toolbar is updated accordingly.

Prerequisites

You must already have created an instance of the SAP Toolbar. It must contain one or more buttons with the type cntb_btype_dropdown or cntb_btype_menu .

Process Flow

  1. For each dropdown menu that you want to define statically, create a reference variable with reference to the class CL_CTMENU .
  2. Create and fill the context menu objects. For further information, refer to Structure link Context Menus.
  3. Use the toolbar control method set_static_ctxmenu to assign the context menu to a button in the toolbar. Alternatively, to assign menus to more than one button, use the method assign_static_ctxmenu_table.

Example

For an example, refer to the Creating and Filling the Dropdown Menus section of the coding example.

 

 

 

Leaving content frame