‎2018 Nov 05 3:20 PM
Hello
I am creating a program that adds an item to the inventory counting in SAP. I have based the code seen below on updating an item in SAP which works. However, the code below causes errors when initialising the SAP variables.
Dim oCS As SAPbobsCOM.CompanyService
Dim oICS As SAPbobsCOM.InventoryCountingsService
Dim oIC As SAPbobsCOM.IInventoryCounting
Dim oICL As SAPbobsCOM.InventoryCountingLine
Dim oICP As SAPbobsCOM.InventoryCountingParams
Dim oICLB As SAPbobsCOM.InventoryCountingBatchNumber
Dim oICLS As SAPbobsCOM.InventoryCountingLines
Set oCS = oCompany.GetCompanyService()Set oICS = oCS.GetBusinessService(ServiceTypes.InventoryCountingsService)Set oICP = oICS.GetDataInterface(icsInventoryCountingParams)
Err.Clear
oICP.DocumentEntry = CLng(tmDOCO)Set oIC = oICS.Get(oICP)
oIC.CountDate = Now()
Err.ClearSet oICLS = oIC.InventoryCountingLines
oICL = oICLS.Add
oICL.ItemCode = tmItem
oICL.WarehouseCode = tmWH
oICL.CountedQuantity= CDbl(tmQTY)
oICL.Counted = BoYesNoEnum.tYES
oICP = oICS.Add(oIC)
tmERRTEXT = Err.Description
Err.Clear