📚 SAP Business One SDK Help

DeleteDistributionRule Method
See Also  Example
pIDistributionRuleParams
The key of the distribution rule to be deleted.

Description

Deletes an existing distribution rule.

The distribution rule is specified by its key (OcrCode), which is contained in the DistributionRuleParams object passed to the method.

Syntax

Visual Basic
Public Sub DeleteDistributionRule( _
   ByVal pIDistributionRuleParams As DistributionRuleParams _
) 

Parameters

pIDistributionRuleParams
The key of the distribution rule to be deleted.

Example

Delet 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

' Get distribution rule
oDLParams = oDLservice.GetDataInterface(SAPbobsCOM.DistributionRulesServiceDataInterfaces.drsDistributionRuleParams)
oDLParams.FactorCode = "1"
Try
    oDL = oDLservice.GetDistributionRule(oDLParams)
Catch ex As Exception
    MsgBox(ex.Message)
End Try

' Delete distribution rule
Try
    oDLservice.DeleteDistributionRule(oDL)
Catch ex As Exception
    MsgBox(ex.Message)
End Try

See Also