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
If intLoop > 0 Then
.BaseEntry = lngDocEntry (fetched from generated Sales Order)
.BaseType = BoObjectTypes.oOrders
.BaseLine = intLoop
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