🗂 Understanding Dynamics GP Table Structures

 

  • Company Data: Each company has its own database (e.g., TWO, Fabrikam, or your company code).

  • Common Table Prefixes:

    • GL → General Ledger

    • PM → Payables Management

    • RM → Receivables Management

    • SOP → Sales Order Processing

    • POP → Purchase Order Processing

  • Series Breakdown:

    • 10000 → Financial

    • 20000 → Sales

    • 30000 → Purchasing

    • 40000 → Inventory

Knowing the right prefix saves hours when searching for tables in SQL.


🛠️ Useful Queries You Can Use Today

Here are some read-only queries (safe for reporting, won’t update data). Replace TWO with your company database.


1. Find Unposted Batches

SELECT BACHNUMB, SERIES, BACHNAME, USERID, BCHSOURC FROM TWO..SY00500 WHERE BCHSTTUS <> 0 ORDER BY SERIES, BACHNUMB;

👉 Great for identifying stuck batches across modules.


2. Reconcile Payables Transactions to GL

SELECT PM.VCHRNMBR, PM.DOCDATE, PM.DOCAMNT, GL.DEBITAMT, GL.CRDTAMNT FROM TWO..PM20000 PM LEFT JOIN TWO..GL20000 GL ON PM.VCHRNMBR = GL.ORTRXNUM WHERE PM.DOCDATE BETWEEN '2025-01-01' AND '2025-03-31';

👉 Helps validate whether posted payables are hitting the correct GL accounts.


3. Outstanding SOP Orders

SELECT SOP.SOPNUMBE, SOP.SOPTYPE, SOP.CUSTNMBR, SOP.DOCDATE, SOP.SUBTOTAL FROM TWO..SOP10100 SOP WHERE SOP.SOPTYPE = 2 -- Orders AND SOP.VOIDSTTS = 0 ORDER BY SOP.DOCDATE DESC;

👉 Quickly shows all open Sales Orders and their amounts.


4. Vendor Balance Summary

SELECT VENDORID, SUM(CURTRXAM) AS OUTSTANDING_BALANCE FROM TWO..PM20000 GROUP BY VENDORID ORDER BY OUTSTANDING_BALANCE DESC;

👉 Simple, fast way to see who you owe money to.


5. Customers Over Credit Limit

SELECT CUST.CUSTNMBR, CUST.CUSTNAME, CUST.CRLMTAMT, SUM(RM.CURTRXAM) AS OUTSTANDING FROM TWO..RM00101 CUST JOIN TWO..RM20101 RM ON CUST.CUSTNMBR = RM.CUSTNMBR GROUP BY CUST.CUSTNMBR, CUST.CUSTNAME, CUST.CRLMTAMT HAVING SUM(RM.CURTRXAM) > CUST.CRLMTAMT;

👉 A real-world credit control report that GP doesn’t provide out-of-the-box.


⚠️ Best Practices

  • Always query with SELECT only — avoid UPDATE or DELETE in production.

  • Use a read-only SQL account for reporting connections.

  • Document your queries — future admins will thank you.

  • Test in a test company first if you’re writing more complex joins.


🎯 Final Thoughts

Dynamics GP’s SQL backend can feel intimidating, but once you learn the table naming patterns and safe shortcuts, you unlock a world of faster reconciliation, custom reporting, and smarter audits.

Instead of struggling with manual exports or missing SmartLists, you can build direct, reliable reports that make finance and operations teams look like heroes.

Comments

Popular posts from this blog

Creating Macro in Dynamics GP

Delete a Sales order processing document after being printed

Microsoft Dynamics GP 18.5 release and what's next?