Skip to Content
author's profile photo
Former Member

New PurchaseDeliveryNotes: "No matching records found (ODBC -2028)"

Hi all

I have searched for this error but have not found an answer that applies to me. I am trying to save a new PurchaseDeliveryNotes using the DI API (in VB.NET 2003), and I get that error.

To_oPurchaseDeliveryNotes.CardCode = From_DeliveryNotes.CardCode

To_oPurchaseDeliveryNotes.DocDate = Now

To_oPurchaseDeliveryNotes.DocDueDate = From_DeliveryNotes.DocDueDate

To_oPurchaseDeliveryNotes.DocCurrency = "RMB"

Dim rs_batch As SAPbobsCOM.Recordset

rs_batch = WL_oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

Dim From_SqlString As String

From_SqlString = " select L.ItemCode,L.Dscription,L.OpenQty,L.Price,L.LineTotal,L.Currency,L.VatGroup ,L.BaseCard ,L.WhsCode,M.DocDuedate,L.basetype,L.Docentry,L.LineNum,M.DocNum " & _

" from [" & WL_oCompany.CompanyDB & "].[dbo].[ODLN] M,[" & WL_oCompany.CompanyDB & "].[dbo].[DLN1] L " & _

" where M.Docentry=L.Docentry and BaseType='17' and M.DocStatus='O' and L.LineStatus='O' " & _

" and M.Docnum=" & oItemCode & " "

From_oRecordset = WL_oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

From_oRecordset.DoQuery(From_SqlString)

Dim ii As Integer

For ii = 1 To From_oRecordset.RecordCount

If ii <> 1 Then

To_oPurchaseDeliveryNotes.Lines.Add()

End If

To_oPurchaseDeliveryNotes.Lines.ItemCode = From_oRecordset.Fields.Item(0).Value

To_oPurchaseDeliveryNotes.Lines.ItemDescription = From_oRecordset.Fields.Item(1).Value

rs_batch.DoQuery("select BatchNum,Quantity from [" & WL_oCompany.CompanyDB & "].[dbo].[ibt1] where Basenum=" & oItemCode & " and itemcode='" & From_oRecordset.Fields.Item(0).Value & "' and baseType='15'")

rs_batch.MoveFirst()

If rs_batch.RecordCount > 0 Then

Dim BT_II As Integer

For BT_II = 1 To rs_batch.RecordCount

If BT_II <> 1 Then

To_oPurchaseDeliveryNotes.Lines.BatchNumbers.Add()

End If

To_oPurchaseDeliveryNotes.Lines.BatchNumbers.BatchNumber = rs_batch.Fields.Item(0).Value

To_oPurchaseDeliveryNotes.Lines.BatchNumbers.Quantity = rs_batch.Fields.Item(1).Value

If Not rs_batch.EoF Then

rs_batch.MoveNext()

End If

Next

Else

To_oPurchaseDeliveryNotes.Lines.Quantity = From_oRecordset.Fields.Item(2).Value

End If

'If rs_batch.RecordCount > 0 Then

' To_oPurchaseDeliveryNotes.Lines.BatchNumbers.BatchNumber = rs_batch.Fields.Item(0).Value

' To_oPurchaseDeliveryNotes.Lines.BatchNumbers.Quantity = From_oRecordset.Fields.Item(2).Value

'Else

' To_oPurchaseDeliveryNotes.Lines.Quantity = From_oRecordset.Fields.Item(2).Value

'End If

To_oPurchaseDeliveryNotes.Lines.Price = From_oRecordset.Fields.Item(3).Value

To_oPurchaseDeliveryNotes.Lines.Currency = "RMB" ' From_oRecordset.Fields.Item(5).Value

To_oPurchaseDeliveryNotes.Lines.VatGroup = Replace(From_oRecordset.Fields.Item(6).Value, "X", "J")

To_oPurchaseDeliveryNotes.Lines.WarehouseCode = From_oRecordset.Fields.Item(8).Value

'To_oPurchaseDeliveryNotes.Lines.UserFields.Fields.Item("U_011").Value = CStr(From_oRecordset.Fields.Item(11).Value)

'To_oPurchaseDeliveryNotes.Lines.UserFields.Fields.Item("U_012").Value = CStr(From_oRecordset.Fields.Item(12).Value)

'To_oPurchaseDeliveryNotes.Lines.BaseEntry = From_oRecordset.Fields.Item(11).Value

'To_oPurchaseDeliveryNotes.Lines.BaseLine = From_oRecordset.Fields.Item(12).Value

To_oPurchaseDeliveryNotes.Lines.BaseType = 22

If Not From_oRecordset.EoF Then

From_oRecordset.MoveNext()

End If

Next

WL_lRetCode = To_oPurchaseDeliveryNotes.Add

Getting "-2028 : No matching records found (ODBC -2028)". Any ideas?

Thanks in advance.

Message was edited by:

l l

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 03:58 PM

    Ok, when I has this problem, I solved check it the information that I put in into the component, the client information, the item information and the document that was linked with the new document.

    One advice for you is that you try to do the think that you want to make it in the SAP UI, when you do that you can prevent the most of error that should be happen in design time.

    I hope that your problem fix with this.

    Add comment
    10|10000 characters needed characters exceeded