jhicker 6/19/2009 5:58:11 PM

eConnect - Multiple line items in RM batch

We are practically brand new to eConnect so this very well may be a simple answer (to someone who knows what they're doing).

 We have an internal vb.net Windows Forms app that we use for all our in-house activity.  We are importing NACHA formatted reject bank files into our database and intend to pass the info through eConnect to Great Plains to create reject invoices in the RM module.  The only code example we have been able to find uses the Sales Order Processing module of GP, which is not where we do it.  We have taken the code and attempted to convert it to the RM class, but it is mainly guesswork.  We were successful in shooting a batch header and a single line item to GP, but cannot get it to work with multiple line items.  The class has less options than the SOP module, but I find it hard to believe that something this simple can't be done.  Can someone take a look at our code and give us some idea what we're doing wrong?  This is the section of code that creates the XML file that is passed to eConnect.  The lines in yellow are the ones that are causing it not to compile.  It's basically the Microsoft sample SOP code, where we have commented out and replaced with RM specific info.  Thanks for any help you can provide!

 Jon

        'This subroutine creates an eConnect invoice XML document and writes the XML to a file

        Public Sub SerializeReceivablesObject(ByVal filename As String)

 

            Try

 

                Dim receivablesOrder As New RMTransactionType               'As New SOPTransactionType

                Dim receivablesLine0 As New taRMTransaction                  'As New taSopLineIvcInsert_ItemsTaSopLineIvcInsert

                Dim receivablesLine1 As New taRMTransaction                 'As New taSopLineIvcInsert_ItemsTaSopLineIvcInsert

                Dim receivablesHDR As New taCreateUpdateBatchHeaderRcd      'As New taSopHdrIvcInsert

                Dim LineItems(1) As taRMTransaction                         'As taSopLineIvcInsert_ItemsTaSopLineIvcInsert

 

                'Populate the elements of the first invoice line

                With receivablesLine0

                    .RMDTYPAL = 1 'If origin is 1 then 1 sales/invoice, 2 error, 3 debit memo, 4 finance charge, 5 service/repairs, 6 warranties, 7 credit memo

                    .DOCNUMBR = "Test1"

                    .DOCDATE = "05/26/2009"

                    .BACHNUMB = "ACHREJ052609"

                    .CUSTNMBR = "19860-27528"

                    .DOCAMNT = 39.0

                    .SLSAMNT = 39.0

                End With

 

                'Add the invoice line to the array

                LineItems(0) = receivablesLine0

 

                'Populate the elements of the second invoice line

                With receivablesLine1

                    .RMDTYPAL = 1 'If origin is 1 then 1 sales/invoice, 2 error, 3 debit memo, 4 finance charge, 5 service/repairs, 6 warranties, 7 credit memo

                    .DOCNUMBR = "Test2"

                    .DOCDATE = "05/26/2009"

                    .BACHNUMB = "ACHREJ052609"

                    .CUSTNMBR = "28613-00000"

                    .DOCAMNT = 100.0

                    .SLSAMNT = 100.0

                End With

 

                'Add the invoice line to the array

                LineItems(1) = receivablesLine1

 

                'Use the array of invoice lines to populate the transaction types array of line items

                ReDim Preserve receivablesOrder.taRMTransaction(1)

                receivablesOrder.taRMTransaction = LineItems

 

                'Populate the elements of the taCreateUpdateBatchHeaderRcd XML node

                With receivablesHDR

                    .BACHNUMB = "ACHREJ052609"

                    .BCHCOMNT = "ACH Rejects settling on 05/26/09"

                    .SERIES = 3

                    '.BCHSOURC = "VCS"

                    .DOCAMT = 139.0

                    .ORIGIN = 1 ' 1 is transaction entry (reject) 2 is cash receipt (collection)

                    .NUMOFTRX = 2

                    .GLPOSTDT = "05/26/2009"

                    '.CHEKBKID = 1

                End With

 

                'Add the header node to the transaction type object

                receivablesOrder.taSopHdrIvcInsert = receivablesHDR

 

                'Create an eConnect document object and populate it with the transaction type object

                Dim eConnect As New eConnectType

                receivablesOrder.taRMTransaction = receivablesLine0

                ReDim Preserve eConnect.RMTransactionType(0) 'SOPTransactionType(0)

                eConnect.RMTransactionType(0) = receivablesOrder

 

                'Create a file on the hard disk

                Dim fs As New FileStream(filename, FileMode.Create)

                Dim writer As New XmlTextWriter(fs, New UTF8Encoding)

 

                ' Serialize using the XmlTextWriter to the file

                Dim serializer As New XmlSerializer(GetType(eConnectType))

                serializer.Serialize(writer, eConnect)

                writer.Close()

 

            Catch ex As System.Exception

                Console.Write(ex.ToString)

            End Try

        End Sub

 

    End Class

 

Version: Unknown or N/A
Section: eConnect


Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3