我想使用DIAPI在SAP B1中生成业务合作伙伴活动。有人可以帮忙吗?
答案 0 :(得分:1)
从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);
使用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);
您需要帮助吗?