I noted here that in doin this for GP 9 I needed to add UPDATEEXISTING and PYMTAMNT in the header for GP9 code.
Public Class SOPPayment
'taCreateSopPaymentInsertRecord
Sub CreateSOPPayment()
'SOP Create Order
Dim strReturnDoc As String = ""
Try
Dim intNumberOfLines As Int16 = 0 '0 = 1 line
'declare our eConnect classes
Dim oeConnectType As New Microsoft.Dynamics.GP.eConnect.Serialization.eConnectType
Dim oSOPTransactionType As New Microsoft.Dynamics.GP.eConnect.Serialization.SOPTransactionType
Dim oeConnectFunctions As New eConnect11Lib.GP11.eConnectFunctions("vmGP11", "TWO")
'create the document header
Dim otaSopHdrIvcInsert As New Microsoft.Dynamics.GP.eConnect.Serialization.taSopHdrIvcInsert
'populate the header data
'only the minimum fields are required
With otaSopHdrIvcInsert
.SOPTYPE = 2
.DOCID = "STDORD"
.CUSTNMBR = "CENTRALD0001"
.BACHNUMB = "SOP ORDERS"
.DOCDATE = "5/23/2017"
End With
'assign the header to the master
oSOPTransactionType.taSopHdrIvcInsert = otaSopHdrIvcInsert
'create the document details
For intCurrentLine As Int16 = 0 To intNumberOfLines
'declare an object for the detail line
Dim otaCreateSopPaymentInsertRecord As New Microsoft.Dynamics.GP.eConnect.Serialization.taCreateSopPaymentInsertRecord_ItemsTaCreateSopPaymentInsertRecord
'populate the detail line
With otaCreateSopPaymentInsertRecord
.SOPTYPE = 2
.SOPNUMBE = "ORDST2225"
.DOCAMNT = 1925.95
.CUSTNMBR = "CENTRALD0001"
.DOCDATE = "5/23/2017"
.CHEKBKID = "UPTOWN TRUST"
.CHEKNMBR = "123"
.CARDNAME = "" 'CREDIT CARD NAME
.RCTNCCRD = "" 'CREDIT CARD NUMBER
.AUTHCODE = "" 'CC AUTH CODE
.EXPNDATE = "" 'CC EXPIRATION DATE
.PYMTTYPE = 2 '
'Payment types:
'1=Cash deposit;
'2=Check deposit;
'3=Credit card deposit;
'4=Cash payment;
'5=Check payment;
'6=Credit card payment
.DOCNUMBR = "" 'PAYMENT NUMBER
'Payment number/cash receipt number;
' required if Action=2, SOPTYPE=2, and PYMTTYPE=(1, 2, or 3);
' required if Action=2 and SOPTYPE=3;
' required if Action=3, SOPTYPE=2, and PYMTTYPE=(1, 2, or 3)
.Action = 1
'Default from setup:
'1=New transaction/new payment;
'3=Modify existing payment
'Must set to 2 manually;
'2=Delete payment
.SEQNUMBR = 16384
.SEQNUMBRSpecified = 1
'Sequence number;
' required if Action=1, SOPTYPE=2, and multiple PYMTTYPE=6 exist
' Required if Action=2, SOPTYPE=2, and PYMTTYPE=6
' Required if Action=3 and DOCNUMBR and PYMTTYPE elements exist multiple times on document
.MDFUSRID = "DYNDEV"
ReDim Preserve oSOPTransactionType.taCreateSopPaymentInsertRecord_Items(intCurrentLine)
oSOPTransactionType.taCreateSopPaymentInsertRecord_Items(intCurrentLine) = otaCreateSopPaymentInsertRecord
End With
Next
ReDim Preserve oeConnectType.SOPTransactionType(0)
oeConnectType.SOPTransactionType(0) = oSOPTransactionType
strReturnDoc = oeConnectFunctions.CreateTransactionEntity(oeConnectType)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class