Skip to Content
0
Former Member
May 05, 2016 at 04:39 PM

Error creating Down Payment Invoice

227 Views

I have worked on the assumption that my source order data would have the same number of lines for both Sales Order and Down Payment Invoice. I'm now guessing that when I use a BOM Item the DI-API automatically adds the component lines to the Sales Order.

To try and correct the mismatch in lines, after creating the Sales Order I have extracted the SalesOrder.Lines.Count value (less 1) and used this to iterate the Down Payment Invoice lines, as below:

DOC = Company.GetBusinessObject(BoObjectTypes.oDownPayments)

For intLoop As Integer = 0 To intSalesOrderLinesCount

With DOC.Lines

If intLoop > 0 Then

.Add()

End If

.BaseEntry = lngDocEntry (fetched from generated Sales Order)

.BaseType = BoObjectTypes.oOrders

.BaseLine = intLoop

End With

Next

Unfortunately I still seem to get the same error. Am I missing something more with BOM items in Sales Orders and Down Payment Invoices?

Error is -2010 Bad Data Source Offset