cancel
Showing results for 
Search instead for 
Did you mean: 

Stock Transfers with Serial Numbers

Former Member
0 Kudos
986

Hi there, Please help! I am trying to create a stock transfer with serial numbers but when i assign the serial number to the InternalSerialNumber property of the Serial Numbers object within the Stock Transfer object I am getting an error saying that the serial umber is zero and does not exist in the warehouse. Here is a segment of my code in VB :

'declare stock transfer object

Dim oST As SAPbobsCOM.StockTransfer

'string to store the new object code

Dim OrdCodeStr As String

'instantiate a Stock Transfer object

oST = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTransfer)

'set the documents date

oST.DocDate = "05/06/06"

'set the originating warehouse number

oST.FromWarehouse = "01"

'set the serial number sup on the SN object in the Stock Transfer Lines object

'item code and warehouse code are mandatory

'item A1000 is managed by serial numbers on every transaction

'add the first line

oST.Lines.ItemCode = "A1000"

oST.Lines.WarehouseCode = "02"

'serial number hardcoded here but must exist in the warehouse 01 for item A1000

oST.Lines.SerialNumbers.InternalSerialNumber = "abc210"

oST.Lines.Quantity = 1

oST.Lines.SerialNumbers.Add()

'add the second

oST.Lines.Add()

oST.Lines.ItemCode = "A1000"

oST.Lines.WarehouseCode = "02"

'serial number hardcoded here but must exist in the warehouse 01 for item A1000

oST.Lines.SerialNumbers.InternalSerialNumber = "abc211"

oST.Lines.Quantity = 1

oST.Lines.SerialNumbers.Add()

'add the third

oST.Lines.Add()

oST.Lines.ItemCode = "A1000"

oST.Lines.WarehouseCode = "02"

'serial number hardcoded here but must exist in the warehouse 01 for item A1000

oST.Lines.SerialNumbers.InternalSerialNumber = "abc212"

oST.Lines.Quantity = 1

oST.Lines.SerialNumbers.Add()

'Add the stock transfer

lRetCode = oST.Add

'Check return Code

If lRetCode <> 0 Then

oCompany.GetLastError(lErrCode, sErrMsg)

MsgBox("Error : " & lErrCode & " : " & sErrMsg)

Else

'Gets the most recently created Object (Order) Code

'Stores that code in the String 'OrdCodeStr'

oCompany.GetNewObjectCode(OrdCodeStr)

MsgBox(" Added Stock Transfer No. : " & OrdCodeStr)

End If

...

If anyone can help me out that would be great!

Thanks,

Greeshma

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Greeshma, Have you tried using SystemSerialNumber instead of InternalSerialNumber?

Former Member
0 Kudos

Hey Corbin,

Yes i tried that but i think the SystemSerialNumber has to be a number and doesnt allow for letters. Is the System Serial Number not generated by the system when the serial number is added? If so, then how do I access the System Serial number?

-Greeshma

Former Member
0 Kudos

yes i mean use the numeric only system number to choose the serial number. You could do a database query to select the system number based on the serial number you have already, and then set like:

.SystemSerialNumber = oRecordSet.Fields.Item("SysSerial").Value

Former Member
0 Kudos

Spank u Corbin that worked!

Answers (0)