Welcome Notes

Welcome Viewers

12 March 2018

Fill Record into Grid through SDK

Dear All,
   Today , We will see, How to Fill Record into Grid through SDK.



 Public Sub FillRecordIntoGrid(ByVal aform As SAPbouiCOM.Form, ByVal oGridUid As Object, ByVal strQuery As String)
        Dim dtTemp As SAPbouiCOM.DataTable = Nothing
        Dim oGrid As SAPbouiCOM.Grid = Nothing
        Try
            aform.Freeze(True)
            oGrid = aform.Items.Item(oGridUid).Specific
            dtTemp = oGrid.DataTable
            dtTemp.ExecuteQuery(strQuery)
            oGrid.DataTable = dtTemp
        Catch ex As Exception
        Finally
            If dtTemp IsNot Nothing Then
                dtTemp = Nothing
            End If
            aform.Freeze(False)
        End Try
    End Sub

Add user Permission to Form through SDK

Dear All,
   Today , We will see, How to Add user Permission to Form through SDK


 Public Function AddUserPermissionTree(ByVal strPermissionId As String, ByVal strName As String, ByVal strMode As SAPbobsCOM.BoUPTOptions, ByVal intLevel As Integer, ByVal strFatherId As String) As Boolean
        '**********************************************
        '' DECLARE LOCAL VARIABLE(S)
        '**********************************************
        Dim li_RetVal As Integer = 0
        Dim pUserPer As SAPbobsCOM.UserPermissionTree = Nothing
        Dim blnReturn As Boolean = False
        '**********************************************
        oApp = New ClsSAPConn
        pUserPer = oApp.SAPCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserPermissionTree)
        '**********************************************
        Try
            If pUserPer.GetByKey(strPermissionId) = False Then
                pUserPer.PermissionID = strPermissionId
                pUserPer.Name = strName

                pUserPer.Options = strMode
                li_RetVal = pUserPer.Add()
                If li_RetVal <> 0 Then
                    blnReturn = False
                Else
                    blnReturn = True
                End If
            Else
                pUserPer.Name = strName
                pUserPer.Options = strMode
                li_RetVal = pUserPer.Update()
                If li_RetVal <> 0 Then
                    blnReturn = False
                Else
                    blnReturn = True
                End If
            End If
        Catch ex As Exception
            blnReturn = False
        Finally
            System.Runtime.InteropServices.Marshal.ReleaseComObject(pUserPer)
            If oApp IsNot Nothing Then
                oApp = Nothing
            End If
        End Try
        Return blnReturn
    End Function

Add UDO to Add On Menu

   Dear All,
     
           Today, we will discuss to add User Defined Object to Add On menu .

            SAP does not support  , we  create User Defined Object through SAP or SDK ,you need to map with only SAP Menu Id not Add On menu .
          If you are trying to through SDK ,you got error ,see blow error

           Invalid parent menu ID; specify an existing SAP Business One menu as the parent menu