I'm writing an eConnect integration in GP2010 and the SOP unit price and extended price are not populating. I'd like to get them to default from the item/customer setup.
If I key the document manually in Dynamics, they populate there...
Sub
CreateSOPOrder()
Try
Dim
strSqlServer
As
String
= System.Configuration.ConfigurationManager.AppSettings(
"SQLServer"
)
Dim
strDB
As
String
= System.Configuration.ConfigurationManager.AppSettings(
"Database"
)
Dim
strDocID
As
String
= System.Configuration.ConfigurationManager.AppSettings(
"DOCID"
)
Dim
strLocationCode
As
String
= System.Configuration.ConfigurationManager.AppSettings(
"3PlLocationCode"
)
'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
GP11.eConnectFunctions(strSqlServer, strDB)
'create the document header
Dim
otaSopHdrIvcInsert
As
New
Microsoft.Dynamics.GP.eConnect.Serialization.taSopHdrIvcInsert
'populate the header
With
otaSopHdrIvcInsert
.SOPTYPE = 2
.DOCID = strDocID
.CUSTNMBR = CUSTNMBR
.BACHNUMB =
"WEB"
& Now.ToString(
"yyyyMMdd"
)
.DOCDATE = Now.ToShortDateString
.CSTPONBR = _BEG.PurchaseOrderNumber
.PRSTADCD = PRSTADCD
.PRBTADCD = PRSTADCD
.ReqShipDate = RequestedShipDate
.LOCNCODE = strLocationCode
End
With
'assign the header to the master
oSOPTransactionType.taSopHdrIvcInsert = otaSopHdrIvcInsert
Dim
intCurrentLine
As
Int16 = 0
'create the document details
For
Each
line
As
PO1
In
_lstPO1
'declare an object for the detail line
Dim
oItemsTaSopLineIvcInsert
As
New
Microsoft.Dynamics.GP.eConnect.Serialization.taSopLineIvcInsert_ItemsTaSopLineIvcInsert
'populate the detail line
With
oItemsTaSopLineIvcInsert
oItemsTaSopLineIvcInsert.SOPTYPE = 2
oItemsTaSopLineIvcInsert.ITEMNMBR = line.ITEMNMBR
oItemsTaSopLineIvcInsert.QUANTITY = line.quantity
oItemsTaSopLineIvcInsert.CUSTNMBR = CUSTNMBR
oItemsTaSopLineIvcInsert.DOCDATE = Now.ToShortDateString
oItemsTaSopLineIvcInsert.LOCNCODE = strLocationCode
oItemsTaSopLineIvcInsert.INTEGRATIONID = line.Pack
ReDim
Preserve
oSOPTransactionType.taSopLineIvcInsert_Items(intCurrentLine)
oSOPTransactionType.taSopLineIvcInsert_Items(intCurrentLine) = oItemsTaSopLineIvcInsert
End
With
intCurrentLine += 1
Next
ReDim
Preserve
oeConnectType.SOPTransactionType(0)
oeConnectType.SOPTransactionType(0) = oSOPTransactionType
Dim
strDoc
As
String
= oeConnectFunctions.CreateTransactionEntity(oeConnectType)
Catch
ex
As
Exception
Throw
ex
End
Try
End
Sub