private static void AddLandedCostXML() { SAPbobsCOM.Company oCompany = Application.SBO_Application.Company.GetDICompany() as SAPbobsCOM.Company; SAPbobsCOM.CompanyService oCompanyService = oCompany.GetCompanyService() as SAPbobsCOM.CompanyService; LandedCostsService LandedService = oCompanyService.GetBusinessService(ServiceTypes.LandedCostsService) as LandedCostsService; LandedCost oLandedCost = LandedService.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCost) as LandedCost; LandedCostParams oCopiedLCParams = LandedService.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCostParams) as LandedCostParams; oCopiedLCParams.LandedCostNumber = 17; LandedCost oCopiedLC = LandedService.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCost) as LandedCost; oCopiedLC = LandedService.GetLandedCost(oCopiedLCParams); string k = XMLCleaner(oCopiedLC.ToXMLString(), oCopiedLC.LandedCostNumber + "", oCopiedLC.DocEntry + ""); oLandedCost.FromXMLString(k); //Adding Costs LandedCost_CostLine oLandedCost_CostLine = oLandedCost.LandedCost_CostLines.Add(); oLandedCost_CostLine.LandedCostCode = "TI"; oLandedCost_CostLine.amount = 10; LandedService.AddLandedCost(oLandedCost); }
private static void updateLandedCost() { SAPbobsCOM.Company oCompany = Application.SBO_Application.Company.GetDICompany() as SAPbobsCOM.Company; SAPbobsCOM.CompanyService oCompanyService = oCompany.GetCompanyService() as SAPbobsCOM.CompanyService; LandedCostsService LandedService = oCompanyService.GetBusinessService(ServiceTypes.LandedCostsService) as LandedCostsService; LandedCostParams oLandedCostUpdateParams = LandedService.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCostParams) as LandedCostParams; LandedCost oLandedCostUpdate = LandedService.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCost) as LandedCost; oLandedCostUpdateParams.LandedCostNumber = 10; //LandedService.CancelLandedCost(oLandedCostUpdateParams); oLandedCostUpdate = LandedService.GetLandedCost(oLandedCostUpdateParams); // oLandedCostUpdate.LandedCost_ItemLines.Remove(0); // LandedCost_ItemLine oLandedCost_ItemLine; //oLandedCost_ItemLine = oLandedCostUpdate.LandedCost_ItemLines.Add(); //oLandedCost_ItemLine.BaseDocumentType = LandedCostBaseDocumentTypeEnum.asGoodsReceiptPO; //oLandedCost_ItemLine.BaseEntry = 521; //oLandedCost_ItemLine.BaseLine = 1; ////LandedCost_CostLine oLandedCostUpdate_CostLine = oLandedCostUpdate.LandedCost_CostLines.Add(); ////oLandedCostUpdate_CostLine.LandedCostCode = "CM"; ////oLandedCostUpdate_CostLine.amount = 11; //LandedService.UpdateLandedCost(oLandedCostUpdate); }
private static void testLandedCost() { SAPbobsCOM.Company oCompany = Application.SBO_Application.Company.GetDICompany() as SAPbobsCOM.Company; SAPbobsCOM.CompanyService oCompanyService = oCompany.GetCompanyService() as SAPbobsCOM.CompanyService; LandedCostsService LandedService = oCompanyService.GetBusinessService(ServiceTypes.LandedCostsService) as LandedCostsService; LandedCost oLandedCost = LandedService.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCost) as LandedCost; LandedCostParams oCopiedLCParams = LandedService.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCostParams) as LandedCostParams; oCopiedLCParams.LandedCostNumber = 13; LandedCost oCopiedLC = LandedService.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCost) as LandedCost; oCopiedLC = LandedService.GetLandedCost(oCopiedLCParams); //Testing int total_lineNum = oCopiedLC.LandedCost_ItemLines.Count; long oLandedCostEntry = 0;//Try 10 int GRPOEntry = 2474; //Adding Items for (int i = 0; i < 2; i++) { LandedCost_ItemLine oLandedCost_ItemLine = oLandedCost.LandedCost_ItemLines.Add(); oLandedCost_ItemLine.BaseDocumentType = LandedCostBaseDocumentTypeEnum.asPurchaseInvoice; oLandedCost_ItemLine.BaseEntry = GRPOEntry; oLandedCost_ItemLine.BaseLine = i; } //Adding Costs LandedCost_CostLine oLandedCost_CostLine = oLandedCost.LandedCost_CostLines.Add(); oLandedCost_CostLine.LandedCostCode = "CD"; oLandedCost_CostLine.amount = 99; //Extra Cost oLandedCost_CostLine = oLandedCost.LandedCost_CostLines.Add(); oLandedCost_CostLine.LandedCostCode = "CM"; oLandedCost_CostLine.amount = 150; LandedCostParams oLandedCostParams; oLandedCostParams = LandedService.AddLandedCost(oLandedCost); oLandedCostEntry = oLandedCostParams.LandedCostNumber; }