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

10 March 2018

Add Form through SDK

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



  Public Sub AddForm(ByVal SBO_Application As SAPbouiCOM.Application, ByVal aForm As String, ByVal strUniqueID As String, ByVal strFormType As String, ByVal FormXml As String)
        Dim oForm As SAPbouiCOM.Form = Nothing
        Dim creationPackage As SAPbouiCOM.FormCreationParams = Nothing
        Try
            creationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
            creationPackage.UniqueID = strUniqueID
            creationPackage.FormType = strFormType
            creationPackage.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed
            creationPackage.XmlData = FormXml
            oForm = SBO_Application.Forms.AddEx(creationPackage)

        Catch ex As Exception
        Finally
            If oForm IsNot Nothing Then
                oForm = Nothing
            End If
            If creationPackage IsNot Nothing Then
                creationPackage = Nothing
            End If

        End Try
        
    End Sub

Check Item Exists on Form through SDK

Dear All,
   Today , We will see, How to Check Item Exists on Form through SDK


Public Function IsCheckItemExists(ByVal aForm As SAPbouiCOM.Form, ByVal aItemUId As String) As Boolean
        Dim oItem As SAPbouiCOM.Item = Nothing
        Dim blnResult As Boolean = False
        Try
            oItem = aForm.Items.Item(aItemUId)
            blnResult = True

        Catch ex As Exception
            blnResult = False
        Finally
            If oItem IsNot Nothing Then
                oItem = Nothing
            End If
        End Try

        Return blnResult
    End Function