Showing results for 
Search instead for 
Did you mean: 

How to select the batch number in a stock transfer

Former Member
0 Kudos

Hi all,

I need to add a stock transfer for a batched item.

I used the DI object StockTransfer and StockTransfer_lines to add a stock transfer. However, the property StockTransfer_Lines.BatchNumbers does not seem to work (documentation says it is a read-only property). How can I specify the batch number for the stock transfer? Attached is my VB source code.



Set mobjStockTr = SBO_Company.GetBusinessObject(oStockTransfer)

With mobjStockTr

.FromWarehouse = "01"

End With

Set mobjStockTr_Lines = mobjStockTr.Lines

With mobjStockTr_Lines


.ItemCode = "B10"

.Quantity = 1

.WarehouseCode = "02"

End With

Set mobjBatchNo = mobjStockTr_Lines.BatchNumbers

With mobjBatchNo

.BatchNumber = "555"

.Quantity = 1

End With

nReturn = mobjStockTr.Add

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I have got the same problem too.

I have to write a VB .NET program to retrieve a Stock Transfer Transaction and create another Stock Transfer Transaction accordingly.

Does anyone can help?

Product and Topic Expert
Product and Topic Expert
0 Kudos


I have created an stock transfer document referencing a BatchNumber withtou problem.

I think you forgot to call the Add() on the BatchNumbers collection...

Here you have the code I use:

Dim st As SAPbobsCOM.StockTransfer

st = pCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTransfer)

st.CardCode = "Partner01"

st.Lines.ItemCode = "Item01"

st.Lines.Quantity = 1

st.Lines.WarehouseCode = "03"

st.Lines.BatchNumbers.BatchNumber = "01"

st.Lines.BatchNumbers.Quantity = 1



iResult = st.Add()

Please let me know if it works for you.



Answers (0)