Skip to Content
0
Former Member
Nov 15, 2012 at 06:32 AM

Option under New Module

15 Views

Hi

I have created 1 UDT with 3 fields . It appears under Tools->User Defined Windows when i click Form Opens . I want this form to open under a Sub Menu i created .

Private Sub AddMenuItems()

Dim oMenus As SAPbouiCOM.Menus

Dim oMenuItem As SAPbouiCOM.MenuItem

oMenus = SBO_Application.Menus

Dim oCreationPackage As SAPbouiCOM.MenuCreationParams

oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)

oMenuItem = SBO_Application.Menus.Item("43520")

Dim sPath As String

sPath = Application.StartupPath

sPath = sPath.Remove(sPath.Length - 3, 3)

oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP

oCreationPackage.UniqueID = "MyMenu"

oCreationPackage.String = "New Module"

oCreationPackage.Enabled = True

oCreationPackage.Image = sPath & "UI.bmp"

oCreationPackage.Position = 15

oMenus = oMenuItem.SubMenus

Try ' If the manu already exists this code will fail

oMenus.AddEx(oCreationPackage)

'// Get the menu collection of the newly added pop-up item

oMenuItem = SBO_Application.Menus.Item("MyMenu")

oMenus = oMenuItem.SubMenus

End Sub

Thanks