cancel
Showing results for 
Search instead for 
Did you mean: 

oInvGenEntry adding serial/batch error

Former Member
0 Kudos

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 😛

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

Accepted Solutions (1)

Accepted Solutions (1)

barend_morkel2
Active Contributor
0 Kudos

Adding serial or batch managed items through the SBO client implies 2 different transactions (1 transaction for serial managed items, 1 for batch managed items). Thus it using the DI API (SBO's logic remains the same) does not allow a transaction which has both serial and batch managed items.

Former Member
0 Kudos

hi,

thank you so much for confirmation on the DI API. really would appreciate it if it was documented. Using the client i was able to add both serial and batch items in one transaction.

best rgds.

Answers (0)