Site Search:
Sign in | Join | Help

eConnect - Multiple line items in RM batch

Last post 10-26-2009 3:16 PM by jhicker. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 06-19-2009 5:58 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

     

    • Post Points: 37
  • 06-19-2009 6:12 PM In reply to

    • Steve Gray
    • Top 10 Contributor
      Male
    • Joined on 01-10-2007
    • Bradenton, Florida
    • Guru
    • Points 2,318

    Re: eConnect - Multiple line items in RM batch

    I could be wrong, but it looks to me like you are trying to send header and lines to the RM module. RM doesn't support that.

    Could you open the RM Transaction form in dynamics and see if you can key your transaction manually there?

    Steve Gray, MCDBA
    Technical Editor
    steve@VSToolsForum.com
    • Post Points: 0
  • 06-23-2009 1:25 PM In reply to

    Re: eConnect - Multiple line items in RM batch

    Steve, thanks for the response.  We are able to post multiple line items to a single batch in the RM module.  We're simply trying to imitate through eConnect what we already do manually but aren't having much luck.  Do you know for a fact that RM won't support this?  Is it possible that you can do it manually but not through eConnect?

    Thanks again!

    Jon

    • Post Points: 0
  • 06-23-2009 1:44 PM In reply to

    • Steve Gray
    • Top 10 Contributor
      Male
    • Joined on 01-10-2007
    • Bradenton, Florida
    • Guru
    • Points 2,318

    Re: eConnect - Multiple line items in RM batch

    Oh - sorry. If you can do it manually, you should be able to do it through eConnect.

    RM does not support a 'header-detail' type of structure, which you seem to indicate above.

    Let's simplify. Remove receivablesLine1 and receivablesHDR in the example above. Send one autonomous document, let me know how that goes.

     

    Steve Gray, MCDBA
    Technical Editor
    steve@VSToolsForum.com
    • Post Points: 0
  • 06-23-2009 1:57 PM In reply to

    • Steve Gray
    • Top 10 Contributor
      Male
    • Joined on 01-10-2007
    • Bradenton, Florida
    • Guru
    • Points 2,318

    Re: eConnect - Multiple line items in RM batch

    One more thing... it is possible to have several transactions in one batch... but let's get a single trans working first, before we get bolder.

     Personally, I keep my transactions sent to Dynamics as small as possible. I try to only send one document at a time. If there is an error in that doc I handle it and then move to the next. Just keep using the same batch number, you'll be OK.

    Steve Gray, MCDBA
    Technical Editor
    steve@VSToolsForum.com
    • Post Points: 0
  • 06-23-2009 3:17 PM In reply to

    Re: eConnect - Multiple line items in RM batch

    We were previously successful in getting a single transaction to work.  We would shoot a batch header (example:  .DOCAMT = 100.0, .NUMOFTRX = 1) and a single receivables line (.DOCAMNT = 100.0) and it worked.  It was when we tried to send a batch header and multiple receivables lines (all at once) that we ran into trouble.  So, let me see if I'm understanding you right...  We should send a batch header, then in a separate call, send the 1st receivables line, then in a separate call, send the 2nd receivables line, etc...  Does that sound right?  Or should we send the batch header with each receivables line we send, but only one receivables line at a time?  FYI...  at most points int the month, we will be sending 10-20 lines in a batch.  But one or two days of the month, it will be 300-500 line items.  Obviously someone here is sick of manually creating those invoices!

    • Post Points: 0
  • 06-23-2009 3:27 PM In reply to

    • Steve Gray
    • Top 10 Contributor
      Male
    • Joined on 01-10-2007
    • Bradenton, Florida
    • Guru
    • Points 2,318

    Re: eConnect - Multiple line items in RM batch

    "Send a batch header" doesn't make sense to me.

    Send one document, and be sure you populate the BACHNUMB field.

    Send a second document and use the same text in the BACHNUMB field. They'll both be in the same batch.

    That's all there is to it.

    Steve Gray, MCDBA
    Technical Editor
    steve@VSToolsForum.com
    • Post Points: 0
  • 10-26-2009 7:51 AM In reply to

    Re: eConnect - Multiple line items in RM batch

    Did you guys ever figure this out? Your code seems to be extremely confusing. I think one of the problem is trying to assign a batch header record to a SOPHeader record. Not sure how you can do this? By the way your original commented code looked right..

     receivablesOrder.taSopHdrIvcInsert = receivablesHDR (Which is of type taCreateUpdateBatchHeaderRcd )

    Let me know if you need any further help.

     

    • Post Points: 19
  • 10-26-2009 3:16 PM In reply to

    Re: eConnect - Multiple line items in RM batch

    Yes, with Steve's help we figured it out.  We just didn't send a batch header record which fixed the problem.  The Microsoft SOP example had one so we assumed it would be required for RM transactions as well.  I hope that explanation makes sense, this was my only try at coding to eConnect and it's been four months since I did it.  It ended up working perfectly, though!  Thanks!

    • Post Points: 1
Page 1 of 1 (9 items)