cancel
Showing results for 
Search instead for 
Did you mean: 

How to find invoice

Former Member
0 Kudos

Hi,

I want to find an invoice using DI-Api.

I use getbykey(invoicenumber) but there is no invoice found, but the invoice exists in SBO.

Does anyone have a working example?

Accepted Solutions (1)

Accepted Solutions (1)

jaccomoolenaar
Participant
0 Kudos

Hi,

Yes, example (in VB.NET):

Dim rs As SAPbobsCOM.Recordset

Dim query As String

Dim docnum As Integer

Try

query = "SELECT DocEntry FROM OINV WHERE DocNum = 20050001"

rs = oCmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

rs.DoQuery(query)

Console.WriteLine("aantal regels ", rs.RecordCount) If rs.RecordCount > 0 Then Console.WriteLine("DocEntry: ", rs.Fields.Item(0).Value)

End If

Catch e As Exception

Dim message As String = _

e.[GetType].ToString + ":" + vbCrLf + _

e.Message + vbCrLf + _

e.StackTrace

Console.Error.WriteLine(message)

MsgBox(message, MsgBoxStyle.Critical)

End Try

Regards,

Jacco

Message was edited by: J. Moolenaar

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks

Former Member
0 Kudos

I only know the invoicenumber.

Does this mean I should do a query on DocNum.

Does anyone have a working example?

jaccomoolenaar
Participant
0 Kudos

Hi,

The invoicenumber you are using is probably the DocNum of the invoice. In the function getbykey you should use the DocEntry of the invoice.

Hope this helps,

Jacco