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

时间:2018-09-12 12:51:42

标签: sap project-management sapb1

我正在使用上面的代码添加一个项目(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”属性,我就不知道该怎么做。

有人通过这种情况吗?

预先感谢

1 个答案:

答案 0 :(得分:1)

我不确定您使用的是哪个SAP Business One版本,但它必须是9.2或更低版本。

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

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

查看链接:https://blogs.sap.com/2016/07/28/project-management-object-is-exposed-from-sap-business-one-version-92-pl03/