Description
Updates an existing distribution rule.
The data for the distribution rule, including the key of the distribution rule to be updated, is contained in the DistributionRule object passed to the method. To update a distribution rule, you must first retrieve it using the GetDistributionRule method.
Syntax
Parameters
Example
| Updating a distribution rule (Visual Basic) | Copy Code |
|---|
oCmpSrv = oCompany.GetCompanyService()
Dim oDLservice As SAPbobsCOM.DistributionRulesService = oCmpSrv.GetBusinessService(SAPbobsCOM.ServiceTypes.DistributionRulesService)
Dim oDL As SAPbobsCOM.DistributionRule
Dim oDLParams As SAPbobsCOM.IDistributionRuleParams
oDLParams = oDLservice.GetDataInterface(SAPbobsCOM.DistributionRulesServiceDataInterfaces.drsDistributionRuleParams)
oDLParams.FactorCode = "1"
Try
oDL = oDLservice.GetDistributionRule(oDLParams)
Catch ex As Exception
MsgBox(ex.Message)
End Try
oDL = oDLservice.GetDataInterface(SAPbobsCOM.DistributionRulesServiceDataInterfaces.drsDistributionRule)
oDL.FactorCode = "1"
oDL.FactorDescription = "Desc 1"
oDL.InWhichDimension = 1
oDL.TotalFactor = 40
oDL.DistributionRuleLines.Add()
oDL.DistributionRuleLines.Item(0).CenterCode = "1"
oDL.DistributionRuleLines.Item(0).TotalInCenter = "10"
oDL.DistributionRuleLines.Add()
oDL.DistributionRuleLines.Item(1).CenterCode = "2"
oDL.DistributionRuleLines.Item(1).TotalInCenter = "30"
Try
oDLservice.UpdateDistributionRule(oDL)
Catch ex As Exception
MsgBox(ex.Message)
End Try |
|
See Also