web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Error Number = 2221 Stored Procedure= taSopLineIvcInsert Error Description = Duplicate document number. If adding or updating lines to an existing document, UpdateIfExists must = 1

(0) ShareShare
ReportReport
Posted on by

i am using Microsoft Dyanmic Gp, econnect 10.0. i am trying get the tasoplineinvoiceitems. 

If i set for updateifexist =0; then it gives the error like:

eConnectTraceSource Error: 735 : Create Transaction Entity produced the following exception:Sql procedure error codes returned:Error Number = 2221  Stored Procedure= taSopLineIvcInsert  Error Description = Duplicate document number. If adding or updating lines to an existing document, UpdateIfExists must = 1

Node Identifier Parameters: taSopLineIvcInsert

SOPNUMBE =   220,584

SOPTYPE = 3

LNITMSEQ = 3

Related Error Code Parameters for Node : taSopLineIvcInsert

UpdateIfExists = Note: This parameter was not passed in, no value for the parameter will be returned.

<taSopLineIvcInsert>

  <SOPTYPE>3</SOPTYPE>

  <SOPNUMBE>  220,584</SOPNUMBE>

  <CUSTNMBR>3253</CUSTNMBR>

  <DOCDATE>4/08/2011</DOCDATE>

  <ITEMNMBR>4410 - BA - 001</ITEMNMBR>

  <UNITPRCE>162.79</UNITPRCE>

  <XTNDPRCE>162.79</XTNDPRCE>

  <QUANTITY>1</QUANTITY>

  <ITEMDESC>Standard Designer Rpl DH</ITEMDESC>

  <NONINVEN>1</NONINVEN>

  <LNITMSEQ>3</LNITMSEQ>

  <DOCID>STDINV</DOCID>

  <DEFEXTPRICE>1</DEFEXTPRICE>

  <UOFM>EACH</UOFM>

</taSopLineIvcInsert>

...................................................................................................................................................................................

Note:Even i try  to set 1 for updateifExist

 i chenged value of updateifexist=1;

 i got error like :eConnectTraceSource Error: 735 : Create Transaction Entity produced the following exception: Sql procedure error codes returned: 

Error Number = 2608  Stored Procedure= taSopLineIvcInsert  Error Description = Document does not exist in the Work File - SOP10100 - the Line can not be modifiedNode Identifier Parameters: taSopLineIvcInsert

SOPNUMBE =   220,584

SOPTYPE = 3

LNITMSEQ = 2

Related Error Code Parameters for Node : taSopLineIvcInsert

UpdateIfExists = 1

