Skip to Content
Former Member
Mar 10, 2011 at 01:53 AM

Creating StockTransferDraft throug DIAPI giving error -5001


Stock Transfer Draft through DIAPI giving error -5001

Posted: Mar 9, 2011 10:44 AM Reply

Dear all,

I tried to add a stock tranfer draft through DI API using the follwing code

Dim oInvenDraft As SAPbobsCOM.StockTransfer

oInvenDraft = p_oDICompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTransferDraft)

oInvenDraft.DocDate = CDate(System.DateTime.Now)

oInvenDraft.FromWarehouse = "CSP001"

oInvenDraft.Lines.ItemCode = "LAVO Tiger"

oInvenDraft.Lines.Quantity = 1

oInvenDraft.Lines.WarehouseCode = "CSP002"

oInvenDraft.Lines.ProjectCode = "P01"

oItems.GetByKey("LAVO Tiger")

If oItems.ManageSerialNumbers = SAPbobsCOM.BoYesNoEnum.tYES Then

oInvenDraft.Lines.SerialNumbers.InternalSerialNumber = "CSP002"


End If


lGR = oInvenDraft.Add

If lGR 0 Then

oCompany.GetLastError(lErrCode, sErrDesc)

end if

Its throwing IGR value as -5001

but company.getlasterror method giving error description as null...

please help me in resolving this