(SAP B1) - 如何在项目管理中添加用户字段?

(SAP B1) - How to add user fields on Project Management?

我正在使用上面的代码添加一个项目 (OPMG),它运行良好。

SAPbobsCOM.CompanyService oCompServ = (SAPbobsCOM.CompanyService)oCompany.GetCompanyService();
SAPbobsCOM.ProjectManagementService pmgService = (SAPbobsCOM.ProjectManagementService)oCompServ.GetBusinessService(SAPbobsCOM.ServiceTypes.ProjectManagementService);
SAPbobsCOM.PM_ProjectDocumentData project = (SAPbobsCOM.PM_ProjectDocumentData)pmgService.GetDataInterface(SAPbobsCOM.ProjectManagementServiceDataInterfaces.pmsPM_ProjectDocumentData);

project.ProjectName = "ProjectByDI_01";
project.Owner = 1;
project.StartDate = new DateTime(2016, 2, 1);
project.DueDate = new DateTime(2016, 11, 30);
project.ClosingDate = new DateTime(2016, 12, 31);
project.ProjectType = SAPbobsCOM.ProjectTypeEnum.pt_External;
project.BusinessPartner = "C20000";
project.ContactPerson = 2;
project.Territory = 1;
project.SalesEmployee = 5;
project.AllowSubprojects = SAPbobsCOM.BoYesNoEnum.tYES;
project.ProjectStatus = SAPbobsCOM.ProjectStatusTypeEnum.pst_Started;
project.FinancialProject = "PRJ01";
project.RiskLevel = SAPbobsCOM.RiskLevelTypeEnum.rlt_High;
project.Industry = 1;
project.Reason = "Test comment";
project.AttachmentEntry = 1;

pmgService.AddProject(project);

但是现在,我也需要在该项目中添加一个用户字段。但是我不知道该怎么做,一旦该对象上没有 "UserField" 属性。

有人遇到这种情况吗?

提前致谢

我不确定您使用的是什么 SAP Business One 版本,但它必须是 9.2 或以下版本。

已为 SAP Business One 版本 9.3 PL01 及更高版本的“PM_ProjectDocumentData”、“PM_StageData”、“PM_SubprojectDocumentData”实施了用户定义字段。

对于 9.3,"project.UserFields." 将被公开。

参见link:https://blogs.sap.com/2016/07/28/project-management-object-is-exposed-from-sap-business-one-version-92-pl03/