Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Creating invoices based on a deliveries based on order

I have to create an addon to create automatically invoices from open deliveries.

System: SBO 2004A, PL 43


I have an order with one line (itemcode=test, quantity=10,...).

Then I create manually two deliveries from this order.

delivery 1: itemcode=test, quantity=6

delivery 2: itemcode=test, quantity=4

Following is a part of the code for creating one invoice:


'more code...

For ax = 0 To boDelivery.Lines.Count - 1

'Add new line if neccessary

If ax > 0 Then


End If

' set current line of delivery



boInvoice.Lines.BaseEntry = boDelivery.DocEntry

boInvoice.Lines.BaseLine = boDeliveryLines.LineNum

boInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oDeliveryNotes

Catch ex As Exception

'error handling...

Return False

End Try


'more code...

'add invoice

RetVal = boInvoice.Add()

If RetVal <> 0 Then

'error handling...

Return False

End If


For the first delivery it works well but the the second delivery return error -5000, when I add the invoice.

What is the reason?

Former Member
Not what you were looking for? View more on this topic or Ask a question