cancel
Showing results for 
Search instead for 
Did you mean: 

Make System Menu Invisible

Former Member
0 Kudos

Hello All:

I created a user menu to replace Sales Order menu. It does few things when user click on it original sales order menu does. But now I want to make the sales order menu 2050 invisible.. I don't see it in the menus object. But I can go into configuration thing and uncheck it. Is there a way programmatically to make the menu invisible?

Thank You!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You may hide menuitem for sales order as

Dim m_menus As SAPbouiCOM.Menus
            Dim m_menuItem As SAPbouiCOM.MenuItem
            m_menus = SBO_Application.Menus
            m_menus = m_menus.Item("2048").SubMenus
            m_menuItem = m_menus.Item("2050")
            m_menuItem.Enabled = False

Former Member
0 Kudos

Thank You:

Yes, I have tried it, but I don't want it to be disabled. I just want it to be invisible. To be disabled then I can't use that menu in my code anymore to call form 139 up.

Sincerely Yours

Bo Peng

former_member201110
Active Contributor
0 Kudos

Hi,

You can use the FormPreferencesService object in the DI API to update the user's Form Settings for the main menu when your addon starts. However, I've found that the form settings don't take affect until the user logs out and then logs back in to SBO. Unfortunately, I can't find a workaround to this so the first time your users start the addon you'll need to instruct them to log out and then log back in.


private void HideSalesOrderMenu()
{
    try
    {
        SAPbobsCOM.CompanyService sboService;
        SAPbobsCOM.FormPreferencesService sboFormSettings;
        SAPbobsCOM.ColumnsPreferences sboColPrefs;
        SAPbobsCOM.ColumnsPreferencesParams sboColPrefParams;

        sboService = _sboCompany.GetCompanyService();

        sboFormSettings = (SAPbobsCOM.FormPreferencesService)sboService.GetBusinessService(SAPbobsCOM.ServiceTypes.FormPreferencesService);

        sboColPrefParams = (SAPbobsCOM.ColumnsPreferencesParams)sboFormSettings.GetDataInterface(SAPbobsCOM.FormPreferencesServiceDataInterfaces.fpsdiColumnsPreferencesParams);

        sboColPrefParams.FormID = "169"; // Main Menu

        sboColPrefParams.User = _sboCompany.UserSignature;

        sboColPrefs = sboFormSettings.GetColumnsPreferences(sboColPrefParams);

        for (int i = 0; i < sboColPrefs.Count; i++)
        {
            if (sboColPrefs.Item(i).ItemNumber == "2050")
            {
                sboColPrefs.Item(i).VisibleInExpanded = SAPbobsCOM.BoYesNoEnum.tNO;
                sboColPrefs.Item(i).VisibleInForm = SAPbobsCOM.BoYesNoEnum.tNO;
            }
        }

        sboFormSettings.UpdateColumnsPreferences(sboColPrefParams, sboColPrefs);
    }
    catch (Exception ex)
    {
        _sboApp.SetStatusBarMessage("Error: " + ex.Message, SAPbouiCOM.BoMessageTime.bmt_Medium, true);
    }
}

Kind Regards,

Owen

Former Member
0 Kudos

Hello Owen:

Tried your code and it works like magic. I assume since window perference is part of DI that explain SBO need to restart. I wonder would it be a smart thing to pack into the installation package (make it weired) and release it as standard. But then user can change it if needed.

Answers (0)