Welcome Notes

Welcome Viewers

10 March 2018

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

Check Form Exists through SDK

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



   Public Function IsCheckFormExists(ByVal SBO_App As SAPbouiCOM.Application, ByVal aForm As String) As Boolean
        Dim oForm As SAPbouiCOM.Form = Nothing
        Dim blnResult As Boolean = False
        Try
            oForm = SBO_App.Forms.Item(aForm)

            blnResult = True

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

        Return blnResult
    End Function

Get Default Doc Series Number through SDK

Dear All,
   Today , We will see, How to Get Default Doc Series Number through SDK



    Public Enum SeriesNumber
        DefaultSeriesNumber
        FirstSeriesNumber
        NextSeriesNumber

    End Enum


   Public Function GetDefaultSeriesNum(ByVal strObjType As String, ByVal strMode As SeriesNumber) As Integer
        '**********************************************
        '' Declare Local Variable(s)
        '**********************************************
        Dim oCompanyService As SAPbobsCOM.CompanyService = Nothing
        Dim oSeriesService As SAPbobsCOM.SeriesService = Nothing
        Dim oSeries As Series = Nothing
        Dim oSeriesParams As SeriesParams = Nothing
        Dim oDocumentTypeParams As DocumentTypeParams = Nothing
        Dim intReturn As Integer = 0
        '**********************************************
         oCompanyService = oApplication.SAPCompany.GetCompanyService
        oSeriesService = oCompanyService.GetBusinessService(ServiceTypes.SeriesService)
        oSeries = oSeriesService.GetDataInterface(SeriesServiceDataInterfaces.ssdiSeries)
        oDocumentTypeParams = oSeriesService.GetDataInterface(SeriesServiceDataInterfaces.ssdiDocumentTypeParams)

        '**********************************************
        Try
            oDocumentTypeParams.Document = strObjType
            oSeries = oSeriesService.GetDefaultSeries(oDocumentTypeParams)
            Select Case strMode
                Case SeriesNumber.DefaultSeriesNumber
                    intReturn = oSeries.Name
                Case SeriesNumber.FirstSeriesNumber
                    intReturn = oSeries.InitialNumber
                Case SeriesNumber.NextSeriesNumber
                    intReturn = oSeries.NextNumber
            End Select

            Return True
        Catch ex As Exception
            Return False
        Finally
            If oCompanyService IsNot Nothing Then
                oCompanyService = Nothing
            End If
            If oSeriesService IsNot Nothing Then
                oSeriesService = Nothing
            End If
            If oSeries IsNot Nothing Then
                oSeries = Nothing
            End If
            If oSeriesParams IsNot Nothing Then
                oSeriesParams = Nothing
            End If
            If oDocumentTypeParams IsNot Nothing Then
                oDocumentTypeParams = Nothing
            End If
        End Try
    End Function

09 March 2018

Update Path Admin through SDK

Dear All,
   Today , We will see, How to Update Path Admin through SDK



Public Function UpdatePathAdmin(ByVal WordTemplateFolderPath As String, ByVal PicturesFolderPath As String, ByVal AttachmentsFolderPath As String, ByVal ExtensionsFolderPath As String) As Boolean
        Dim oCompanyService As SAPbobsCOM.CompanyService = Nothing
        Dim oPathAdmin As SAPbobsCOM.PathAdmin = Nothing
        oCompanyService = oApp.SAPCompany.GetCompanyService

        Try
            If Not String.IsNullOrEmpty(WordTemplateFolderPath) Then
                oPathAdmin.WordTemplateFolderPath = WordTemplateFolderPath
            Else
                oPathAdmin.WordTemplateFolderPath = oPathAdmin.WordTemplateFolderPath
            End If
            If Not String.IsNullOrEmpty(PicturesFolderPath) Then
                oPathAdmin.PicturesFolderPath = PicturesFolderPath
            Else
                oPathAdmin.PicturesFolderPath = oPathAdmin.PicturesFolderPath
            End If
            If Not String.IsNullOrEmpty(AttachmentsFolderPath) Then
                oPathAdmin.AttachmentsFolderPath = AttachmentsFolderPath
            Else
                oPathAdmin.AttachmentsFolderPath = oPathAdmin.AttachmentsFolderPath
            End If
            If Not String.IsNullOrEmpty(ExtensionsFolderPath) Then
                oPathAdmin.ExtensionsFolderPath = ExtensionsFolderPath
            Else
                oPathAdmin.ExtensionsFolderPath = oPathAdmin.ExtensionsFolderPath
            End If
            oCompanyService.UpdatePathAdmin(oPathAdmin)
            Return True
        Catch ex As Exception
            Return False
        Finally
            If oCompanyService IsNot Nothing Then
                oCompanyService = Nothing
            End If
        End Try
    End Function

Get System Currency through SAP Business one SDK

Dear All,
   Today , We will see, How to Get System Currency through SDK


  Public Function GetSysCurrency() As String
        Dim vObj As SAPbobsCOM.SBObob = Nothing
        oApp = New ClsSAPConn
        Dim oRS As SAPbobsCOM.Recordset
        Dim strSysCurrency As String = String.Empty
        vObj = oApp.SAPCompany.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoBridge)
        oRS = oApp.SAPCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
        Try
            oRS = vObj.GetSystemCurrency()
            strSysCurrency = oRS.Fields.Item(0).Value
        Catch ex As Exception
            strSysCurrency = String.Empty
        Finally
            If vObj IsNot Nothing Then
                vObj = Nothing
            End If
            System.Runtime.InteropServices.Marshal.ReleaseComObject(oRS)
            If oApp IsNot Nothing Then
                oApp = Nothing
            End If
        End Try
        Return strSysCurrency
    End Function