cancel
Showing results for 
Search instead for 
Did you mean: 

Stock Transfer for Items manged by Batches

Former Member
0 Kudos

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 doesn’t 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

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member185703
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Thanks a lot FRANK for your valuable inputs