Skip to Content
0
Former Member
May 28, 2007 at 10:16 AM

Stock Transfer for Items manged by Batches

19 Views

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