cancel
Showing results for 
Search instead for 
Did you mean: 

Inventory transfer in DI API

Former Member
0 Kudos

Hi kings

Good Evening.

I Move the stock one warehouse to another warehouse. item is serial number items. 84 qty .Its show the error

Internal error (-5002) occurred



 Dim oStktransfer As SAPbobsCOM.StockTransfer = gonComCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTransfer)
                            oStktransfer.DocDate = Date.Today()
                            oStktransfer.FromWarehouse = gonMatConvMatrix.Columns.Item("Col_Fwhse").Cells.Item(pVal.Row).Specific.value
                            oStktransfer.Lines.ItemCode = gonMatConvMatrix.Columns.Item("Col_itmcd").Cells.Item(pVal.Row).Specific.value
                            oStktransfer.Lines.WarehouseCode = gonMatConvMatrix.Columns.Item("Col_Twhse").Cells.Item(pVal.Row).Specific.value
                            oStktransfer.Lines.Quantity = gonMatConvMatrix.Columns.Item("Col_qty").Cells.Item(pVal.Row).Specific.value
                            Dim qty As Integer
                            qty=gonMatConvMatrix.Columns.Item("Col_qty").Cells.Item(pVal.Row).Specific.value
                            Dim Item As SAPbobsCOM.Items = gonComCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems)
                            Item.GetByKey(oStktransfer.Lines.ItemCode)
                            If (Item.ManageSerialNumbers.Equals(SAPbobsCOM.BoYesNoEnum.tYES)) Then
                                sSql = "SELECT *  FROM OSRI T0 WHERE T0.[ItemCode]='" & gonMatConvMatrix.Columns.Item("Col_itmcd").Cells.Item(pVal.Row).Specific.value & "' and T0.[BaseType]='59' and T0.[BaseNum]= '" & gonMatConvMatrix.Columns.Item("Col_recNo").Cells.Item(pVal.Row).Specific.value & "'"
                                oRS = gonComCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                                oRS.DoQuery(sSql)
                                For i As Integer = 1 To qty
                                    If oRS.EoF = False Then
                                        oStktransfer.Lines.SerialNumbers.SystemSerialNumber = oRS.Fields.Item("SysSerial").Value
                                        oStktransfer.Lines.SerialNumbers.InternalSerialNumber = oRS.Fields.Item("IntrSerial").Value
                                        oStktransfer.Lines.SerialNumbers.Add()
                                        oRS.MoveNext()
                                    End If
                                Next
                            End If

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Generally Internal error (-5002) occurred means you are referencing something that doesn't exist in the system.

So I would check:

The warehouse codes; this is often what is wrong when getting this error. Check are these the correct codes from the DB, same case and everything

Also the serial numbers - this is looping 84 times? Do you have a serial number for every line? And it hasn't been allocated already?

Answers (0)