📚 SAP Business One SDK Help

UpdateItem Method
See Also  Example
pIOriginalItem
Specifies the data structure (ItemCode and ItemName) that will replace the alternative item. 

Description

Replaces an alternative item with the specified OriginalItem data structure.

Syntax

Visual Basic
Public Sub UpdateItem( _
   ByVal pIOriginalItem As OriginalItem _
) 

Parameters

pIOriginalItem
Specifies the data structure (ItemCode and ItemName) that will replace the alternative item. 

Example

Update Item (Visual Basic)Copy Code
' Alternative Items Code Sample
' This sample assumes you have SBODemo_US database installed

Dim oCompanyService As SAPbobsCOM.CompanyService
Dim AltItemsService As SAPbobsCOM.AlternativeItemsService
Dim OriItem As SAPbobsCOM.OriginalItem
Dim OriItemParams As SAPbobsCOM.OriginalItemParams
Dim AltItem As SAPbobsCOM.AlternativeItem

oCompanyService = oCompany.GetCompanyService
AltItemsService = oCompanyService.GetBusinessService(SAPbobsCOM.ServiceTypes.AlternativeItemsService)
OriItem = AltItemsService.GetDataInterface(SAPbobsCOM.AlternativeItemsServiceDataInterfaces.aisOriginalItem)
OriItemParams = AltItemsService.GetDataInterface(SAPbobsCOM.AlternativeItemsServiceDataInterfaces.aisOriginalItemParams)

'Update Alternative Item
OriItemParams.ItemCode = "A00001"
OriItem = AltItemsService.GetItem(OriItemParams)

'Getting the first alternative item
AltItem = OriItem.AlternativeItems.Item(0)

'Updating Alternative Item A00004 to have match factor 400
AltItem.AlternativeItemCode = "A00004"
AltItem.MatchFactor = 300
AltItemsService.UpdateItem(OriItem)

See Also