Welcome Notes

Welcome Viewers

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

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