Skip to Content
author's profile photo Former Member
Former Member

Stock Transfer for Items manged by Batches

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Jun 10, 2007 at 02:21 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.