<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Regarding context menus in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-context-menus/m-p/4156856#M993808</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi vansri,&lt;/P&gt;&lt;P&gt;   go thro this link which will guide thro the creation of context menu.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step by step process&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="469568"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;context menu for module pool&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="942552"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;creation of context menu using class&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="5169315"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Arun.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Jul 2008 08:23:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-18T08:23:09Z</dc:date>
    <item>
      <title>Regarding context menus</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-context-menus/m-p/4156854#M993806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to create contextmenus in the dilog module programing ?&lt;/P&gt;&lt;P&gt;my requirement is to create expand and collapse contextmenus.?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can anyone help how to do expand and collapse contextmenus?? step by step process..?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2008 07:55:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-context-menus/m-p/4156854#M993806</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-18T07:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding context menus</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-context-menus/m-p/4156855#M993807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi , &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check for sample programs in Tcode DWDM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;prabhu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2008 08:03:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-context-menus/m-p/4156855#M993807</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-18T08:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding context menus</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-context-menus/m-p/4156856#M993808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi vansri,&lt;/P&gt;&lt;P&gt;   go thro this link which will guide thro the creation of context menu.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step by step process&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="469568"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;context menu for module pool&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="942552"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;creation of context menu using class&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="5169315"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Arun.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2008 08:23:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-context-menus/m-p/4156856#M993808</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-18T08:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding context menus</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-context-menus/m-p/4156857#M993809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Context Menus &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The user interface of a screen is defined by a GUI status, which you define in the Menu Painter and assign the type Dialog status. For each dialog status, the system automatically creates a standard context menu, which the user can display by clicking the right-hand mouse button on the screen (or choosing Shift+F10 ). The standard context menu contains all of the function keys to which functions are assigned. It therefore makes it easy to access any function code that is available using the keyboard, since normally only the most important are assigned to the application toolbar. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, as well as the standard context menu, you can define context-specific menus for any of the following screen elements: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Input/output fields &lt;/P&gt;&lt;P&gt;Text fields &lt;/P&gt;&lt;P&gt;Table controls &lt;/P&gt;&lt;P&gt;Group boxes &lt;/P&gt;&lt;P&gt;Subscreens&lt;/P&gt;&lt;P&gt;When you select one of these elements using the right-hand mouse button, you can create a dynamic context menu in the ABAP program. This may contain any functions, and is not restricted to function keys. You cannot assign context menus to pushbuttons, checkboxes, or radio buttons. However, you can assign unique function codes to them instead. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Global Class CL_CTMENU&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Context menus are objects of the global ABAP Objects class CL_CTMENU. In the class library, the class belongs to the Frontend Services component, in which the classes of the Control Framework are also stored (see Custom Controls). It contains methods that allow you to define context menus dynamically in a program. As a template, you can create your own context menus statically in the Menu Painter. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The most important methods of the class CL_CTMENU are: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Method&lt;/P&gt;&lt;P&gt;Function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD_GUI_STATUS&lt;/P&gt;&lt;P&gt;Assigns a context menu that has already been defined statically in the Menu Painter to a local context menu in a program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ADD_FUNCTION&lt;/P&gt;&lt;P&gt;Assigns a single function to a context menu in a program &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ADD_MENU&lt;/P&gt;&lt;P&gt;Assigns another local context menu to the current local context menu in the program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ADD_SUBMENU&lt;/P&gt;&lt;P&gt;Assigns another local context menu to the current local context menu in the program as a cascading menu&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ADD_SEPARATOR&lt;/P&gt;&lt;P&gt;Adds a separator&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIDE_FUNCTIONS&lt;/P&gt;&lt;P&gt;Hides functions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SHOW_FUNCTIONS&lt;/P&gt;&lt;P&gt;Shows functions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DISABLE_FUNCTIONS&lt;/P&gt;&lt;P&gt;Deactivates functions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENABLE_FUNCTIONS&lt;/P&gt;&lt;P&gt;Activates functions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET_DEFAULT_FUNCTION&lt;/P&gt;&lt;P&gt;Sets a default function, which is highlighted when the menu is displayed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the above table, "local context menu in a program" means an object of class CL_CTMENU. You use CL_CTMENU in different ways depending on the context: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use a context menu in a control, whether or not you need to create objects of the class CL_CTMENU depends on the wrapper of the class. (The relevant functions may already be encapsulated in the control class.) Normally, control users do not have to create their own context menus. This ensures that no conflicts occur with the event handling of the control. For further information, refer to the documentation of the individual control classes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you define a context menu on a screen (or list), the relevant objects of class CL_CTMENU are created automatically by the runtime environment, not explicitly in the program. References to the object are passed as the parameters of special callback routines in the ABAP program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Context Menus for Elements on Screens&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to link a context menu with one of the screen elements above, you only need to enter an ID &amp;lt;context&amp;gt; in the Context menu field in the element attributes in the Screen Painter. If you do not define a context menu for a particular screen element, it inherits the context menu from the hierarchically next-highest element. For example, all screen elements in a group box that do not have their own context menu would inherit the context menu of the group box. The highest hierarchy level is the default context menu, containing all of the key settings of the current dialog status. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If a screen element is linked with a context menu u2013 either its own or one that it has inherited, a special subroutine &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ON_CTMENU_&amp;lt;context&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is called in the ABAP program when the user clicks the right-hand mouse button. The PAI event is not triggered. You use this subroutine (callback routine) to define the context menu dynamically. You must program it in the processing logic. If the subroutine does not exist, the context menu is not displayed. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can link the same context menu &amp;lt;context&amp;gt; to any number of screen elements. They then all work with the same subroutine. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Defining Context Menus in the Processing Logic&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For each context menu that you want to call for an element on a screen, you need to program a corresponding callback routine: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM ON_CTMENU_&amp;lt;context&amp;gt; USING &amp;lt;l_menu&amp;gt; TYPE REF TO cl_ctmenu.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Each routine must have a single USING parameter, typed as a reference variable to class CL_CTMENU. For each context menu assigned to an element on a screen, the runtime environment automatically creates an object of the class. When the user requests the context menu by clicking the right-hand mouse button, the system calls the corresponding subroutine and passes a reference to the corresponding object to the formal parameter. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the object is passed it is initial u2013 the context menu contains no entries. In the subroutine, you can work with the methods of the object (as listed above) to construct the context menu dynamically. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using Predefined Context Menus&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As well as dialog statuses and dialog box statuses, there is a third kind of GUI status that you can define in the Menu Painter, namely a context menu. To find out how to create context menus in the Menu Painter, refer to Creating Context Menus. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Predefined context menus allow you to make groups of statically-defined function coded available context-specifically. The method LOAD_GUI_STATUS allows you to load a context menu from any ABAP program into a local context menu in a program. As a rule, you use predefined context menus to reuse the function codes from a dialog status with the same semantics, but context-specifically. Once you have loaded a predefined context menu into a local context menu in a program, you can modify it in any way (append other predefined context menus, add or remove functions, add other context menus). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Defining New Context Menus&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can create new context-specific menus either by modifying existing ones or by constructing new menus. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can add any number of new functions to a context menu. When you add a new function, you must specify the function text, function code, and function type (for example, E for an unconditional module call). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, you can also add any other local context menu from the program. In this case, you only have to pass a reference to another context menu (see example below). You can create a collection of context menu objects in your program and use and combine them as necessary. You can also construct submenus. You can have deep-nested menus by adding submenus to existing submenus. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ergonomic Guidelines&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you create context menus, you should observe the following rules: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The functions in a context menu should be a subset of the functions in the program You can ensure this by using predefined context menus &lt;/P&gt;&lt;P&gt;Context menus should not contain more than ten entries at a single level. &lt;/P&gt;&lt;P&gt;If you use a context menu for a screen element, it should contain all of the functions possible for that element, but at least the standard comments such as Select, Copy, Cut, and Paste. &lt;/P&gt;&lt;P&gt;The sequence of the functions should be as follows: Object-specific commands, copy commands, other commands. &lt;/P&gt;&lt;P&gt;You should not duplicate functions that can be selected using the left-hand mouse button in a context menu. &lt;/P&gt;&lt;P&gt;Displaying the Context Menu&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you have defined the context menu dynamically in the callback routine, the system displays it on the screen immediately. When the user chooses a function from the menu, the system triggers the PAI event and places the corresponding function code in SY-UCOMM and the OK CODE field. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;sowjanya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2008 11:56:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-context-menus/m-p/4156857#M993809</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-23T11:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding context menus</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-context-menus/m-p/4156858#M993810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ANS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Sep 2008 10:06:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-context-menus/m-p/4156858#M993810</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-11T10:06:30Z</dc:date>
    </item>
  </channel>
</rss>

