2011-05-11 43 views
2

我正在爲SAP業務開發一個工資加載項8.81。我可以在SAP應用程序附帶的最後一個菜單項下添加菜單,即Reports。我試圖在SAP的Administration/Setup(管理/設置)菜單下爲我的工資單加載項添加一個設置子菜單。在SAP業務管理菜單下創建子菜單(文件夾)8.81

有誰知道如何做到這一點?

下面的代碼僅顯示如何在SAP的Reports菜單下添加菜單。

這是C#和文件名是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); 

如何內SAP業務1已經創建了菜單項中添加子文件夾?

回答

1

剛將oMenuItem = this.app.Menus.Item("43530");更改爲oMenuItem = this.app.Menus.Item("43525");而且它的工作原理