on 05-28-2007 11:16 AM
Hi All,
I am doing a StockTransfer from one warehouse to another using the StockTransfer object, but when an item is a batch item then it doesnt work, it does not do the StockTransfer nor does it throws error. It just gives the message as ("Failed to add a Inventory Transfer") which is the message I have defined as below.
Here is the code for StockTransfer, where "A00008" item code is an item manged by Batches.
Dim InventoryTransfer As SAPbobsCOM.StockTransfer
Try
InventoryTransfer = MyCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTransfer)
InventoryTransfer.CardCode = "C0001"
InventoryTransfer.DocDate = Now
InventoryTransfer.FromWarehouse = "01"
Call InventoryTransfer.Lines.SetCurrentLine(0)
InventoryTransfer.Lines.ItemCode = "A00008"
InventoryTransfer.Lines.WarehouseCode = "W5"
InventoryTransfer.Lines.Quantity = "2"
Call InventoryTransfer.Lines.Add()
If (0 <> InventoryTransfer.Add()) Then
My_Application.MessageBox("Failed to add a Inventory Transfer")
Else
My_Application.MessageBox("Succeeded to add Inventory Transfer")
End If
Catch ex As Exception
My_Application.MessageBox(ex.Message)
End Try
If an item is managed by Batches then how do I do StockTransfer through code. Can any one provide me the code to do the same.
Thanks in Advance !!!
Regards,
Murtaza
Hi Murtaza,
Sorry for the late reply - maybe you found the solution by yourself in the meantime, but let me answer here for other developers...
Please note that "empty" objects are coming with 1 line ("for free") - i.e. you must not call
Call InventoryTransfer.Lines.Add()
This will create a 2nd empty line - and that caused trouble (i.e. errors in the .Add()) in the past!
Furthermore you have to spacify the batch numbers in the
InventoryTransfer.Lines.BatchNumbers
sub-object!
HTH,
Frank
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
102 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.