Page tree
Skip to end of metadata
Go to start of metadata

Introduction

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':

ECTR Menu Definition
+  om.popup.menu.FLD                    = fnc.fld.setActive
                                        = -----------------------------
                                        = ? FOLDER_NEW
                                        = -----------------------------
                                        = ? FOLDER_ADD
                                        = -----------------------------
                                        = fnc.fld.delete
                                        = fnc.fld.rename

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:

ECTR Menu Macro Definition
? FOLDER_NEW                  = mnu.flyout.New
                                  = fnc.fld.create
                                  = fnc.doc.create.mm
                                  = fnc.mat.create.alone
                                  = fnc.ecm.create

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'.

ECTR Backend API Definitions
<Generic_API_Calls>
    <function apiname="/DSCSAG/TRANSACTION_CALL2" name="CLASS_DISPLAY" transaction="bright" type="class">
        <import>
            <parameter name="TCODE" string="CL03"/>
            <parameter name="SKIP_FIRST_SCREEN" string="X"/>
            <parameter name="CLASSNUM" value="CLASSNAME"/>
            <parameter name="CLASSTYPE" value="CLASSTYPE"/>
        </import>
        <tables/>
    </function>
</Generic_API_Calls>

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:

  • type="class"
    • CLASSNAME
    • CLASSTYPE
  • type="material"
    • MATERIALNUMBER_INT
  • type="document"
    • DOCUMENTNUMBER_INT
    • DOCUMENTTYPE
    • DOCUMENTPART
    • DOCUMENTVERSION
  • type="equipment"
    • EQUIPMENT
    • EQUIPMENT_EXT  
  • type="funcloc"
    • FUNCLOC
  • type="workitem"
    • WORKITEM - WI_ID
  • type="ecr"
    • ECR_GUID

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:

ECTR Menu Definition with Function Call
+  om.popup.menu.CLH                    = fnc.api.generic2(CLASS_DISPLAY)

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:

menu_macros.txt
? extensions--om.popup.menu.DOC.STM = fnc.doc.regenerate(single,dsc_createDerivedOriginal.exe)
 				    = fnc.api.generic2(mmbe_mat)

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.

menu_macros.txt
? <addonname>--<menuname> = <menu entry>

The definition of labels, icons and so on also needs to be located in the according folders of your add-on directory.

2 Comments

  1. Please help regarding Generic_API_Calls. I would like to handover the strucure PLM_DOKUMENT (that is used by the CDESK CAD integrations) to a RFC enabled function module. PLM_DOKUMENT should contain the data of the selected documents. Can anyone provide an example?

    1. It is not a good idea to call CDESK - FM direct. E.g. if you like to call CDESK_SHOW you have at first to call CDESK_INIT in same session. This is not possible with the generic api call. Same story with CDESK_BOM_WIZARD.

      Anyway: Structures can be used like that:

         <function name="mat_bom_create" type="material" apiname="/DSCSAG/MAT_BOM_RFC_CREATE" transaction="bright">       <import>         <structure name = "MATERIAL_HEADER_DATA">            <parameter name="MATNR" value="MATERIALNUMBER_INT"/>            <parameter name="LABOR" string="001"/>         </structure>       </import>       <tables/>    </function>