|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:
Fig. 1: Menu in transaction MB1A
del M[To reservation...]
The menu will then look as follows:
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:
Fig. 3: Toolbar and function keys in MB1A, no script active
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:
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:
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:
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.
Fig. 7: Hierarchical submenu
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
Explanation: 4=Movement type, 6=Scrapping reversal, 2=In consmt
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.