cancel
Showing results for 
Search instead for 
Did you mean: 

error in add to "Module" menu

Former Member
0 Kudos

Hi, all.

During addition to the menu (SAP BO 6.5) I get an error:

<Menu - not found>

Sample code here:


Dim oMenu As SAPbouiCOM.Menus
Set oMenu = oSBOApp.sboApp.Menus(4).SubMenus 'a problem is here

If anybody know what a reason for this error?

Tnx.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Dim sboGuiApi As SAPbouiCOM.sboGuiApi
Dim oMenu As SAPbouiCOM.Menus
Dim oMenuItem As SAPbouiCOM.MenuItem

Set sboGuiApi = New SAPbouiCOM.sboGuiApi
sboGuiApi.Connect stConnectionString
Set sboApp = sboGuiApi.GetApplication
Set sboGuiApi = Nothing

Set oMenu = oSBOApp.sboApp.Menus(4).SubMenus 'here error
Set oMenuItem = oMenu.Add("[UNIQUE_NAME]", "[CAPTION_STRING]", mt_POPUP, 0)

variable sboApp declared in module as public WithEvents.

Tnx

barend_morkel2
Active Contributor
0 Kudos

Dim oMenus As SAPbouiCOM.Menus

Dim oMenu As SAPbouiCOM.MenuItem

'Get the menus collection from the application

Set oMenus = SBO_Application.Menus

' Point on the module sub menu

Set oMenu = SBO_Application.Menus.Item("43520")

Set oMenus = oMenuItem.SubMenus

Set oMenu = oMenus.Item("4")

Former Member
0 Kudos

Tnx, Barend.

But this code:

' Point on the module sub menu

Set oMenu = SBO_Application.Menus.Item("43520")

correct <u>only</u> for SAP 2004.

I need to solve problem on SAP BO 6.5

barend_morkel2
Active Contributor
0 Kudos

I used this code - way back in 6.5

Dim oMenus As SAPbouiCOM.Menus

Dim oMenuItem As SAPbouiCOM.MenuItem

' Get the menus collection from the application

Set oMenus = SBOUIApp.Menus

' Find the place in wich to add the Pop Up Menu

Set oMenuItem = oMenus.Item("43520") 'Modules

Set oMenus = oMenuItem.SubMenus

' Check if the menu Item exists

If Not oMenus.Exists("Video Store") Then

' Add the menu collection of submenus

Set oMenuItem = oMenus.Add("Video Store", "Video Store", mt_POPUP, oMenus.Count)

'Add the sub menus

Set oMenuItem = oMenus.Item("Video Store")

Set oMenus = oMenuItem.SubMenus

Set oMenuItem = oMenus.Add("Movies On Shelf", "Movies On Shelf", mt_STRING, oMenus.Count)

Set oMenuItem = oMenus.Add("Movie Location", "Movie Location", mt_STRING, oMenus.Count)

Set oMenuItem = oMenus.Add("Add Movie", "Add Movie", mt_STRING, oMenus.Count)

Set oMenuItem = oMenus.Add("Rent/Return Movie", "Rent/Return Movie", mt_STRING, oMenus.Count)

Former Member
0 Kudos

Tnx, Barend.

But I'm repeat:

this code


Set oMenuItem = oMenus.Item("43520") 'Modules

correct only for SAP 2004.

In any case, I'm think that I found the solution.

I'm just separate next cod to 2 rows.

was:

Set oMenu = Set oMenu = oSBOApp.sboApp.Menus(4).SubMenus

and now it look like this:

Set oMenu = oSBOApp.sboApp.Menus(4)

Set oSubMenu = oMenu.SubMenus

tnx to all.

With best regards.

Spart

Former Member
0 Kudos

Could u give us more code?

Former Member
0 Kudos

could you show us more code?