📚 SAP Business One SDK Help

AddBranch Method
See Also  Example
pIBranch
The data for the new branch.

Description

Adds a branch.

Syntax

Visual Basic
Public Function AddBranch( _
   ByVal pIBranch As Branch _
) As BranchParams

Parameters

pIBranch
The data for the new branch.

Return Type

Contains the key (Code) of the new branch.

Example

Adding a branch (C#)Copy Code
public void add() 

    try 
    { 
        BranchesService oBranchSrv; 
        oBranchSrv = (BranchesService)(MainModule.oCmpSrv.GetBusinessService(ServiceTypes.BranchesService)); 
        SAPbobsCOM.Branch addLine; 
        addLine = (SAPbobsCOM.Branch)oBranchSrv.GetDataInterface(BranchesServiceDataInterfaces.bsBranch); 
        //full addition 
        addLine.Name = "X"; 
        addLine.Description = "X Branch"; 
        oBranchSrv.AddBranch(addLine); 
    } 
    catch (Exception ex) 
    { 
        Interaction.MsgBox(ex.Message, (Microsoft.VisualBasic.MsgBoxStyle)(0), null); 
    } 

See Also