Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Menu Item Image

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..

Former Member
Former Member replied

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)

	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"

    Catch ex As Exception ' Error Handling
    End Try

    Return b

End Function

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question