Can you please give the suggestion, where i did mistake here and how much value i have to set for the upadateifexist fpr tasoplineiveinsert.

 

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi Kavitha,

    Search for that document in GP. Is it posted? Enquiry >> Sales >> Sales Documents. Is the document in History?

    If it is posted, you will not be able to update the document through eConnect.

    Ian.

  • leepaowen Profile Picture
    5 on at

    I am not sure if this will work for your case, but in my codes the DOCID is pass in to get next sop

    NextSOPNum.GetNextSopNumber(2, "STANDARD-ORDER", myConnection);

    and

    DOCID is specified as "Standard-Order" for SOPTYPE= 2

      salesLine.SOPTYPE = 2;
      salesLine.DOCID = "STANDARD-ORDER";

    here is complete list of my codes

    public void SerializeSalesOrderObject(string filename) {
            //submit a xml order file by getting the latest sales order file
            try {

                SOPTransactionType salesOrder = new SOPTransactionType();
                taSopHdrIvcInsert salesHdr = new taSopHdrIvcInsert();
                taSopLineIvcInsert_ItemsTaSopLineIvcInsert salesLine = new taSopLineIvcInsert_ItemsTaSopLineIvcInsert();
                taSopLineIvcInsert_ItemsTaSopLineIvcInsert salesLine2 = new taSopLineIvcInsert_ItemsTaSopLineIvcInsert();
                taSopLineIvcInsert_ItemsTaSopLineIvcInsert[] LineItems = new taSopLineIvcInsert_ItemsTaSopLineIvcInsert[2];

                salesLine.CUSTNMBR = "70134";//select top 10 * from dbo.RM00101 where custnmbr='70134'
                salesLine.ADDRESS1 = "8201 Ave.";
                salesLine.CITY = "Van Nuys";
                salesLine.LOCNCODE = "MAIN";
                salesLine.DOCDATE = System.DateTime.Today.ToString("MM/dd/yyyy");
                salesLine.SOPTYPE = 2;
                salesLine.DOCID = "STANDARD-ORDER";
                // Button2.Text = NextSOPNum.GetNextSopNumber(2, "STANDARD-ORDER", myConnection);
                salesLine.SOPNUMBE = Button2.Text;
                salesLine.QUANTITY = 200;
                salesLine.ITEMNMBR = "08-06-5114";
                salesLine.ITEMDESC = "UN: DELL 5310, 5210, IBM 1572, 1552, 1532 UNI 540, 544 HY (21K Yld) -GEN";
                salesLine.UNITPRCE = decimal.Parse("10.95");
                salesLine.XTNDPRCE = decimal.Parse("2190");
                salesLine.UOFM = "1";
                LineItems[0] = salesLine;

                salesLine2.ADDRESS1 = "8201 Ave.";
                salesLine2.CUSTNMBR = "70134";
                salesLine2.SOPNUMBE = Button2.Text;
                salesLine2.CITY = "Van Nuys";
                salesLine2.SOPTYPE = 2;
                salesLine2.DOCID = "STANDARD-ORDER";
                salesLine2.QUANTITY = 2;
                salesLine2.ITEMNMBR = "02-21-3914";
                salesLine2.ITEMDESC = "HP LASERJET 4300 SY-NEW DRUM MSE BRAND";
                salesLine2.UNITPRCE = decimal.Parse("15.95");
                salesLine2.XTNDPRCE = decimal.Parse("31.9");
                salesLine2.LOCNCODE = "MAIN";//why no location code for line one?, plee
                salesLine2.DOCDATE = System.DateTime.Today.ToString("MM/dd/yyyy");
                LineItems[1] = salesLine2;

                salesHdr.SOPTYPE = 2;
                salesHdr.SOPNUMBE = Button2.Text;
                salesHdr.DOCID = "STANDARD-ORDER";
                salesHdr.BACHNUMB = "eConnect";
                salesHdr.TAXSCHID = "NO-SLS-TAX";
                salesHdr.FRTSCHID = "NO-SLS-TAX";
                salesHdr.MSCSCHID = "NO-SLS-TAX";
                salesHdr.LOCNCODE = "MAIN";
                salesHdr.DOCDATE = System.DateTime.Today.ToString("MM/dd/yyyy");
                salesHdr.CUSTNMBR = "70134";
                salesHdr.CUSTNAME = "MICRO SOFT";
                salesHdr.ShipToName = "MICRO SOFT";
                salesHdr.ADDRESS1 = "8201 Ave.";
                salesHdr.CNTCPRSN = "test eConnect";
                salesHdr.FAXNUMBR = "xxxxxxxx";
                salesHdr.CITY = "Van Nuys";
                salesHdr.STATE = "CA";
                salesHdr.ZIPCODE = "91406";
                salesHdr.COUNTRY = "USA";
                salesHdr.SUBTOTAL = decimal.Parse("2221.90");
                salesHdr.DOCAMNT = decimal.Parse("2221.90");
                salesHdr.USINGHEADERLEVELTAXES = 0;
                salesHdr.PYMTRMID = "Net 30";

                salesOrder.taSopLineIvcInsert_Items = LineItems;
                salesOrder.taSopHdrIvcInsert = salesHdr;

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

                // Using FileStream - OK
                FileStream fs = new FileStream(filename, FileMode.Create);
                //Starting with the .NET Framework 2.0, we recommend that you use the System.Xml.XmlWriter class instead.
                XmlTextWriter writer = new XmlTextWriter(fs, new UTF8Encoding());
                XmlSerializer serializer = new XmlSerializer(eConnect.GetType());
                serializer.Serialize(writer, eConnect);
                writer.Close();

                //// Test using STREAM
                //MemoryStream sStream = new MemoryStream();
                //StreamWriter w = new StreamWriter(sStream, new UTF8Encoding());
                //XmlSerializer serializer = new XmlSerializer(eConnect.GetType());
                //serializer.Serialize(w, eConnect);
                //w.Close();

            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }
        }

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
mtabor Profile Picture

mtabor 1

#2
Victoria Yudin Profile Picture

Victoria Yudin 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans