Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

How to force eConnect to generate next sales order number(DOCNUMBR) automatically

Posted on by 145

 

Our client want to integrate GP 2010 with their desktop application to post Invoice into GP using eConnect. We have build an eConnect WCF service to configure the GP Server and eConnect on the server and include the DLLs in "Client" application(application is using that WCF Service) and things just work. We are using 'SaveTranscationEntity' method of eConnect in Client app, we pass an eConnect XML document to create a Microsoft Dynamics GP sales order. The content of the XML document should have  prompt eConnect to query Microsoft Dynamics GP for the next sales order number like it does in SOPTransaction. But in case of RMTransaction it didn't.

The XML from the document is as follows:

 

<!-- RM Transaction with Sales/Invoice and taxes -->

<eConnect xmlns:dt="urn:schemas-microsoft-com:datatypes">

    <RMTransactionType>

                                <taRMTransactionTaxInsert_Items>

                                                <taRMTransactionTaxInsert>

                                                                <CUSTNMBR>ASSOCIAT0001</CUSTNMBR>

                                                                <DOCNUMBR>SALES000000000462</DOCNUMBR>

                                                                <RMDTYPAL>1</RMDTYPAL>

                                                                <BACHNUMB>SAVE</BACHNUMB>

                                                                <TAXDTLID>USASTE-PS6N0</TAXDTLID>

                                                                <TAXAMNT>24.00</TAXAMNT>

                                                                <STAXAMNT>0.00</STAXAMNT>

                                                                <FRTTXAMT>0.00</FRTTXAMT>

                                                                <MSCTXAMT>0.00</MSCTXAMT>

                                                                <TAXDTSLS>400.00</TAXDTSLS>

                                                                <ACTINDX></ACTINDX>

                                                                <ACTNUMST></ACTNUMST>

                                                </taRMTransactionTaxInsert>

                                </taRMTransactionTaxInsert_Items>

                                <taRMTransaction>

                                                <RMDTYPAL>1</RMDTYPAL>

                                                <DOCNUMBR>SALES000000000462</DOCNUMBR>

                                                <DOCDATE>2016-10-16</DOCDATE>

                                                <BACHNUMB>SAVE</BACHNUMB>

                                                <CUSTNMBR>ASSOCIAT0001</CUSTNMBR>

                                                <DOCAMNT>424.00</DOCAMNT>

                                                <SLSAMNT>400.00</SLSAMNT>

                                                <DOCDESCR></DOCDESCR>

                                                <CUSTNAME></CUSTNAME>

                                                <ADRSCODE></ADRSCODE>

                                                <SLPRSNID></SLPRSNID>

                                                <SALSTERR></SALSTERR>

                                                <SHIPMTHD></SHIPMTHD>

                                                <TAXSCHID></TAXSCHID>

                                                <CSTPONBR></CSTPONBR>

                                                <COSTAMNT></COSTAMNT>

                                                <TRDISAMT></TRDISAMT>

                                                <FRTAMNT></FRTAMNT>

                                                <MISCAMNT></MISCAMNT>

                                                <TAXAMNT>24.00</TAXAMNT>

                                                <BKTSLSAM></BKTSLSAM>

                                                <BKTFRTAM></BKTFRTAM>

                                                <BKTMSCAM></BKTMSCAM>

                                                <LSTUSRED></LSTUSRED>

                                </taRMTransaction>

                </RMTransactionType>

</eConnect>

 

Now the problem is every time we want to post this Invoice, we first have to assign a new 'DOCNUMBR'. If we make this XML field empty, so that eConnect can assign the next sales order number automatically, then error shows up:

Error:Object reference not set to an instance of an object.

 

And if the provided 'DOCNUMBR' is already exist then this error shows up:

Error:Sql procedure error codes returned:Error Number = 7148  Stored Procedure= taRMTransactionTaxInsert  Error Description = Duplicate Tax Node ID in the RM10601 table

Node Identifier Parameters: taRMTransactionTaxInsert

