Welcome Notes

Welcome Viewers

15 March 2018

Add project through SDK

Dear All,
   Today , We will see, How to Add project through SDK.
Public Function AddProjectIntoSAP(ByVal strPrjCode As Object, ByVal strPrjName As Object, ByVal activeMode As SAPbobsCOM.BoYesNoEnum, ByVal dtVaidateFrom As Date, ByVal dtVaidateTo As Date) As Boolean
        Dim oCmpSrv As SAPbobsCOM.CompanyService = Nothing
        Dim projectService As SAPbobsCOM.IProjectsService = Nothing
        Dim project As SAPbobsCOM.IProject = Nothing
        Dim projectParams As SAPbobsCOM.IProjectParams = Nothing
        oCmpSrv = oApplication.SAPCompany.GetCompanyService
        projectService = oCmpSrv.GetBusinessService(SAPbobsCOM.ServiceTypes.ProjectsService)
        project = projectService.GetDataInterface(SAPbobsCOM.ProjectsServiceDataInterfaces.psProject)
        Try
            projectParams = projectService.GetProjectList()
            project.Code = strPrjCode
            project.Name = strPrjName
            project.Active = activeMode
            project.ValidFrom = dtVaidateFrom
            project.ValidTo = dtVaidateTo
            projectService.AddProject(project)
            Return True
        Catch ex As Exception
            Return False
        Finally
            If oCmpSrv IsNot Nothing Then
                oCmpSrv = Nothing
            End If
            If projectService IsNot Nothing Then
                projectService = Nothing
            End If
            If project IsNot Nothing Then
                project = Nothing
            End If
            If projectParams IsNot Nothing Then
                projectParams = Nothing
            End If
        End Try
    End Function