on 03-10-2011 1:53 AM
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"
oInvenDraft.Lines.SerialNumbers.Add()
End If
oInvenDraft.Lines.Add()
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
Hello!
If you have only one line, don't use Lines.Add. It initiates the second line, and since you don't set any property in this line, the document creation will be failed.
But the error code 5001 doesn't refers to this. You should have set DocObjectCode property. So insert this line:
oInvenDraft.DocObjectCode = SAPbobsCOM.BoObjectTypes.oStockTransfer
Regards, Gergő
Edited by: Gergely Humicsko on Dec 17, 2011 5:49 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.