eConnect - RMTransactionType

Here is a working code example for the Dynamics GP RMTransactionType document

 Edit 7/23/2015 Updated, uses the new methodology with a table that mirrors the eConnect parameters

 

 

Sub CreateRMTransaction(strDocnumbr As String, intRMDTYPAL As Int16, strSqlServer As String, strDatabase As String)
    'this is a complete working example for the RMTransactionType schema, showing how to receive lotted items
 
    'we expect this table to be populated:
    'DDtaRMTransaction
    'the RMDTYPAL and DOCNUMBER parameters of this routine can be used to query the data out of this table
 
    'The fields in these tables are all NULLABLE. The script to create these tables is located here:
    'IMPORTANT: if you don't populate a field in the table it won't be used. Only populated values are imported.
 
    'this code also makes use of the CDBNull Method, documented here:
    Dim strReturnDoc As String = ""
    Try
 
        'declare our eConnect classes
        Dim oeConnectType As New Microsoft.Dynamics.GP.eConnect.Serialization.eConnectType
        Dim oRMTransactionType As New Microsoft.Dynamics.GP.eConnect.Serialization.RMTransactionType
 
        'this is the DynDeveloper eConnect class, documented here:
        Dim oeConnectFunctions As New eConnectFunctions(strSqlServer, strDatabase)
 
        'create the eConnect document header object
        Dim otaRMTransaction As New Microsoft.Dynamics.GP.eConnect.Serialization.taRMTransaction
 
        'populate the header data
        'this line returns a data table that has one field for each field in the eConnect 'mirror' table
        Dim oDT As DataTable = SPs.dd_DDtaRMTransaction_SEL_byID2(intRMDTYPAL, strDocnumbr).getTable
        Dim oRow As DataRow = oDT.Rows(0)
 
        With otaRMTransaction
            .RMDTYPAL = IIf(oRow("RMDTYPAL") Is System.DBNull.Value, Nothing, oRow("RMDTYPAL"))
            .DOCNUMBR = IIf(oRow("DOCNUMBR") Is System.DBNull.Value, Nothing, oRow("DOCNUMBR"))
            .DOCDATE = IIf(oRow("DOCDATE") Is System.DBNull.Value, Nothing, oRow("DOCDATE"))
            .BACHNUMB = IIf(oRow("BACHNUMB") Is System.DBNull.Value, Nothing, oRow("BACHNUMB"))
            .CUSTNMBR = IIf(oRow("CUSTNMBR") Is System.DBNull.Value, Nothing, oRow("CUSTNMBR"))
            .DOCAMNT = IIf(oRow("DOCAMNT") Is System.DBNull.Value, Nothing, oRow("DOCAMNT"))
            .SLSAMNT = IIf(oRow("SLSAMNT") Is System.DBNull.Value, Nothing, oRow("SLSAMNT"))
            .DOCDESCR = IIf(oRow("DOCDESCR") Is System.DBNull.Value, Nothing, oRow("DOCDESCR"))
            .ADRSCODE = IIf(oRow("ADRSCODE") Is System.DBNull.Value, Nothing, oRow("ADRSCODE"))
            .SLPRSNID = IIf(oRow("SLPRSNID") Is System.DBNull.Value, Nothing, oRow("SLPRSNID"))
            .SALSTERR = IIf(oRow("SALSTERR") Is System.DBNull.Value, Nothing, oRow("SALSTERR"))
            .SHIPMTHD = IIf(oRow("SHIPMTHD") Is System.DBNull.Value, Nothing, oRow("SHIPMTHD"))
            .TAXSCHID = IIf(oRow("TAXSCHID") Is System.DBNull.Value, Nothing, oRow("TAXSCHID"))
            .CSTPONBR = IIf(oRow("CSTPONBR") Is System.DBNull.Value, Nothing, oRow("CSTPONBR"))
            .COSTAMNT = IIf(oRow("COSTAMNT") Is System.DBNull.Value, Nothing, oRow("COSTAMNT"))
            .TRDISAMT = IIf(oRow("TRDISAMT") Is System.DBNull.Value, Nothing, oRow("TRDISAMT"))
            .TRDDISCT = IIf(oRow("TRDDISCT") Is System.DBNull.Value, Nothing, oRow("TRDDISCT"))
            .FRTAMNT = IIf(oRow("FRTAMNT") Is System.DBNull.Value, Nothing, oRow("FRTAMNT"))
            .MISCAMNT = IIf(oRow("MISCAMNT") Is System.DBNull.Value, Nothing, oRow("MISCAMNT"))
            .TAXAMNT = IIf(oRow("TAXAMNT") Is System.DBNull.Value, Nothing, oRow("TAXAMNT"))
            .BKTSLSAM = IIf(oRow("BKTSLSAM") Is System.DBNull.Value, Nothing, oRow("BKTSLSAM"))
            .BKTFRTAM = IIf(oRow("BKTFRTAM") Is System.DBNull.Value, Nothing, oRow("BKTFRTAM"))
            .BKTMSCAM = IIf(oRow("BKTMSCAM") Is System.DBNull.Value, Nothing, oRow("BKTMSCAM"))
            .CASHAMNT = IIf(oRow("CASHAMNT") Is System.DBNull.Value, Nothing, oRow("CASHAMNT"))
            .CBKIDCSH = IIf(oRow("CBKIDCSH") Is System.DBNull.Value, Nothing, oRow("CBKIDCSH"))
            .CASHDATE = IIf(oRow("CASHDATE") Is System.DBNull.Value, Nothing, oRow("CASHDATE"))
            .DCNUMCSH = IIf(oRow("DCNUMCSH") Is System.DBNull.Value, Nothing, oRow("DCNUMCSH"))
            .CHEKAMNT = IIf(oRow("CHEKAMNT") Is System.DBNull.Value, Nothing, oRow("CHEKAMNT"))
            .CBKIDCHK = IIf(oRow("CBKIDCHK") Is System.DBNull.Value, Nothing, oRow("CBKIDCHK"))
            .CBKIDCRD = IIf(oRow("CBKIDCRD") Is System.DBNull.Value, Nothing, oRow("CBKIDCRD"))
            .CHEKNMBR = IIf(oRow("CHEKNMBR") Is System.DBNull.Value, Nothing, oRow("CHEKNMBR"))
            .CHEKDATE = IIf(oRow("CHEKDATE") Is System.DBNull.Value, Nothing, oRow("CHEKDATE"))
            .DCNUMCHK = IIf(oRow("DCNUMCHK") Is System.DBNull.Value, Nothing, oRow("DCNUMCHK"))
            .CRCRDAMT = IIf(oRow("CRCRDAMT") Is System.DBNull.Value, Nothing, oRow("CRCRDAMT"))
            .CRCRDNAM = IIf(oRow("CRCRDNAM") Is System.DBNull.Value, Nothing, oRow("CRCRDNAM"))
            .RCTNCCRD = IIf(oRow("RCTNCCRD") Is System.DBNull.Value, Nothing, oRow("RCTNCCRD"))
            .CRCARDDT = IIf(oRow("CRCARDDT") Is System.DBNull.Value, Nothing, oRow("CRCARDDT"))
            .DCNUMCRD = IIf(oRow("DCNUMCRD") Is System.DBNull.Value, Nothing, oRow("DCNUMCRD"))
            .DISCRTND = IIf(oRow("DISCRTND") Is System.DBNull.Value, Nothing, oRow("DISCRTND"))
            .DISTKNAM = IIf(oRow("DISTKNAM") Is System.DBNull.Value, Nothing, oRow("DISTKNAM"))
            .WROFAMNT = IIf(oRow("WROFAMNT") Is System.DBNull.Value, Nothing, oRow("WROFAMNT"))
            .PPSAMDED = IIf(oRow("PPSAMDED") Is System.DBNull.Value, Nothing, oRow("PPSAMDED"))
            .GSTDSAMT = IIf(oRow("GSTDSAMT") Is System.DBNull.Value, Nothing, oRow("GSTDSAMT"))
            .PYMTRMID = IIf(oRow("PYMTRMID") Is System.DBNull.Value, Nothing, oRow("PYMTRMID"))
            .DISAVAMT = IIf(oRow("DISAVAMT") Is System.DBNull.Value, Nothing, oRow("DISAVAMT"))
            .DSCDLRAM = IIf(oRow("DSCDLRAM") Is System.DBNull.Value, Nothing, oRow("DSCDLRAM"))
            .DSCPCTAM = IIf(oRow("DSCPCTAM") Is System.DBNull.Value, Nothing, oRow("DSCPCTAM"))
            .LSTUSRED = IIf(oRow("LSTUSRED") Is System.DBNull.Value, Nothing, oRow("LSTUSRED"))
            .PTDUSRID = IIf(oRow("PTDUSRID") Is System.DBNull.Value, Nothing, oRow("PTDUSRID"))
            .DistRef = IIf(oRow("DistRef") Is System.DBNull.Value, Nothing, oRow("DistRef"))
            .BatchCHEKBKID = IIf(oRow("BatchCHEKBKID") Is System.DBNull.Value, Nothing, oRow("BatchCHEKBKID"))
            .DUEDATE = IIf(oRow("DUEDATE") Is System.DBNull.Value, Nothing, oRow("DUEDATE"))
            .DISCDATE = IIf(oRow("DISCDATE") Is System.DBNull.Value, Nothing, oRow("DISCDATE"))
            .CURNCYID = IIf(oRow("CURNCYID") Is System.DBNull.Value, Nothing, oRow("CURNCYID"))
            .XCHGRATE = IIf(oRow("XCHGRATE") Is System.DBNull.Value, Nothing, oRow("XCHGRATE"))
            .RATETPID = IIf(oRow("RATETPID") Is System.DBNull.Value, Nothing, oRow("RATETPID"))
            .EXPNDATE = IIf(oRow("EXPNDATE") Is System.DBNull.Value, Nothing, oRow("EXPNDATE"))
            .EXCHDATE = IIf(oRow("EXCHDATE") Is System.DBNull.Value, Nothing, oRow("EXCHDATE"))
            .EXGTBDSC = IIf(oRow("EXGTBDSC") Is System.DBNull.Value, Nothing, oRow("EXGTBDSC"))
            .EXTBLSRC = IIf(oRow("EXTBLSRC") Is System.DBNull.Value, Nothing, oRow("EXTBLSRC"))
            .RATEEXPR = IIf(oRow("RATEEXPR") Is System.DBNull.Value, Nothing, oRow("RATEEXPR"))
            .DYSTINCR = IIf(oRow("DYSTINCR") Is System.DBNull.Value, Nothing, oRow("DYSTINCR"))
            .RATEVARC = IIf(oRow("RATEVARC") Is System.DBNull.Value, Nothing, oRow("RATEVARC"))
            .TRXDTDEF = IIf(oRow("TRXDTDEF") Is System.DBNull.Value, Nothing, oRow("TRXDTDEF"))
            .RTCLCMTD = IIf(oRow("RTCLCMTD") Is System.DBNull.Value, Nothing, oRow("RTCLCMTD"))
            .PRVDSLMT = IIf(oRow("PRVDSLMT") Is System.DBNull.Value, Nothing, oRow("PRVDSLMT"))
            .DATELMTS = IIf(oRow("DATELMTS") Is System.DBNull.Value, Nothing, oRow("DATELMTS"))
            .TIME1 = IIf(oRow("TIME1") Is System.DBNull.Value, Nothing, oRow("TIME1"))
            .COMDLRAM = IIf(oRow("COMDLRAM") Is System.DBNull.Value, Nothing, oRow("COMDLRAM"))
            .COMAPPTO = IIf(oRow("COMAPPTO") Is System.DBNull.Value, Nothing, oRow("COMAPPTO"))
            .RequesterTrx = IIf(oRow("RequesterTrx") Is System.DBNull.Value, Nothing, oRow("RequesterTrx"))
            .CREATEDIST = IIf(oRow("CREATEDIST") Is System.DBNull.Value, Nothing, oRow("CREATEDIST"))
            .USRDEFND1 = IIf(oRow("USRDEFND1") Is System.DBNull.Value, Nothing, oRow("USRDEFND1"))
            .USRDEFND2 = IIf(oRow("USRDEFND2") Is System.DBNull.Value, Nothing, oRow("USRDEFND2"))
            .USRDEFND3 = IIf(oRow("USRDEFND3") Is System.DBNull.Value, Nothing, oRow("USRDEFND3"))
            .USRDEFND4 = IIf(oRow("USRDEFND4") Is System.DBNull.Value, Nothing, oRow("USRDEFND4"))
            .USRDEFND5 = IIf(oRow("USRDEFND5") Is System.DBNull.Value, Nothing, oRow("USRDEFND5"))
        End With
 
        'assign the header to the master
        oRMTransactionType.taRMTransaction = otaRMTransaction
 
        ReDim Preserve oeConnectType.SOPDeleteDocumentType(0)
        oeConnectType.RMTransactionType(0) = oRMTransactionType
        strReturnDoc = oeConnectFunctions.CreateTransactionEntity(oeConnectType)
 
    Catch ex As Exception
        Throw ex
    End Try
End Sub

 

 


RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences