on 11-15-2012 6:32 AM
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
Hi Sunny,
Catch the event when user click you menu,
then execute this :
SBO_Application.ActivateMenuItem("DefaultFormUID")
Where DefaultFormUID is the MenuUID of your from under Tools->User Defined Windows.
Note that this DefaultFormUID is dynamic. when you create another UserDefinedWindows, this menuUID will change.
You need to look up for the correct menu UID.
Check out this Post
Regards
Edy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Edy
I have written like this . it's not working . If i write only this SBO_Application.ActivateMenuItem("51201") then it works.
Private Sub SBO_Application_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.MenuEvent
If pVal.BeforeAction = False Then
Select Case pVal.MenuUID
Case "MySubMenu"
Dim oMenu As SAPbouiCOM.MenuItem
Dim i As Integer
Dim menuuid As Long
oMenu = SBO_Application.Menus.Item("51201")
For i = 0 To oMenu.SubMenus.Count - 1
If oMenu.SubMenus.Item(i).String = "TEMP" Then
menuuid = oMenu.SubMenus.Item(i).UID
Exit For
End If
Next
SBO_Application.ActivateMenuItem(MenuUID)
'SBO_Application.ActivateMenuItem("51201")
End Select
End If
End Sub
User | Count |
---|---|
89 | |
7 | |
7 | |
4 | |
4 | |
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.