📚 SAP Business One SDK Help

DeleteBranch Method
See Also  Example
pIBranchParams
The key of the branch to be deleted.

Description

Deletes an existing branch.

The branch is specified by its key (Code), which is contained in the BranchParams object passed to the method.

Syntax

Visual Basic
Public Sub DeleteBranch( _
   ByVal pIBranchParams As BranchParams _
) 

Parameters

pIBranchParams
The key of the branch to be deleted.

Remarks

System branches cannot be updated.

Branches that have been assigned to a user or employee cannot be deleted.

Example

Deleting a branch (C#)Copy Code
public void delete() 

    try 
    { 
        BranchParams delLine; 
        delLine = (BranchParams)oBranchSrv.GetDataInterface(BranchesServiceDataInterfaces.bsBranchParams); 
        
        //delete a record 
        //please note that the code should be of an existing record. 
        delLine.Code = 5; 
 
        //delete 
        oBranchSrv.DeleteBranch(delLine);                             
    } 
    catch (Exception ex) 
    { 
        Interaction.MsgBox(ex.Message, (Microsoft.VisualBasic.MsgBoxStyle)(0), null); 
    } 

See Also