2

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 i.e. 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 One?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Kinyanjui Kamau
  • 1,890
  • 10
  • 55
  • 95

1 Answers1

1

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

Kinyanjui Kamau
  • 1,890
  • 10
  • 55
  • 95