简体   繁体   中英

Creating sub menus (folders) under the Administration menu in SAP business one 8.81

I am developing an payroll add-on for SAP business one 8.81. I can be able to add menus below the last menu item that comes with the SAP application ie Reports. I am trying to add a setup submenu for my payroll add-on under the Administration/Setup menu of SAP.

Does anyone know how to do this?

The code below just shows how to add menu's below the Reports menu of SAP.

It is in c# and the file name is GUI.cs

oCreationPackage = ((SAPbouiCOM.MenuCreationParams)(app.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)));

                oMenuItem = this.app.Menus.Item("43520");

                string sPath = Application.StartupPath;
                //parent menu
                oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP;
                oCreationPackage.UniqueID = "eim_payroll";
                oCreationPackage.String = "EIM Payroll";
                oCreationPackage.Enabled= true;
                oCreationPackage.Position = 15;
                oCreationPackage.Image = sPath + @"\EIM_Payroll_icon.bmp";

                oMenus = oMenuItem.SubMenus;

                //If the menu already exists this code will fail
                oMenus.AddEx(oCreationPackage);

                //Get the menu collection of the newly added pop-up item
                oMenuItem = this.app.Menus.Item("eim_payroll");
                oMenus = oMenuItem.SubMenus;

                //create the setup menu item for master data
                oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP;
                oCreationPackage.UniqueID = "setup";
                oCreationPackage.String = "Setup";
                oMenus.AddEx(oCreationPackage);

                oMenuItem = this.app.Menus.Item("setup");
                oMenus = oMenuItem.SubMenus;

                //Get the menu collection of the newly added pop-up item
                oMenuItem = this.app.Menus.Item("setup");
                oMenus = oMenuItem.SubMenus;

                //create the payroll menu item for master data
                oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP;
                oCreationPackage.UniqueID = "payroll1";
                oCreationPackage.String = "Payroll";
                oMenus.AddEx(oCreationPackage);

How do I add subfolders within the menu items already created within SAP business 1?

Just changed oMenuItem = this.app.Menus.Item("43530"); to oMenuItem = this.app.Menus.Item("43525"); and it worked

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM