cancel
Showing results for 
Search instead for 
Did you mean: 

Adding separation line to context menu

Former Member
0 Kudos

Hi all,

I am using SAP SDK to build addon using Visual Studio and C#.

I have a problem with adding separation line into context menu.

This problem looks trivial, I guess I am doing it correct with SAP B1, however maybe there is something wrong in my code.. So please correct me or maybe there is another way to do so ? Maybe someone have found a workaround if straight way doesn't work ?
The issue seems strange since normal menu items, submenus are working well doing similar code way.

The form I want to update this time is Item Master Data.

Below I paste the code I am trying to do the issue with:

SAPbouiCOM.MenuCreationParams menuParams = ConnectionHolder.Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams); // this is sap service object operating context menu
                    SAPbouiCOM.MenuItem menuItem = ConnectionHolder.Application.Menus.Item("1280"); // here I get certain context menu (right click on item master data)
                    SAPbouiCOM.Menus menus = menuItem.SubMenus;


 // This code is going to add a normal menu item successfully:
                        menuParams.Type = SAPbouiCOM.BoMenuType.mt_STRING;
                        menuParams.UniqueID = "abc";
                        menuParams.String = "ABC";
                        menuParams.Enabled = true;
                        menuParams.Position = menuItem.SubMenus.Count + 1;
                        menus.AddEx(menuParams);


// However this part of code is not going to add just a normal separation line what I intend to do:
                        menuParams.Type = SAPbouiCOM.BoMenuType.mt_SEPERATOR;
                        menuParams.UniqueID = "SeparationLine1";
                        //menuParams.String = "a"; I have tried to assign here something, still no success
                        menuParams.Enabled = true;
                        menuParams.Position = menuItem.SubMenus.Count + 1; // here I tried to give integer number like 5, 15 etc. no success
                        menus.AddEx(menuParams);

Accepted Solutions (0)

Answers (0)