Skip to content
+1-888-319-3663

COMMUNITY FORUM

'An item with the same key has already been added' Error while atempting to map PO receipt items

Juan P Gonzalez asked 6 years ago
Hello everyone, greetings from Colombia!
 
Currently we are working on an integration that enables us to create a Dynamics GP 2010 PO Receipt Document through SmartConnect for the intended entity to further process (add costs, freights, posting and so forth). We are taking the PO receipt example on the SmartConnect Downloads page as a basis, and attempting to commit the transaction in three different ways: bare essentials, receiving against a PO number, and receiving without a PO number.
The data source is set as per the example, and also we are working with test PO data from a databse in another map created with the accompanying document within the aforementioned download. The destination is set to a test company which is often restored with live, production data,Purchase Order Processing Group, Receivings Node Type. The configured mappings are made for Receipt Line Item, as well as Create Receipt.
Our work method, as for understanding how this map works and which tables become affected after a successful map run, is performed on a Trial and Error basis: every time we get a Stored Procedure related error, we modify the mapping accordingly, up until we get an ‘An item with the same key has already been added’ error.
Checking the Event Viewer for SmarConnect related events, we get an input that contains this error and nothing eConnect related is shown. The following texts correspond to the XML debugging output from the map, and the extended eConnect error message from the particular event.
<?xml version=”1.0″ encoding=”utf-8″?>
<eConnect>
<POPReceivingsType>
<eConnectProcessInfo>
<ConnectionString>data source=AAA.BBB.C.D\ERP;initial catalog=TEST2;integrated security=SSPI;persist security info=False;packet size=4096;Connect Timeout=10</ConnectionString>
</eConnectProcessInfo>
<taPopRcptLineInsert_Items>
<taPopRcptLineInsert>
<VNDITNUM>2866679</VNDITNUM>
<VENDORID>PXCALE0001</VENDORID>
<POPTYPE>1</POPTYPE>
<QTYSHPPD>1</QTYSHPPD>
<ITEMNMBR>2866679</ITEMNMBR>
<AUTOCOST>1</AUTOCOST>
<LOCNCODE>PXC</LOCNCODE>
<receiptdate>2015-5-31</receiptdate>
<POPRCTNM>PE0000006</POPRCTNM>
</taPopRcptLineInsert>
</taPopRcptLineInsert_Items>
<taPopRcptHdrInsert>
<receiptdate>2015-5-31</receiptdate>
<BACHNUMB>PO99839</BACHNUMB>
<VENDORID>PXCALE0001</VENDORID>
<POPTYPE>1</POPTYPE>
<AUTOCOST>1</AUTOCOST>
<POPRCTNM>PE0000006</POPRCTNM>
</taPopRcptHdrInsert>
</POPReceivingsType>
</eConnect>
 
SmartConnect Error Event: PORECEIPT: An item with the same key has already been added.
eConnect Error Events: Action: Create Current User Name: Input parameters: Exception type: Microsoft.Dynamics.GP.eConnect.eConnectException Exception message: An item with the same key has already been added. Stack Trace: at Microsoft.Dynamics.GP.eConnect.ServiceProxy.CreateEntity(String connectionString, String xml) at Microsoft.Dynamics.GP.eConnect.eConnectMethods.EntityImportImplementation(String connectionString, String sXML, Boolean isTransaction) at Microsoft.Dynamics.GP.eConnect.eConnectMethods.ProcessEntityImport(String connectionString, String sXML, Boolean isTransaction) at Microsoft.Dynamics.GP.eConnect.eConnectMethods.CreateEntity(String ConnectionString, String sXML) 
Action: Service Create Current User Name: XXXX\YYYYYYYYYYYYY Input parameters: Exception type: System.ArgumentException Exception message: An item with the same key has already been added. Stack Trace: at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at Microsoft.Dynamics.GP.eConnect.ErrorHandler.ParseErrorCodes(String ErrorString) at Microsoft.Dynamics.GP.eConnect.ErrorHandler.GenerateExceptionFromProcErrors(String errorString, XElement transactionXmlNode, SqlConnection connection) at Microsoft.Dynamics.GP.eConnect.EntityMessageProcessor.ExecuteSqlCommands(XElement transactionNode, EntityMessage message) at Microsoft.Dynamics.GP.eConnect.eConnectMethods.ProcessMessageImport(EntityMessage message) at Microsoft.Dynamics.GP.eConnect.eConnectMethods.EntityImportImplementation(String connectionString, String sXML, Boolean isTransaction) at Microsoft.Dynamics.GP.eConnect.eConnectMethods.ProcessEntityImport(String connectionString, String sXML, Boolean isTransaction) at Microsoft.Dynamics.GP.eConnect.eConnectMethods.CreateEntity(String ConnectionString, String sXML) at Microsoft.Dynamics.GP.eConnect.Service.CreateEntity(String ConnectionString, String sXML)
 
Any pointer to solve this particular issue will be greatly appreciated.
Thanks in Advance,
 
Juan P. Gonzalez
R&D Engineer at Colsein Ltda.
Answers
Lorren Zemke Staff answered 6 years ago
Juan,
This message always means that Microsoft eConnect has returned the same error number twice within it’s process.
The only method to track this down is to run Microsoft SQL Server Profiler to capture the stored procedure call. Then take that procedure call and execute it in SQL Server management studio to see the error’s being returned in the ErrString Parameter for that stored procedure.
From those error numbers, you can query the DYNAMICS..taErrorCode table to find the actual error message.
 
Lorren
Kitty Geiger replied 5 years ago

After testing the heck out of this error. The most common reason that triggers this message with is that the Gl account is not linked in the Account Class.

Don Tricker replied 4 years ago

Hi, I have actually solved an issue of this instance after incorrectly assuming the document type node on the taAnalyticsDistribution procedure is the same as the PM Transaction. I changed the Document Type to 0 (PM Voucher for AA), then it worked like a charm


If you would like to submit an answer or comment, please sign in to the eOne portal.