CUSTNMBR = ASSOCIAT0001

DOCNUMBR = SALES000000000463

RMDTYPAL = 1

TAXDTLID = USASTE-PS6N0

BACHNUMB = SAVE

 

Any thoughts on this, How we can overcome this issue?

Thanks in advance.

 

*This post is locked for comments

  • sandipdjadhav Profile Picture
    sandipdjadhav 18,265 on at
    Re: How to force eConnect to generate next sales order number(DOCNUMBR) automatically

    Moh'd,

    Glad to hear your problem is resolved. Please check RollbackTransaction schema also if you face any error while integration.

    Thanks

    Sandip

  • Re: How to force eConnect to generate next sales order number(DOCNUMBR) automatically

    Hi Sandip,

    Issue is solved. I have used "GetNextRMNumber()" instead of NextSopDocumentNumber() and getting required DOCNUMBR. Code is like:

    GetNextDocNumbers RMTransNumber = new GetNextDocNumbers();

    nextTransactionNumber = RMTransNumber.GetNextRMNumber(IncrementDecrement.Increment, RMPaymentType.RMInvoices, connString);

    Thanks a lot for your kind help.

    Thanks Jerry Higgins for your solution too.

    Muhammad Awais Dilber

  • Re: How to force eConnect to generate next sales order number(DOCNUMBR) automatically

    Hi Sandip,

    I am using your provided service, it works great but its not giving the required document number. I am passing "RM_Transaction-Invoice-Tax.xml" sample XML to CreateTranscationEntity method of eConnect and it works right. Now the thing is I am getting "INV xxx" document number instead of my required i.e " SALESxxxxx ". I am new to GP and eConnect, I am not sure about the TransactionType, GP shows Document Type as "Sales/Invoices" when opened in Smart List so I think TransactionType is "SalesInvoice". The question is what to be passed in that service so that it return next Document Number exactly like SALESxxxx.

    I am using your service as method:

    //Method call in my project

    string NextDocNumber = NextSopDocumentNumber("SalesInvoice", "0");

  • Jerry Higgins Profile Picture
    Jerry Higgins 751 on at
    Re: How to force eConnect to generate next sales order number(DOCNUMBR) automatically

    If you are not averse to calling the "taGetSopNumber" stored procedure directly , here is some VB.NET code:

    Note:  NextSOPNumber would contain the next available SOPNUMBE you need

     

                Dim NextSOPNumber as string

                cmd.CommandType = CommandType.StoredProcedure
                cmd.CommandText = "[taGetSopNumber]"
                cmd.Connection = cnn

                With cmd.Parameters
                    .Add("@I_tSOPTYPE", SqlDbType.Int, 4)
                    .Add("@I_cDOCID", SqlDbType.VarChar, 17)
                    .Add("@I_tInc_Dec", SqlDbType.Int, 4)
                    .Add("@O_vSopNumber", SqlDbType.Char, 21).Direction = ParameterDirection.Output
                End With

                With cmd
                    .Parameters("@I_tSOPTYPE").Value = SopType
                    .Parameters("@I_cDOCID").Value = DocID.Trim
                    .Parameters("@I_tInc_Dec").Value = 1
                    .ExecuteNonQuery()
                    NextSOPNumber= .Parameters("@O_vSopNumber").Value
                End With

                cmd.Parameters.Clear()

     

  • Verified answer
    sandipdjadhav Profile Picture
    sandipdjadhav 18,265 on at
    Re: How to force eConnect to generate next sales order number(DOCNUMBR) automatically

    Moh'd,

    In eConnect schema is available to get Next Document Number. Here is link from Microsoft : msdn.microsoft.com/.../ff623613.aspx

    I have created custom web Service using above schema for Next Document Number. Please find sample code in following link I tried to document it may useful.

    sandipdjadhav.blogspot.com/.../next-document-number-web-service-using.html

    I hope above solution will help you. Please let me know how it goes.

    Thanks

    Sandip Jadhav

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans