Skip to Content
0
Former Member
Jul 23, 2005 at 01:00 AM

oInvGenEntry adding serial/batch error

37 Views

hi i have tried to add a serial and batch item using the oInvGenEntry object with the codes below. somehow i keep getting the "item has no serial number management" error. the item has been set to be managed by serial and batch respectively. the strange thing is that with the same code i can add either serial or batch item. but not both. for my oInvGenExit codes it is the same but it can accept serial and batch items together. sorry for my bad english :P

oInvGenEntry = SBOUtility.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenEntry)

currentLine = 0

batchrow = 0

serialrow = 0

oInvGenEntry.Lines.SerialNumbers.SystemSerialNumber = 1

oInvGenEntry.Lines.SerialNumbers.InternalSerialNumber = ""

oInvGenEntry.Lines.SerialNumbers.ManufacturerSerialNumber = ""

oInvGenEntry.Lines.SerialNumbers.SetCurrentLine(0)

oInvGenEntry.Lines.SerialNumbers.Add()

oInvGenEntry.Lines.ItemCode = "1005"

oInvGenEntry.Lines.ItemDescription = ""

oInvGenEntry.Lines.Quantity = 1

oInvGenEntry.Lines.Price = 12

oInvGenEntry.Lines.WarehouseCode = "01"

oInvGenEntry.Lines.SetCurrentLine(0)

currentLine += 1

oInvGenEntry.Lines.Add()

oInvGenEntry.Lines.BatchNumbers.BatchNumber = "wer"

oInvGenEntry.Lines.BatchNumbers.Quantity = 1

oInvGenEntry.Lines.BatchNumbers.SetCurrentLine(0)

oInvGenEntry.Lines.BatchNumbers.Add()

oInvGenEntry.Lines.ItemCode = "1006"

oInvGenEntry.Lines.ItemDescription = ""

oInvGenEntry.Lines.Quantity = 1

oInvGenEntry.Lines.Price = 12

oInvGenEntry.Lines.WarehouseCode = "01"

oInvGenEntry.Lines.SetCurrentLine(1)

currentLine += 1

oInvGenEntry.Lines.Add()

Dim ErrCode As Integer

Dim temp, ErrMsg As String

ErrCode = SBOUtility.oCompany.GetLastErrorCode()

If ErrCode <> 0 Then

SBOUtility.oCompany.GetLastError(ErrCode, ErrMsg)

End If

oInvGenEntry.PaymentGroupCode = -1

oInvGenEntry.DocTotal = 2

oInvGenEntry.Series = "17"

oInvGenEntry.DocCurrency = "USD"

Dim ret As Integer = oInvGenEntry.Add()

SBOUtility.oCompany.GetNewObjectCode(temp)

ErrCode = SBOUtility.oCompany.GetLastErrorCode()

If ErrCode <> 0 Then

SBOUtility.oCompany.GetLastError(ErrCode, ErrMsg)

End If