Search the GP Tables
Search by TABLE NAME
Search by FIELD NAME
These are our SOP scripts. All of our scripts for Dynamics GP can be found here
DynDeveloper.com

DynDeveloper.com

Table Edits Forum Articles
Table Edits 0 Table Edits 0 Table Edits 0
Sign Up Now!Log In
kgenov 8/7/2015 12:28:29 PM

There is a duplicate XML element ProjNum in the document

Hi,

 I'm creating a Purchase Order with a web service call like this:

1.DynamicsGP ws = new DynamicsGP();
2.Policy policy = ws.GetPolicyByOperation("CreatePurchaseOrder", context);
3.ws.CreatePurchaseOrder(purchaseOrder, context, policy);

It all works fine until i try to set ProjectKey and CostCategoryKey to PO line items.

Project accounting module is also installed.

 The PO lines are created like this:

01.PurchaseOrderLine poLine = new PurchaseOrderLine();
02.poLine.Key = new PurchaseTransactionLineKey();
03.poLine.Key.LineSequenceNumber = sequenceNumber;
04.poLine.Key.PurchaseTransactionKey = purchaseOrder.Key;
05.poLine.WarehouseKey = new WarehouseKey();
06.poLine.WarehouseKey.Id = item.SiteKey;
07.poLine.UofM = item.UnitOfMeasure;
08.poLine.QuantityOrdered = new Quantity();
09.poLine.QuantityOrdered.Value = Convert.ToDecimal(item.Quantity.Value);
10.poLine.UnitCost = new MoneyAmount();
11.poLine.UnitCost.Currency = "USD";
12.poLine.UnitCost.DecimalDigits = 2;
13.poLine.UnitCost.Value = Convert.ToDecimal(item.UnitCost.Value);
14.poLine.IsNonInventory = !item.IsInventoryItem.GetValueOrDefault(false);
15. 
16.poLine.ProjectKey = new ProjectKey();
17.poLine.ProjectKey.Id = item.ProjectId;
18. 
19.poLine.CostCategoryKey = new CostCategoryKey();
20.poLine.CostCategoryKey.Id = item.CostCategoryId;

When I added the code to set the ProjectKey and CostCategoryKey - lines 16 - 20, I started getting the following error from eConnect:

Exception type:
Microsoft.Dynamics.GP.eConnect.eConnectException

Exception message:
There is a duplicate XML element ProjNum in the document. Please correct it and try again.

Stack Trace:
   at Microsoft.Dynamics.GP.eConnect.EntityMessageProcessor.ExtractStoredProcedureParameters(EntityMessage message, IEnumerable`1 xmlList)
   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.CreateEntity(String connectionString, String sXML)

 

I was able to create a Purchase Order with the same parameters I'm passing to the web service call through the UI and all went fine.

 

Any help or advice is very much appreciated!

Thanks in advance!

Version: GP 2013
Section: Dynamics GP, eConnect, Web Services








Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables