Static and Dynamic Context Menu in ABAP Web Dynpro

...Previous

19.  Using context menu “Save Input” attached statically

20.  Using context menu “Reset Input” attached statically

21.  Using context menu “Clear table” attached dynamically

22.  Using context menu “Reload Initial data” attached dynamically

Summary. In this application, I am attaching context menu statically and dynamically to UI Elements.

For both (Static and dynamic) Context Menus, We need to design menu below “CONTEXT_MENUS” UI Element.  So, I designed “STATIC_MENU” and “DYN_MENU” menus.

For statically attaching context menu, we need to change “contextMenuBehaviour” property to “Provide” of desired UI Element. By default, this property value is “Inherit”. Then select property “contextMenuId” and select available menu for value. So, I changed “ROOTUIELEMENTCONTAINER” property and assigned “STATIC_MENU” by selecting against the property “contextMenuId”.

For dynamically attaching context menu, we need write code into hook method “WDDOONCONTEXTMENU”. Importing parameter “CONTEXT_MENU_EVENT” contains reference of UI Element and “CONTEXT_MENU_MANAGER” contains the list of available menu. Returning parameter “MENU” used to assign the required menu for Particular UI Element. So, I write the following code for attaching “DYN_MENU” menu to “TABLE” control.

  IF strlen( context_menu_event->originator->id ) > 4

AND context_menu_event->originator->id(5) = 'TABLE'.

 

menu = context_menu_manager->get_context_menu( 'DYN_MENU' ).

ENDIF.

 

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image