In Web Dynpro ABAP you can create your own context menus for user interfaces both statically and dynamically. Specific UI elements and the WDDOONCONTEXTMENU hook method are provided for this purpose.
Unlike static context menus (see ContextMenuProvider ), you can define dynamic context menus so that, for instance, a different context menu can be displayed for a specific table row than the one displayed for other table rows.
Example of a table containing airlines
Context menu for airline AA:
Context menu for airline BA:
To define this type of context menu use the Hook Method WDDOONCONTEXTMENU. This method uses the import parameters CONTEXT_MENU_EVENT of type IF_WD_CONTEXT_MENU_EVENT and CONTEXT_MENU_MANAGER of type IF_WD_CONTEXT_MENU_MANAGER , and returns the context menu in parameter MENU of type CL_WD_MENU.
Example
You can find an example of dynamic context menus in the system in component DEMO_CONTEXT_MENU_DYNAMIC .
You can define context menus for your views in the view designer of the Web Dynpro explorer. These context menus are only taken automatically from the Web Dynpro ABAP Framework if they have also been declared for specific view elements using ContextMenuBehaviour and ContextMenuID.
You can also define a context menu statically without it being called automatically. In this case the context menu is merely defined, and you can then access it in WDDOONCONTEXTMENU to modify it.
Parallel to ROOTUIELEMENTCONTAINER, the CONTEXT_MENUS element in the view designer is used as a pool for all the context menus used by the view. Here all the context menus declared as static are created. Context menus are created in the same way as other UI elements - using the context menu.
Example:
For specific view elements (all inherited from CL_WD_CTXT_MENU_PROVIDER) there are also two additional properties: ContextMenuBehaviour and ContextMenuId. The purpose of these two properties is to enable you to determine statically which context menu is to be used by the framework.
Example
You can find an example of static context menus in the system in component DEMO_CONTEXT_MENU_STATIC .