Dear All,
Today , We will see, How to Get Default Doc Series Number through SDK
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