Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Using eConnect to update sales order lines

Posted on by 75,730

I have a small customization that moves orders from one batch to another. They have now decided that they want the code to also adjust the quantity to invoice, quantity allocated and quantity to back order. Can I use eConnect to adjust quantities or will I need to delete all lines on the sales orders and reimport them with the adjusted quantities?

Categories:
  • Richard Wheeler Profile Picture
    Richard Wheeler 75,730 on at
    RE: Using eConnect to update sales order lines

    I have an eConnect import that updates quantities on sales order lines. It works perfectly provided the line was not partially shipped. If there was a partial shipment I get this message.In this case the original order quantity was 20 and 2 were shipped. It is now time to ship the rest. Now along comes the import and the doc type is order, quantity is set to 18 which should be updating QTYTOIVC and QTYTBAOR is set to the original order quantity minus the sum of quantity shipped plus the quantity previously invoiced (20-(18+2) = 0). You can see in error message below that QUANTITY does get set to 18 but it says QTYTBAOR is not being passed down. That is not true. I am setting the value of sopline.QTYTBAOR to 0. Any suggestions as to what I am missing? UpdateIfExists is set to 1.

    eConnectException: Sql procedure error codes returned:

    Error Number = 4777  Stored Procedure= taSopLineIvcInsert  Error Description = Quantities can not exceed total quantity plus quantity already transferred
    Node Identifier Parameters: taSopLineIvcInsert
    SOPNUMBE = WEB000885464
    SOPTYPE = 2
    LNITMSEQ = 65536
    Related Error Code Parameters for Node : taSopLineIvcInsert
    UpdateIfExists = 1
    QTYCANCE = Note: This parameter was not passed in, no value for the parameter will be returned.
    QUANTITY = 18.00000
    QTYTBAOR = Note: This parameter was not passed in, no value for the parameter will be returned.
    QUOTEQTYTOINV = Note: This parameter was not passed in, no value for the parameter will be returned.
    TOTALQTY = Note: This parameter was not passed in, no value for the parameter will be returned.

  • Suggested answer
    Richard Wheeler Profile Picture
    Richard Wheeler 75,730 on at
    RE: Using eConnect to update sales order lines

    This what I found was needed as a minimum:

    The Header:

                                    /* Populate the sales order values into eConnect SO header section */

                                    sopHdrIvc.SOPTYPE = SOPTYPE;

                                    sopHdrIvc.SOPNUMBE = SOPNUMBE;

                                    sopHdrIvc.DOCID = DOCID;

                                    sopHdrIvc.CUSTNMBR = CUSTNMBR;

                                    sopHdrIvc.BACHNUMB = batchNumber;

                                    sopHdrIvc.DOCDATE = DOCDATE;

                                    sopHdrIvc.UpdateExisting = 1;

     

    The Detail:

                                                /* Populate the sales order values into eConnect SO detail section */

                                                sopLine = new taSopLineIvcInsert_ItemsTaSopLineIvcInsert();

                                                sopLine.SOPTYPE = SOPTYPE;

                                                sopLine.SOPNUMBE = SOPNUMBE;

                                                sopLine.CUSTNMBR = CUSTNMBR;

                                                sopLine.DOCDATE  = DOCDATE;

                                                sopLine.ITEMNMBR = ITEMNMBR;

                                                sopLine.QUANTITY = QUANTITY - QTYTBAOR;

                                                sopLine.QTYFULFI = QTYFULFI;

                                                sopLine.QTYTBAOR = QTYTBAOR;

                                                sopLine.LOCNCODE = LOCNCODE;

                                                sopLine.SHIPMTHD = SHIPMTHD;

                                                sopLine.LNITMSEQ = LNITMSEQ;

                                                sopLine.UpdateIfExists = 1;

     

    What I need to accomplish is to take a file sent back to our client from an outside WMS.

    Every now and then what ships is not what we sent to the WMS so any shortages get backordered.

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,730 on at
    RE: Using eConnect to update sales order lines

    Here is my code. I have tried it with and without the SOPNUMBE.

                                   taSopHdrIvcInsert sopHdrIvc = new taSopHdrIvcInsert();

                                   /* Populate the sales order values into eConnect SO header section */

                                   sopHdrIvc.CUSTNMBR = CUSTNMBR;

                                   sopHdrIvc.SOPTYPE = SOPTYPE;

                                   sopHdrIvc.SOPNUMBE = SOPNUMBE;

                                   sopHdrIvc.DOCID = DOCID;

                                   sopHdrIvc.BACHNUMB = batchNumber;

                                   sopHdrIvc.DOCDATE = DOCDATE;

                                   sopHdrIvc.UpdateExisting = 1;

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,730 on at
    RE: Using eConnect to update sales order lines

    I have this close to working but I am getting this message even though I am providing the SOPNUMBE and SOPTYPE to both the header and footer.

    "If UpdateExisting is set to 1 then a transaction document number must be provided"

    Do I have to update the header and lines separately?

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,730 on at
    RE: Using eConnect to update sales order lines

    Sandip, when I call Tasoplineivcinsert how do I put it in Transaction? I will be doing something like this only on the SOP side. I could do it differently and build the call to Tasoplineivcinsert in a stored procedure and wrap it inside Begin Transaction ... End Transaction.

                                   POPReceivingsType POPReceipt = new POPReceivingsType();

                                   POPReceipt.taPopRcptHdrInsert = popRctHeader;

                                   POPReceipt.taPopRcptLineInsert_Items = popRctLines.ToArray();

                                   POPReceivingsType[] POPReceiptType = { POPReceipt };

                                   eConnectType eConnect = new eConnectType();

                                   eConnect.POPReceivingsType = POPReceiptType;

                                   MemoryStream memStream = new MemoryStream();

                                   XmlSerializer serializer = new XmlSerializer(eConnect.GetType());

                                   serializer.Serialize(memStream, eConnect);

                                   memStream.Position = 0;

                                   XmlDocument xmlDocument = new XmlDocument();

                                   xmlDocument.Load(memStream);

                                   memStream.Close();

                                   eConn eConn = new eConn(Globals.GPServer, Globals.GPUserID, Globals.GPPassword);

                                   string response = "";

                                   returnValue = eConn.InsertTransaction(ref response, xmlDocument.OuterXml);

  • Suggested answer
    sandipdjadhav Profile Picture
    sandipdjadhav 18,265 on at
    RE: Using eConnect to update sales order lines

    Hello Richard, If you are using C# to do eConnect you need to send almost all information again to update the Line Items. e.g. Header, Line, Distribution etc.

    To avoid providing all information again to eConnect; I used StoreProcs "Tasoplineivcinsert" to update the SOP line items.  Please make sure to put the StoreProcs in "Transaction" to rollback if there is any error. I have seen several time On Error it delete the lines permanently.

    Let me know how it goes.

    Thanks much

    Sandip

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,730 on at
    RE: Using eConnect to update sales order lines

    Adam, this is part of a large integration to an outside WMS. We export orders out via an SFTP server. The WMS then sends these orders back with what actually shipped which may or may not be what was originally sent. I believe I can set eConnect to update these lines so all the needed inventory adjustments will be done. I will find out shortly if this will work once I finish the code.

  • agaber Profile Picture
    agaber on at
    RE: Using eConnect to update sales order lines

    Hi Richard-

    Thank you for submitting your question on the Forums.  I have not seen anyone try to change the quantities on the line(other than directly in GP) after the initial importing is done, but will see if any of my colleagues have.  We can see if anyone else in the community chimes in as well on this.  Are any of these transactions associated with the Manufacturing module in GP though?

    Have a great day!

    Adam G.

    Microsoft Dynamics GP

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans