Man, you're not going to like this answer, it's really complicated. But, you asked...
I think that you have a VB issue, not an eConnect issue. It sounds to me like you're not bringing in the class into the array of apply docs correctly. I don't have a piece of code that shows that being done, but I do have one that shows a SOP header and an array of lines being applied. You'll have to read through the code for the lines section. I have abbreviated the code somewhat to make it easier to read through.
I use two custom classes, clsSOPHeader and clsSOPLine. These classes directly mirror the tables. I use the classes instead of the eConnect object so that I have an opportunity to insert business logic if I need to. So, the calling function populates clsSOPHeader and an array of clsSOPLines, these are declared at the top.
Then we go through and populate the eConnect taSopHdrIvcInsert and taSopLineIvcInsert_ItemsTaSopLineIvcInsert objects. Remember that the line object is a collection.
</font></font>
Imports System
Imports Microsoft.GreatPlains.eConnect.Serialization
Public Class clsSOPTrans
Public SOP As clsSOPHeader
Public SOPLines As New System.Collections.Generic.List(Of clsSOPLine)
Public server As String
Public db As String
Public Sub CreateSOPdoc(ByVal db As String)
'create the eConnect Trasaction document, and an array of transaction docs
Dim SOPTransType As New SOPTransactionType
Dim aSOPTransType(0) As SOPTransactionType
'create the eConnect docs that go into the transaction doc
Dim taSOP As New taSopHdrIvcInsert
Dim taSOPLine As taSopLineIvcInsert_ItemsTaSopLineIvcInsert
'create a local instance of our SOP Line class
Dim oclsSOPLine As New clsSOPLine
With taSOP
.SOPTYPE = Me.SOP.SOPTYPE
.DOCID = Me.SOP.DOCID
.SOPNUMBE = Me.SOP.SOPNUMBE
.ORIGNUMB = Me.SOP.ORIGNUMB
.ORIGTYPE = Me.SOP.ORIGTYPE
.TAXSCHID = Me.SOP.TAXSCHID
.FRTSCHID = Me.SOP.FRTSCHID
'abbreviated for clarity
.USRDEFND1 = Me.SOP.USRDEFND1
.USRDEFND2 = Me.SOP.USRDEFND2
.USRDEFND3 = Me.SOP.USRDEFND3
.USRDEFND4 = Me.SOP.USRDEFND4
.USRDEFND5 = Me.SOP.USRDEFND5
End With
Dim a As Int16 = 0
Dim ataSOPLine(0) As taSopLineIvcInsert_ItemsTaSopLineIvcInsert
'loop through our array of SOPLine classes
For Each oclsSOPLine In Me.SOPLines
'get a local instance of the 'ta' sop line object
taSOPLine = New taSopLineIvcInsert_ItemsTaSopLineIvcInsert
With taSOPLine
.SOPTYPE = oclsSOPLine.SOPTYPE
.SOPNUMBE = oclsSOPLine.SOPNUMBE
.CUSTNMBR = oclsSOPLine.CUSTNMBR
.DOCDATE = oclsSOPLine.DOCDATE
'abbreviated for clarity
.USRDEFND5 = oclsSOPLine.USRDEFND5
End With
ReDim Preserve ataSOPLine(a)
ataSOPLine(a) = taSOPLine
'increment the counter
a += 1
Next
SOPTransType.taSopLineIvcInsert_Items = ataSOPLine
aSOPTransType(0) = SOPTransType
Dim eConnect As New eConnectType
eConnect.SOPTransactionType = aSOPTransType
'I haven't included this code, but I can if you need it.
clsMain.send(eConnect, server, db)
End Sub
End Class
<font size="2"><font size="2">