There are different ways how to change the ECTR context menus or toolbars.
You can either overwrite the default or enhance it.
As a customer you can simply change the configuration file of the menu to create your own customer specific one.
When implementing an ECTR Add-On you don't want to modify the default menu but rather enhance it with your own entries without replacing the ECTR standard.
Those two approaches are described in the chapters below.
Creating a Customer Specific Menu
When ECTR is installed for the first time a customizing folder is created in the ECTR installation directory (<ECTR_INSTDIR>\customize\).
During an update this customizing is not overwritten but all new default customizing settings are stored in folder 'template-customize'.
So all changes that are performed to customize ECTR are untouched during every update.
Modifying the Menu
In order to change the menu entries you need to edit file '<ECTR_INSTDIR>\customize\config\menu.guidef':
When defining a menu a new section is indicated by a "+" as the first character in a line. This line then starts a block of associated definitions that ends with the next line that does not contain "=". Within this block, each line, where the "=" has the same indentation as the first line's "=" sign is considered to be a first level entry, all others are second level entries. Since the processing program uses the character count to determine the indentation, you may not use tabs in this file, because this will result in different character count although the "=" signs appear to be aligned.
Some sections of the menus that are often used are defined in a second file 'menu_macros.txt' in the same folder:
A "?" in the first column starts a macro definition. A macro is a series of menu commands, that will be inserted at the point of reference. This makes it possible to have one central definition in cases where a set of commands is needed more than once.
Definition of Labels
The definition of customer specific labels is described here.
Definition of Icons
The definition of customer specific icons is described here.
Calling Backend Functions
All RFC enabled function modules that can be called from ECTR directly e.g. from a context menu need to be defined in a certain XML format.
The default functions which are already delivered with the ECTR standard can be found in file '<ECTR_INSTDIR>\basis\aux-files\api_definitions2.xml'.
For adding customer specific APIs you should use file '<ECTR_INSTDIR>\customize\aux-files\api_definitions2.xml'.
In the API definition you can either hard code the parameter values like you can see in the example above for parameter 'SKIP_FIRST_SCREEN', which is set to value 'X' or you can use a set of ECTR internal variables, like:
- WORKITEM - WI_ID
Using those variables allows to trigger context sensitive backend functions for the selected class, document or material for example.
In order to integrate a function call into a menu you need to use the statement 'fnc.api.generic2(<function_name>)', like shown in the example below:
Extending the Default Menu (for Add-Ons)
The steps that are needed when extending the default context menu are similar to creating a customer specific context menu.
But instead of changing the context menu definition directly you create a menu_macros.txt file in you're add-on directory which contains the extension, like shown in the example below:
In the example the menu “om.popup.menu.DOC.STM” is extended by two additional entries.
The definition of the menu extension is as followed.
The definition of labels, icons and so on also needs to be located in the according folders of your add-on directory.