on 09-30-2008 12:19 PM
I have created a new Menu item in sap B1 application for my addon using the code below
With SBO_Application
oTechDemoRoot = .Menus.Item(5).SubMenus.Add(strTechDemoRootMenu, m_Name, SAPbouiCOM.BoMenuType.mt_POPUP, 0)
oTechDemoRoot.Image = System.Windows.Forms.Application.StartupPath + "\sap.bmp" 'add subitems and submenus to customized menu root
With oTechDemoRoot
'add submenu items to addon root
oTechDemoRoot = .SubMenus.Add("TMCADDon_0", "TMC DB Access", SAPbouiCOM.BoMenuType.mt_STRING, 1)
End With
End With
The menu item and sub items are appearing, but the image is not loaded. It shows an error, Cannot Load Image File.
please help..
Here an example of adding menu:
Hope this help you.
Private Function AddMenuItems() As Boolean
Dim b As Boolean = True
Dim sPath As String = System.Windows.Forms.Application.StartupPath() & "\"
Dim oMenus As SAPbouiCOM.Menus
Dim oMenuItem As SAPbouiCOM.MenuItem
Dim oCreationPackage As SAPbouiCOM.MenuCreationParams
oCreationPackage = m_oSBOApp.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
Try
oMenuItem = m_oSBOApp.Menus.Item("43520") 'moudles'
oMenus = oMenuItem.SubMenus
Catch ex As Exception
b = False
End Try
Try ' If the menu already exists this code will fail
' Creation parameters
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP
oCreationPackage.UniqueID = "O01_MY_MENU"
oCreationPackage.String = "MY MENU"
oCreationPackage.Image = sPath & "logo16x16.bmp"
oMenus.AddEx(oCreationPackage)
Catch ex As Exception ' Error Handling
End Try
Return b
End Function
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi...
try this code..
Private Sub AddMenuItem()
Dim oMenuItem As SAPbouiCOM.MenuItem
Dim oMenus As SAPbouiCOM.Menus
Dim oCreationPackage As SAPbouiCOM.MenuCreationParams
oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
oMenuItem = SBO_Application.Menus.Item("urschoice")
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
If SBO_Application.Menus.Exists("XXXX") Then
SBO_Application.Menus.RemoveEx("XXXX")
End If
oCreationPackage.UniqueID = "XXXX"
oCreationPackage.String = "menuname"
oCreationPackage.Enabled = True
oCreationPackage.Checked = True
oCreationPackage.Position = 0
oCreationPackage.Image = SPath & "\XXX.bmp"
oMenus = oMenuItem.SubMenus
oMenus.AddEx(oCreationPackage)
LoadFromXML()
End Sub
Regards...
Billa 2007
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Check if exist image in the path: System.Windows.Forms.Application.StartupPath + "\sap.bmp"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
96 | |
10 | |
9 | |
6 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.