Skip to Content
avatar image
Former Member

Create events for menus

I have the following code

public static void AddMenus() {

AddMenuItem(SAPbouiCOM.BoMenuType.mt_POPUP, 15, "My Module", "MyMenu", "43520");

AddMenuItem(SAPbouiCOM.BoMenuType.mt_STRING, -1, "Maintain Master", "MySubMenu", "MyMenu");

AddMenuItem(SAPbouiCOM.BoMenuType.mt_POPUP, -1, "Maintain Transactions", "MySubMenu0", "MyMenu");

AddMenuItem(SAPbouiCOM.BoMenuType.mt_STRING, -1, "Maintain Transactions_1", "MyMenu2_1", "MySubMenu0");

AddMenuItem(SAPbouiCOM.BoMenuType.mt_STRING, -1, "Maintain Transactions_2", "MyMenu2_2", "MySubMenu0");

AddMenuItem(SAPbouiCOM.BoMenuType.mt_STRING, -1, "Maintain Transactions_3", "MyMenu2_3", "MySubMenu0");

}

public static void AddMenuItem(SAPbouiCOM.BoMenuType boMenuType, int Position, String String, String UID, String Parent) {

if (SBO_Application.Menus.Exists(UID)) {

return; }

SAPbouiCOM.MenuCreationParams oCreParams = (SAPbouiCOM.MenuCreationParams)SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams);

oCreParams.Type = boMenuType; oCreParams.Position = Position; oCreParams.String = String;

oCreParams.UniqueID = UID;

SBO_Application.Menus.Item(Parent).SubMenus.AddEx(oCreParams);

}

I need to create events for the menu, how can I do it?..

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jun 21, 2017 at 10:05 AM

    Hi Jesus,

    Refer to the UI sample code from the following location:

    C:\Program Files (x86)\sap\SAP Business One SDK\Samples\COM UI\CSharp\02.CatchingEvents

    It can be used as below:

    SBO_Application.MenuEvent += new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler( SBO_Application_MenuEvent );
    

    Kind regards,

    ANKIT CHAUHAN

    SAP SME Support

    Add comment
    10|10000 characters needed characters exceeded