SAP Business One 使用 C# 添加 BP 活动
SAP Business One Add BP Campaign Using C#
我想使用 DIAPI 在 SAP B1 中生成业务合作伙伴的活动。谁能帮我解决这个问题。
从Campaign in SAP Business One SDK文章中我可以看到以下示例代码:
使用 DI 创建活动文档 API:
SAPbobsCOM.CampaignsService oCampaignService = oCompany.GetCompanyService().GetBusinessService(SAPbobsCOM.ServiceTypes.CampaignsService);
SAPbobsCOM.Campaign oCampaign = oCampaignService.GetDataInterface(SAPbobsCOM.CampaignsServiceDataInterfaces.csCampaign);
SAPbobsCOM.CampaignParams oCampaignParams = (SAPbobsCOM.CampaignParams)oCampaignService.GetDataInterface(SAPbobsCOM.CampaignsServiceDataInterfaces.csCampaignParams);
oCampaign.TargetGroupType = SAPbobsCOM.TargetGroupTypeEnum.tgtCustomer;
oCampaign.StartDate = DateTime.Today;
oCampaign.FinishDate = DateTime.Today.AddYears(1);
oCampaign.Remarks = "This is a test for Campaign using DI API.";
oCampaign.CampaignName = "TEST Campaign";
oCampaign.CampaignBusinessPartners.Add().BPCode = "C20000";
oCampaign.CampaignItems.Add().ItemCode = "A00001";
oCampaign.AttachementsEntry = 2; // AbsEntry from the OATC Table
oCampaignService.Add(oCampaign);
使用 DI 更新活动文档 API:
SAPbobsCOM.CampaignsService oCampaignService = oCompany.GetCompanyService().GetBusinessService(SAPbobsCOM.ServiceTypes.CampaignsService);
SAPbobsCOM.Campaign oCampaign = oCampaignService.GetDataInterface(SAPbobsCOM.CampaignsServiceDataInterfaces.csCampaign);
SAPbobsCOM.CampaignParams oCampaignParams = (SAPbobsCOM.CampaignParams)oCampaignService.GetDataInterface(SAPbobsCOM.CampaignsServiceDataInterfaces.csCampaignParams);
oCampaignParams.CampaignNumber = 2;
oCampaign = oCampaignService.Get(oCampaignParams);
oCampaign.CampaignItems.Add().ItemCode = "A00002";
oCampaignService.Update(oCampaign);
使用 DI 取消活动文档 API:
SAPbobsCOM.CampaignsService oCampaignService = oCompany.GetCompanyService().GetBusinessService(SAPbobsCOM.ServiceTypes.CampaignsService);
SAPbobsCOM.Campaign oCampaign = oCampaignService.GetDataInterface(SAPbobsCOM.CampaignsServiceDataInterfaces.csCampaign);
SAPbobsCOM.CampaignParams oCampaignParams = (SAPbobsCOM.CampaignParams)oCampaignService.GetDataInterface(SAPbobsCOM.CampaignsServiceDataInterfaces.csCampaignParams);
oCampaignParams.CampaignNumber = 3;
oCampaignService.Cancel(oCampaignParams);
Remove/Delete 使用 DI 的活动文件 API:
SAPbobsCOM.CampaignsService oCampaignService = oCompany.GetCompanyService().GetBusinessService(SAPbobsCOM.ServiceTypes.CampaignsService);
SAPbobsCOM.Campaign oCampaign = oCampaignService.GetDataInterface(SAPbobsCOM.CampaignsServiceDataInterfaces.csCampaign);
SAPbobsCOM.CampaignParams oCampaignParams = (SAPbobsCOM.CampaignParams)oCampaignService.GetDataInterface(SAPbobsCOM.CampaignsServiceDataInterfaces.csCampaignParams);
oCampaignParams.CampaignNumber = 3;
oCampaignService.Delete(oCampaignParams);
您有什么具体需要帮助的吗?
我想使用 DIAPI 在 SAP B1 中生成业务合作伙伴的活动。谁能帮我解决这个问题。
从Campaign in SAP Business One SDK文章中我可以看到以下示例代码:
使用 DI 创建活动文档 API:
SAPbobsCOM.CampaignsService oCampaignService = oCompany.GetCompanyService().GetBusinessService(SAPbobsCOM.ServiceTypes.CampaignsService);
SAPbobsCOM.Campaign oCampaign = oCampaignService.GetDataInterface(SAPbobsCOM.CampaignsServiceDataInterfaces.csCampaign);
SAPbobsCOM.CampaignParams oCampaignParams = (SAPbobsCOM.CampaignParams)oCampaignService.GetDataInterface(SAPbobsCOM.CampaignsServiceDataInterfaces.csCampaignParams);
oCampaign.TargetGroupType = SAPbobsCOM.TargetGroupTypeEnum.tgtCustomer;
oCampaign.StartDate = DateTime.Today;
oCampaign.FinishDate = DateTime.Today.AddYears(1);
oCampaign.Remarks = "This is a test for Campaign using DI API.";
oCampaign.CampaignName = "TEST Campaign";
oCampaign.CampaignBusinessPartners.Add().BPCode = "C20000";
oCampaign.CampaignItems.Add().ItemCode = "A00001";
oCampaign.AttachementsEntry = 2; // AbsEntry from the OATC Table
oCampaignService.Add(oCampaign);
使用 DI 更新活动文档 API:
SAPbobsCOM.CampaignsService oCampaignService = oCompany.GetCompanyService().GetBusinessService(SAPbobsCOM.ServiceTypes.CampaignsService);
SAPbobsCOM.Campaign oCampaign = oCampaignService.GetDataInterface(SAPbobsCOM.CampaignsServiceDataInterfaces.csCampaign);
SAPbobsCOM.CampaignParams oCampaignParams = (SAPbobsCOM.CampaignParams)oCampaignService.GetDataInterface(SAPbobsCOM.CampaignsServiceDataInterfaces.csCampaignParams);
oCampaignParams.CampaignNumber = 2;
oCampaign = oCampaignService.Get(oCampaignParams);
oCampaign.CampaignItems.Add().ItemCode = "A00002";
oCampaignService.Update(oCampaign);
使用 DI 取消活动文档 API:
SAPbobsCOM.CampaignsService oCampaignService = oCompany.GetCompanyService().GetBusinessService(SAPbobsCOM.ServiceTypes.CampaignsService);
SAPbobsCOM.Campaign oCampaign = oCampaignService.GetDataInterface(SAPbobsCOM.CampaignsServiceDataInterfaces.csCampaign);
SAPbobsCOM.CampaignParams oCampaignParams = (SAPbobsCOM.CampaignParams)oCampaignService.GetDataInterface(SAPbobsCOM.CampaignsServiceDataInterfaces.csCampaignParams);
oCampaignParams.CampaignNumber = 3;
oCampaignService.Cancel(oCampaignParams);
Remove/Delete 使用 DI 的活动文件 API:
SAPbobsCOM.CampaignsService oCampaignService = oCompany.GetCompanyService().GetBusinessService(SAPbobsCOM.ServiceTypes.CampaignsService);
SAPbobsCOM.Campaign oCampaign = oCampaignService.GetDataInterface(SAPbobsCOM.CampaignsServiceDataInterfaces.csCampaign);
SAPbobsCOM.CampaignParams oCampaignParams = (SAPbobsCOM.CampaignParams)oCampaignService.GetDataInterface(SAPbobsCOM.CampaignsServiceDataInterfaces.csCampaignParams);
oCampaignParams.CampaignNumber = 3;
oCampaignService.Delete(oCampaignParams);
您有什么具体需要帮助的吗?