Deleting menu items

Using the del command, you can delete menu items as well as submenus.  This is not difficult, but in order to point out the resulting effects on the  application toolbar, on the function key list and on the submenus, we will explain the procedure here in some detail.    

As an example, look at transaction MB1A in R/3 Rel. 4.6C. Here is a part of its main menu: 

Sap Guixt menuitems01 Deleting menu items

Fig. 1: Menu in transaction MB1A
 
In order to delete the menu item “To reservation…”, it suffices to write

del M[To reservation...]

 The menu will then look as follows:

Sap Guixt menuitems02 Deleting menu items

Fig. 2: Menu item [To reservation...] deleted

If there is a pushbutton in the application toolbar that performs the same action, GuiXT will remove it as well, together with the function key assigned to the pushbutton:

Sap Guixt menuitems03 Deleting menu items

Fig. 3: Toolbar and function keys in MB1A, no script active

Sap Guixt menuitems04 Deleting menu items

Fig. 4:  del M[To reservation...]  automatically deletes the button in the toolbar and also the function key 

In some cases there are several menu items with the same text. In transaction MB1A this is the case  for the [To reservation...] item, which occurs both in the “Create” and in the “Cancel” submenu:

Sap Guixt menuitems05 Deleting menu items

Fig. 5:   [To reservation...] occurs a second time 

GuiXT deleted only the first occurrence in the “Create” submenu. In order to distinguish the two items, the best way is to use the  function code instead of the text. You can see the function code when you press F1 on the menu item:

Sap Guixt menuitems06 Deleting menu items

Fig. 6:  Use F1 to display the function code behind a menu item 

Now, use the del command with the  function code instead of the item text:

del M[NFRS]

Incidentally, a user can  enter each function code directly in the OK-Code entry field, instead of using the menu item, the toolbar pushbutton, or the function key.  When you delete a menu item in the script, this would still be a secret way to  perform the hidden function.  This is why GuiXT automatically deletes all function codes that the user directly enters in the OK Code field, if they correspond to deleted menu items.

Hierarchical submenus can be deleted as well, using their text. In this case all single menu items contained in the submenu (or in a submenu of the submenu…) are deleted as well, again together with the toolbar pushbuttons and function keys, in cases where they are assigned to one of the functions.

Sap Guixt menuitems07 Deleting menu items

Fig. 7:  Hierarchical submenu 

Sap Guixt menuitems08 Deleting menu items

Fig. 8:  Hierarchical submenu after  del M[In consmt]

It is not possible to delete the top level menus (like “Goods issue”, “Edit”). If you remove all their items, they still remain on the screen, but they are empty. It is also not possible to remove any items or submenus in the “System” and “Help” menus.

Sometimes even submenus can have the same text. This is the case in MB1A with [In consmt], which exists both in [Insp. sample reversal] and in [Scrapping reversal]. The solution described above, using the function code, is not applicable here, since there are no function codes assigned to submenus. In such rare cases you can also work with the menu item position, denoted as   M[i,j,k,l], where i,j,k,l are up to 4 numbers denoting the hierarchical positions, starting with 1. In our example, this is

del M[4,6,2]

Explanation: 4=Movement type, 6=Scrapping reversal, 2=In consmt

Sap Guixt menuitems09 Deleting menu items

Fig. 9:  Menu item positions

A final tip: if you need to work with absolute positions, please count the positions before any del M[...] is active.

Deleting menu items