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 AX (Archived)

Query to retrieve PO transactions on a General Ledger Account

(0) ShareShare
ReportReport
Posted on by 2,365

Hi,

What tables are needed to gather all transactions associated with a General Ledger main accounts. A user basically wants to see the associated Item number and PO with each transaction and the total value of it.

Is there way to join an account of XXXX and grab all POs with it? 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    André Arnaud de Calavon Profile Picture
    300,911 Super User 2025 Season 2 on at

    Hi YiMeister,

    Within e.g. the form Voucher transactions you can open the forms Transaction origin and Original voucher. Is this the information you are looking for?

  • YiMeister Profile Picture
    2,365 on at

    Yes! This is exactly what the user is looking for to query on. I need a query that can retrieve this information. We want mainly the Purchase Orders that show up under the Original Document tab and there I can retrieve the Purchase Lines and the Item numbers associated.

    Would you have any help with this query?  there is X++ code that processes and fills a tmp table to populate these forms.

  • Verified answer
    André Arnaud de Calavon Profile Picture
    300,911 Super User 2025 Season 2 on at

    Hi,

    There are several ways to combine this information. Probably most easy would be a query on the tables InventTransPosting + InventTransOrigin. You can filter on the fields Voucher and Trans date in the InventTransPosting. There is a relation between InventTransPosting and InventTransOrigin. The last mentioned table contains a field called ReferenceId which contains the Purchase order number. This table contains also a field ItemId.

    Note that one voucher/transdate combination can contain multiple order numbers and items.

  • YiMeister Profile Picture
    2,365 on at

    Hi,

    This is perfect. One more thing I need to join is the GeneralJournalEntry and GeneralJournalAccountEntry to these tables (InventTransPosting and InventTransOrigin), do you know the relationship between these tables, I cannot seem to see it. Because when I use a  'where' clause joining LedgerDimension of InventTransPosting looking for a particular main account it isnt bring the correct results. So where I should be comparing the MainAccount should be on the GeneralJournal tables.

  • Verified answer
    YiMeister Profile Picture
    2,365 on at

    I found the relationship. I simply used the LedgerDimension from GJAE and used the GJE vouchers to join with the ITP voucher field.

    Thank you for your help. Much appreciated.

  • Community Member Profile Picture
    on at

    Hi,

    I know this is an old thread, hopefully you're still active :-)

    I'm trying to replicate this query by piecing together the above comments and i think i'm close. Are you able to give me a hand to complete this join? It doesn't appear to be behaving as expected

    FROM [AxDB].[dbo].[GENERALJOURNALENTRY] gje

    LEFT OUTER JOIN [AxDB].[dbo].[GENERALJOURNALACCOUNTENTRY] gja ON gje.RECID = gja.GENERALJOURNALENTRY

    LEFT OUTER JOIN [AxDB].[dbo].[INVENTTRANSPOSTING] itp ON gja.LEDGERDIMENSION = itp.LEDGERDIMENSION AND gje.SUBLEDGERVOUCHER = itp.VOUCHER

    LEFT OUTER JOIN [AxDB].[dbo].[INVENTTRANSORIGIN] ito ON itp.INVENTTRANSORIGIN = ito.RECID AND itp.[DATAAREAID] = ito.[DATAAREAID] AND itp.[PARTITION] = ito.[PARTITION]

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 AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans