📚 SAP Business One SDK Help

UpdateState Method
See Also  Example
pIState
The data for the state to be updated. The State object must contain the key (Code, Country) of the object to be updated.

Description

Updates an existing state.

The data for the state, including the key of the state to be updated, is contained in the State passed to the method. To update a state, you must first retrieve it using the GetState method.

Syntax

Visual Basic
Public Sub UpdateState( _
   ByVal pIState As State _
) 

Parameters

pIState
The data for the state to be updated. The State object must contain the key (Code, Country) of the object to be updated.

Example

Updating a state (C#)Copy Code
// Get states service 
CompanyService oCompanyService = oCompany.GetCompanyService(); 
StatesService oStatesService = (StatesService)oCompanyService.GetBusinessService(ServiceTypes.StatesService); 
 
// Update a State 
SAPbobsCOM.StateParams oStateParams = (SAPbobsCOM.StateParams)oStatesService.GetDataInterface 
    (StatesServiceDataInterfaces.ssStateParams); 
 
oStateParams.Code = "ZZ1"; 
oStateParams.Country = "US"; 
 
SAPbobsCOM.State oState = oStatesService.GetState(oStateParams); 
oState.Name = "ZZ9"; 
 
oStatesService.UpdateState(oState); 

See Also