Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Inventory transfer in DI API

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

Former Member
Former Member replied

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?

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question