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)

SQL Query to return all AP Vouchers

(0) ShareShare
ReportReport
Posted on by

I am looking for a SQL Query to return all AP Vouchers.

I can run AP Voucher Report but need a Query since I need to Join it with Project Tracking tables.

*This post is locked for comments

I have the same question (0)
  • Richard Wheeler Profile Picture
    75,850 Moderator on at

    Do you want all vouchers? Work(PM10000), Open(PM20000) and Historical(PM30200)?

  • Community Member Profile Picture
    on at

    All posted transactions

  • Richard Wheeler Profile Picture
    75,850 Moderator on at

    All posted transactions will be in either the PM20000(open) or PM30200(historical) tables. What do you mean by project tracking tables? PA Billing? Purchase orders?

    You can use the pm20000..vchrnmbr and pm20000.docnumbr and the pm30200..vchrnmbr and pm30200.docnumbr and link back to the PA tables.

  • Community Member Profile Picture
    on at

    Thanks but I was looking for an actual query, not just the table name.

  • Suggested answer
    Community Member Profile Picture
    on at

    You can checkout the below Link from Victoria. There are many other helpful views also you might be able to get.

    https://victoriayudin.com/2009/10/12/sql-view-for-all-posted-payables-transactions-in-dynamics-gp/

  • Verified answer
    Richard Wheeler Profile Picture
    75,850 Moderator on at

    Here is a small section of code from the center of one of my scripts. I have an external table full of transactions(jl) that is full of voucher and document numbers. This links them to payables documents. The loop goes through all current jobs. You probably need something different. There are many different project document types and their data goes into different tables. You are going to need to research which tables have the data you need and then build your query from there. Go to Tools->Resource Descriptions->Tables and choose the Project Series to get started. You can then go into SSMS and look in the tables to confirm which tables to use. There is no simple query for this. I spent months writing and refining mine based on what I needed.

    SELECT distinct rtrim(PACONTNUMBER) as pacontnumber

    FROM [PA01101]

    ) as P

    on jl.jobnumber = p.PACONTNUMBER

    LEFT OUTER JOIN [pm10000] as pw

    ON jl.transnmbr = pw.vchnumwk and jl.docnumbr = pw.docnumbr

    LEFT OUTER JOIN [pm20000] as po

    ON jl.transnmbr = po.vchrnmbr and jl.docnumbr = po.docnumbr

    LEFT OUTER JOIN [pm30200] as ph

    ON jl.transnmbr = ph.vchrnmbr and jl.docnumbr = ph.docnumbr

  • Community Member Profile Picture
    on at

    Thank you!

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
mtabor Profile Picture

mtabor 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans