cancel
Showing results for 
Search instead for 
Did you mean: 

Batch Number creation through DIAPI

Former Member
0 Kudos
102

Dear all,

i tried batch number creation through DIAPI.. but its shows error message [WTR1.Whscode][Line:1],'No matching Records found(ODBC-2028)' any body helpme in this regard..

thanks in advance.. here i have attached my coding..

Dim objLines As SAPbobsCOM.StockTransfer_Lines

objForm = objAddOn.objApplication.Forms.Item(FormUID)

Dim objStockTransfer As SAPbobsCOM.StockTransfer

objStockTransfer = objAddOn.objCompany.GetBusinessObjectSAPbobsCOM.BoObjectTypes.oStockTransfer)

objStockTransfer.DocDate = System.DateTime.Today

objStockTransfer.TaxDate = System.DateTime.Today

objStockTransfer.FromWarehouse = "01"

objStockTransfer.PriceList = 1

objStockTransfer.Lines.ItemCode = "B000001"

objStockTransfer.Lines.Quantity = "1"

objStockTransfer.Lines.WarehouseCode = "BAP"

objStockTransfer.Lines.BatchNumbers.BatchNumber = "B10"

objStockTransfer.Lines.BatchNumbers.Quantity = "1"

objStockTransfer.Lines.BatchNumbers.Add()

If objStockTransfer.Add <> 0 Then

objAddOn.objApplication.SetStatusBarMessage(objAddOn.objCompany.GetLastErrorDescription, SAPbouiCOM.BoMessageTime.bmt_Short, True)

objAddOn.objApplication.MessageBox(objAddOn.objCompany.GetLastErrorDescription)

Else

objAddOn.objApplication.SetStatusBarMessage("Inventory Transfered Successfully", SAPbouiCOM.BoMessageTime.bmt_Short, False)

End If

With Regards

G.shankar Ganesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Shankar,

your code looks fine. just ensure that the warehouse code and batch you are specifying , do exist in owhs and oibt tables respectively, with the specified quantity. ( and the best way to check it is, try stock transfer from UI with the same parameters.)

also, may be off topic, but, before specifying batch lines, you need to ensure that items are managed by batch or not )

regards,

Binita

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi binitha,

i got the solution.. thank you.. i have given wrong batch number.. now the problem is solved

with Regards

G.shankar Ganesh

Former Member
0 Kudos

I think that you have in

objStockTransfer.Lines.WarehouseCode = "BAP"

warehouse name and not code. Try to change it to code and it should work.

Nussi
Active Contributor
0 Kudos

what i don't like is that you use

objStockTransfer.Lines.BatchNumbers.Add()

after setting the line. this can result in an empty line!

also i don't see objStockTransfer.Lines.BatchNumbers.SetCurrentLine

lg David