Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

How to Sales Order Number created via this eConnect this?

Posted on by Microsoft Employee

Hi,

I was using eConnect to connect my .net application with the Microsoft Dynamics GP, and below is my code I was using.

using (eConnectMethods eConnectMethods = new eConnectMethods())
{
    SOPTransactionType salesOrder = new SOPTransactionType();

    taSopLineIvcInsert_ItemsTaSopLineIvcInsert salesLine = new taSopLineIvcInsert_ItemsTaSopLineIvcInsert();
    taSopHdrIvcInsert salesHdr = new taSopHdrIvcInsert();

    taSopLineIvcInsert_ItemsTaSopLineIvcInsert[] LineItems = new taSopLineIvcInsert_ItemsTaSopLineIvcInsert[1];

    salesLine.CUSTNMBR = "PLAZAONE0001";
    salesLine.SOPTYPE = 2;
    salesLine.DOCID = "STDORD";
    salesLine.QUANTITY = 2;
    salesLine.ITEMNMBR = "3-B3813A";
    salesLine.UNITPRCE = 100;
    salesLine.XTNDPRCE = 200;
    salesLine.DOCDATE = System.DateTime.Today.ToString("MM/dd/yyyy");

    LineItems[0] = salesLine;

    salesOrder.taSopLineIvcInsert_Items = LineItems;

    salesHdr.SOPTYPE = 2;
    salesHdr.DOCID = "STDORD";
    salesHdr.BACHNUMB = "B1";
    salesHdr.DOCDATE = System.DateTime.Today.ToString("MM/dd/yyyy");
    salesHdr.CUSTNMBR = "PLAZAONE0001";
    salesHdr.SUBTOTAL = 200;
    salesHdr.DOCAMNT = 200;

    salesHdr.USINGHEADERLEVELTAXES = 0;
    salesHdr.PYMTRMID = "Net 30";

    salesOrder.taSopHdrIvcInsert = salesHdr;
    eConnectType eConnect = new eConnectType();
    SOPTransactionType[] MySopTransactionType = new SOPTransactionType[1] { salesOrder };

    eConnect.SOPTransactionType = MySopTransactionType;

    // Serialize the master vendor type in memory.
    MemoryStream memoryStream = new MemoryStream();
    XmlSerializer xmlSerializer = new XmlSerializer(eConnect.GetType());


    // Serialize the eConnectType.
    xmlSerializer.Serialize(memoryStream, eConnect);

    // Reset the position of the memory stream to the start.              
    memoryStream.Position = 0;

    // Create an XmlDocument from the serialized eConnectType in memory.
    XmlDocument xmlDocument = new XmlDocument();
    xmlDocument.Load(memoryStream);
    memoryStream.Close();

    // Call eConnect to process the XmlDocument.
    eConnectMethods.CreateEntity(connectionString, xmlDocument.OuterXml);
}


This creates sales entry transaction in Dynamics GP, and how can I get Sales Number for the newly created entry from this code. 

*This post is locked for comments

  • esoftpr Profile Picture
    esoftpr 55 on at
    RE: How to Sales Order Number created via this eConnect this?

    I have the same issue but with the different is that I use Items with lot number tracking method. Will this works to import orders using XML file from eConnect to Dynamics GP?

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to Sales Order Number created via this eConnect this?

    This line did a great job, Thanks a trillion.

       string nextSONum = new GetNextDocNumbers().GetNextSOPNumber(IncrementDecrement.Increment, "DocID", SopType.SOPOrder, "connectionString").Trim();

  • Verified answer
    soma Profile Picture
    soma 24,406 on at
    RE: How to Sales Order Number created via this eConnect this?

    Pass the custom sales order number to this field salesHdr.SOPNUMBE.

    You can use the below code to get the next order number from GP.

    GetNextDocNumbers nextSONum = new GetNextDocNumbers();

    nextSONum = nextSONum .NextSopDocumentNumber(IncrementDecrement.Increment,SOPType, "Connection String");

    Hope this helps!!!

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to Sales Order Number created via this eConnect this?

    Hi,

    Thanks. This code works, and I have no idea how I can get the SO number for the sales entry created by this code? I've no sample codes on my machine. Can you please share some?

  • Suggested answer
    soma Profile Picture
    soma 24,406 on at
    RE: How to Sales Order Number created via this eConnect this?

    If you installed eConnect application, you can find the sample source code for some integration.

    You can run this application by using console or window applications.

    Hope this helps!!!

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans