Welcome Notes

Welcome Viewers

14 March 2018

Add Menu through SDK

Dear All,
   Today , We will see, How to Add Menu through SDK.



 Public Sub AddMenu(ByVal SBO_Application As SAPbouiCOM.Application, ByVal aFormUid As String, ByVal strUniqueID As String, ByVal Str As String)
        ''********************************************************************
        Dim oMenuItem As SAPbouiCOM.MenuItem = Nothing
        Dim oMenus As SAPbouiCOM.Menus = Nothing
        Dim oCreationPackage As SAPbouiCOM.MenuCreationParams = Nothing
        Dim aForm As SAPbouiCOM.Form = Nothing

        ''********************************************************************
        aForm = SBO_Application.Forms.Item(aFormUid)
        oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
        ''********************************************************************
        Try
            oCreationPackage.Checked = False
            oCreationPackage.Enabled = True
            oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
            oCreationPackage.UniqueID = strUniqueID.Trim
            oCreationPackage.String = Str.Trim
            aForm.Menu.AddEx(oCreationPackage)
        Catch ex As Exception

        Finally
            If oMenuItem IsNot Nothing Then
                oMenuItem = Nothing
            End If
            If oMenus IsNot Nothing Then
                oMenus = Nothing
            End If
            If oCreationPackage IsNot Nothing Then
                oCreationPackage = Nothing
            End If
            If aForm IsNot Nothing Then
                aForm = Nothing
            End If
        End Try
     


    End Sub