Function SOPDeleteDocumentLine() As String
Dim strReturnDoc As String = ""
Try
'declare our eConnect classes
Dim oeConnectType As New Microsoft.Dynamics.GP.eConnect.Serialization.eConnectType
Dim oSOPDeleteLineType As New Microsoft.Dynamics.GP.eConnect.Serialization.SOPDeleteLineType
'initialize our eConnect wrapper class, documented here:
'http://dyndeveloper.com/thread.aspx?Threadid=1117
Dim oeConnectFunctions As New eConnect11Lib.GP11.eConnectFunctions("vmGP11", "TWO")
'delete the sop line
'documented here: http://msdn.microsoft.com/en-us/library/ff623764.aspx
Dim otaSopLineDelete As New Microsoft.Dynamics.GP.eConnect.Serialization.taSopLineDelete
With otaSopLineDelete
.SOPTYPE = 5
.SOPNUMBE = "BKO1006"
.LNITMSEQ = 16384
.ITEMNMBR = "ANSW-PAN-1450"
.DeleteType = 1 'line item deletion
End With
oSOPDeleteLineType.taSopLineDelete = otaSopLineDelete
ReDim Preserve oeConnectType.SOPDeleteLineType(0)
oeConnectType.SOPDeleteLineType(0) = oSOPDeleteLineType
'send to dynamics
strReturnDoc = oeConnectFunctions.CreateTransactionEntity(oeConnectType)
Catch ex As Exception
MsgBox(ex.Message)
End Try
SOPDeleteDocumentLine = strReturnDoc
End Function