Dynamics GP eConnect SOP Invoice XML Generator
This generator builds an eConnect SOPTransactionType XML document that creates a Sales Order Processing invoice or order in Dynamics GP 2013 through 18.x, plus a minimal C# program that sends it with eConnectMethods.CreateTransactionEntity. Change the fields and copy both blocks.
Fill in
3 = Invoice, 2 = Order
Must exist in Sales Order Processing Document Setup for this SOP type
Supply a number. To use the next number from the Document ID, call the taGetSopNumber stored procedure first.
Quantity x unit price. Sum of all lines must equal SUBTOTAL.
0 = use the prices passed in, 1 = let eConnect look up the GP price
1 = eConnect creates the GL distributions, 0 = you pass taSopDistribution nodes
eConnect XML document (SOPTransactionType)
<?xml version="1.0" encoding="utf-8"?>
<eConnect xmlns:dt="urn:schemas-microsoft-com:datatypes">
<SOPTransactionType>
<taSopLineIvcInsert_Items>
<taSopLineIvcInsert>
<SOPTYPE>3</SOPTYPE>
<SOPNUMBE>INV-000123</SOPNUMBE>
<CUSTNMBR>AARONFIT0001</CUSTNMBR>
<DOCDATE>2026-10-22</DOCDATE>
<LOCNCODE>WAREHOUSE</LOCNCODE>
<ITEMNMBR>128 SDRAM</ITEMNMBR>
<UNITPRCE>89.95</UNITPRCE>
<XTNDPRCE>179.90</XTNDPRCE>
<QUANTITY>2</QUANTITY>
<UOFM>Each</UOFM>
<DOCID>STDINV</DOCID>
<DEFPRICING>0</DEFPRICING>
</taSopLineIvcInsert>
</taSopLineIvcInsert_Items>
<taSopHdrIvcInsert>
<SOPTYPE>3</SOPTYPE>
<DOCID>STDINV</DOCID>
<SOPNUMBE>INV-000123</SOPNUMBE>
<BACHNUMB>EC-SOP-1026</BACHNUMB>
<LOCNCODE>WAREHOUSE</LOCNCODE>
<DOCDATE>2026-10-22</DOCDATE>
<CUSTNMBR>AARONFIT0001</CUSTNMBR>
<SUBTOTAL>179.90</SUBTOTAL>
<DOCAMNT>179.90</DOCAMNT>
<CREATEDIST>1</CREATEDIST>
</taSopHdrIvcInsert>
</SOPTransactionType>
</eConnect>C# call (Microsoft.Dynamics.GP.eConnect)
using System;
using System.IO;
using Microsoft.Dynamics.GP.eConnect;
class PostSopDocument
{
static void Main()
{
string connectionString = "Data Source=GPSQL01;Initial Catalog=TWO;Integrated Security=SSPI;Persist Security Info=False;";
string xml = File.ReadAllText(@"C:\eConnect\INV-000123.xml");
using (eConnectMethods eConCall = new eConnectMethods())
{
try
{
// Returns the XML document with any values eConnect assigned
string result = eConCall.CreateTransactionEntity(connectionString, xml);
Console.WriteLine(result);
}
catch (eConnectException ex)
{
// Business rule errors from the ta procedures arrive here
Console.WriteLine(ex.Message);
}
}
}
}Verify for your build: reference Microsoft.Dynamics.GP.eConnect.dll from the eConnect install that matches your GP version (eConnect 18.x for GP 18.x). Element names come from the taSopHdrIvcInsert and taSopLineIvcInsert schema in the eConnect Programmer's Guide; check element order against SOPTransactionType.xsd in your eConnect folder if you validate against the schema. DOCAMNT equals SUBTOTAL only when there is no tax, freight, misc or trade discount.
Get your eConnect integration reviewed
Send us your SOP document types, tax setup and GP build and we will check the XML and error handling for your environment.
Optional. The tool and every export work without this. No spam.
How to use it
Pick SOPTYPE 3 for an invoice or 2 for an order, then enter a Document ID that exists in Sales Order Processing Setup for that type (STDINV and STDORD in the sample company). Enter the customer, batch, item, site and unit of measure exactly as they exist in GP: eConnect validates every key. Keep XTNDPRCE equal to quantity times unit price and SUBTOTAL equal to the sum of all line extended prices. Save the XML as a file and run the C# program, or pass the string from your own integration service.
- One taSopLineIvcInsert node per line inside taSopLineIvcInsert_Items
- Line nodes come before the header node inside SOPTransactionType
- Set DEFPRICING to 1 to let eConnect price the line from the customer price level
- CREATEDIST 1 lets eConnect build distributions from posting setup
Where this lands in Dynamics GP
eConnect calls the taSopLineIvcInsert and taSopHdrIvcInsert stored procedures in the company database. The document appears in Sales Transaction Entry under the batch you passed (Transactions > Sales > Sales Batches) and is stored in SOP10100 (header) and SOP10200 (lines) until it is posted, after which it moves to SOP30200 and SOP30300. Nothing is posted by eConnect: the batch still needs posting in GP or through a posting tool. The same XML can be dropped on the eConnect incoming MSMQ queue if you use the Incoming Service instead of a direct call.
Worked example
With the defaults, the program creates invoice INV-000123 for customer AARONFIT0001 dated 2026-10-22 in batch EC-SOP-1026: two units of item 128 SDRAM from site WAREHOUSE at 89.95, extended 179.90. SUBTOTAL and DOCAMNT are both 179.90 because the sample has no tax schedule, freight or misc charges. If the customer has a tax schedule, pass TAXAMNT on the header (and tax nodes or the tax-calculation flags your version supports) and raise DOCAMNT accordingly, otherwise eConnect rejects the document with an amount mismatch error.
Gotchas that cause most eConnect errors
The Windows or SQL login running the call must be a member of the DYNGRP database role in DYNAMICS and in the company database, otherwise the procedures fail with permission errors. The eConnect runtime version must match the GP version; an 18.x eConnect against a GP 2016 database fails. Dates should be in a format SQL Server reads unambiguously, such as 2026-10-22. Duplicate SOP numbers are rejected, so either manage numbering yourself or call taGetSopNumber before building the XML. Errors come back in eConnectException.Message with the error number and the failing element.
Frequently Asked Questions
Does Dynamics GP have an API for creating invoices?
GP 2015 and later include a Service Based Architecture (REST) layer, but its coverage is limited and most SOP invoice integrations still use eConnect, which exposes XML schemas and .NET methods such as eConnectMethods.CreateTransactionEntity. Integration Manager is the user tool for file imports and can call eConnect underneath.
Why must the line nodes come before the header?
eConnect processes the nodes in document order. taSopLineIvcInsert writes the lines to the work tables first, then taSopHdrIvcInsert writes the header and checks that SUBTOTAL matches the lines already inserted. Putting the header first makes the totals check fail or creates a header with no lines.
How is eConnect different from Integration Manager?
Integration Manager is a desktop tool with mapping screens that a user runs against files or ODBC sources, and it can use eConnect underneath. eConnect is a developer library and set of stored procedures you call from your own code, a service or BizTalk. For unattended, real-time invoice creation from another system, eConnect is the usual choice.
Can eConnect post the batch as well?
No. eConnect creates unposted transactions in the SOP work tables. Posting is done by a user in GP (Sales Batch Entry or Series Post) or with a third-party posting tool. Plan for a person or scheduled process to post the batch named in BACHNUMB, and keep integration batches separate from manual ones.
If you want staff to ask GP about open invoices and orders in plain English on your own servers, with eConnect writes kept behind an approval step, we can set that up.
Related Tools
Dynamics GP SQL Table Reference (IV00101, SOP10100, POP10100)
Searchable reference of common Dynamics GP tables with module, purpose and work, open or history status.
Microsoft DynamicsDynamics GP Work, Open and History Table Map
A searchable list of Dynamics GP tables grouped by lifecycle: master, work, open and history, so you know where a transaction lives at each stage.
Microsoft DynamicsDynamics GP Word Template Setup and Troubleshooting Checklist
Work through enablement, company assignment, print destination, template editing and Template Processing Engine debugging for GP 2013 R2 through 18.x.
Microsoft DynamicsDynamics GP 18.x In-Place Upgrade Checklist (GP 2016/2018 to 18.8)
A five-stage checklist for moving an on-prem GP 2016 or 2018 system to the current 18.x build, from lifecycle planning to post-upgrade posting tests.
More Microsoft Dynamics tools
See all- Dynamics GP End of Support Migration Assessment
- Dynamics GP Chart of Accounts Mapping Worksheet
- GP to Business Central Cutover Runbook Template
- GP Third-Party Add-On Inventory Worksheet
- GP Cutover Open Balances Reconciliation Worksheet
- GP to Business Central Partner RFP Letter Template
- GP and AX User Role to Business Central Permission Mapping Worksheet
- GP Open Transactions SQL Query Generator
- Dynamics GP Unsupported Risk Exposure Calculator
Keep exploring
Free tools
- GP Open Transactions SQL Query GeneratorBuild read-only SQL for open SOP orders, open RM receivables and open PM payables in a GP company database for migration extracts.
- Dynamics GP End of Support Migration AssessmentTen-question readiness score for Dynamics GP customers who need a decision on what comes after GP.
- Dynamics GP Private AI Layer Blueprint GeneratorEnter your GP environment and get a plan for a private AI assistant: curated views, tool server, model serving, controls and rollout.
ERP fixes and how-tos
- Adding a Private AI Layer to Dynamics GP On-PremAdd AI to Dynamics GP on-prem without cloud: curated SQL views, eConnect for writes, retrieval index, local LLM, mirrored GP security, approved write-back.
- Dynamics GP POP Tables: Purchase Order Processing Reference and Sample SQLReference for Dynamics GP Purchase Order Processing tables: POP10100, POP10110, POP30100, POP30110, receipt tables, key joins and sample SQL queries.
Integrations
- How to add WhatsApp to Microsoft Dynamics GPHow to connect WhatsApp Business to Microsoft Dynamics GP: read SOP, POP and RM data from SQL Server, post replies through eConnect, with templates and opt-in handled.
- How to add AI agents to Microsoft Dynamics GPHow to add AI agents to Microsoft Dynamics GP: a read-only tool layer over SQL views, eConnect for approved writes, and human sign-off, on-prem if needed.