Welcome Notes

Welcome Viewers

11 March 2018

Add UserDataSource To Form through SDK

Dear All,
   Today , We will see, How to Add UserDataSource To Form through SDK.


 Public Sub AddUserDataSourceToForm(ByVal aForm As SAPbouiCOM.Form, ByVal oUserDataSorce As String, ByVal strDateType As SAPbouiCOM.BoDataType, ByVal length As Integer)

        Try
            aForm.DataSources.UserDataSources.Add(oUserDataSorce, strDateType, length)
        Catch ex As Exception
        Finally
            If aForm IsNot Nothing Then
                aForm = Nothing
            End If
        End Try


    End Sub

A Step-by-Step Tutorial on Getting Item Alias Names through SDK

            To retrieve an Item Alias Name using the SAP Business One SDK in VB.NET, you can use the following code snippet



 Public Function GetItemAliasName(ByVal SBO_Application As SAPbouiCOM.Application, ByVal oFormType As String, ByVal strItemUid As String, Optional ByVal strColUid As String = "") As String
        Dim resource As SAPbouiCOM.ResourceData = Nothing
        Dim oFormInfo As SAPbouiCOM.FormInfo = Nothing
        Dim oItemInfo As SAPbouiCOM.ItemInfo = Nothing
        Dim strFormType As String = String.Empty
        resource = SBO_Application.ResourceData
        oFormInfo = resource.GetFormInfo(oFormType)
        Try
            oItemInfo = oFormInfo.GetItemInfo(strItemUid, strColUid)
            strFormType = oItemInfo.Alias.Trim
        Catch ex As Exception
            strFormType = String.Empty
        Finally
            If resource IsNot Nothing Then
                resource = Nothing
            End If
            If oFormInfo IsNot Nothing Then
                oFormInfo = Nothing
            End If
            If oItemInfo IsNot Nothing Then
                oItemInfo = Nothing
            End If
        End Try
        Return strFormType.Trim

    End Function

How to Get Form Info through the SAP B1 SDK

Dear All,
   Today , We will see, How to Get Form Info through SDK



    Public Function GetFormType(ByVal SBO_Application As SAPbouiCOM.Application, ByVal oFormType As String) As String
        Dim resource As SAPbouiCOM.ResourceData = Nothing
        Dim oFormInfo As SAPbouiCOM.FormInfo = Nothing
        Dim strFormType As String = String.Empty
        resource = SBO_Application.ResourceData
        oFormInfo = resource.GetFormInfo(oFormType)
        Try
            strFormType = oFormInfo.Type
        Catch ex As Exception
            strFormType = String.Empty
        Finally
            If resource IsNot Nothing Then
                resource = Nothing
            End If
            If oFormInfo IsNot Nothing Then
                oFormInfo = Nothing
            End If
        End Try
        Return strFormType.Trim

    End Function