web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Connect VendInvoiceJour to GeneralJournalAccountEntry

(3) ShareShare
ReportReport
Posted on by 8
I am having a hard time understanding how to build out a GL Report that would retrieve all the data from generaljournalaccountentry. This is my current query but I want to join vendinvoicejour and vendinvoicetrans to get the vendor side of it. But there is not a direct connection between the tables. 
 
SELECT DISTINCT G.SUBLEDGERVOUCHER, GA.GENERALJOURNALENTRY,GA.LEDGERACCOUNT, GA.TRANSACTIONCURRENCYAMOUNT, GA.ISCREDIT, G.ACCOUNTINGDATE, 
MA.MAINACCOUNTID,
CASE 
    WHEN GA.ISCREDIT = 1 THEN GA.TRANSACTIONCURRENCYAMOUNT
    ELSE 0.00
END AS CREDITAMOUNT,
CASE 
    WHEN GA.ISCREDIT = 0 THEN GA.TRANSACTIONCURRENCYAMOUNT
    ELSE 0.00
END AS DEBITAMOUNT
FROM GENERALJOURNALACCOUNTENTRY GA
JOIN GENERALJOURNALENTRY G ON G.RECID = GA.GENERALJOURNALENTRY
JOIN MAINACCOUNT MA ON MA.MAINACCOUNTID = SUBSTRING(GA.LEDGERACCOUNT,0,CHARINDEX('-',GA.LEDGERACCOUNT,0))
Categories:
I have the same question (0)
  • Suggested answer
    Sohaib Cheema Profile Picture
    47,259 User Group Leader on at
    Connect VendInvoiceJour to GeneralJournalAccountEntry
     
    All the 6 columns you want, for that do not need to go GL tables, to get on report. Here is the SQL query that I have quickly created for you and that shows how you can get the 6 columns that you want. 
    Note: I have used where clause during sample testing, you can modify it as per need and further improve it for performance or other reasons.
     
    Select

    VendInvoiceJour.PurchId as [PO Number]
    ,VendInvoiceJour.LedgerVoucher as [Voucher]
    ,VendInvoiceJour.InvoiceDate as [Invoice Date]
    ,VendInvoiceTrans.ItemId
    ,VendTable.AccountNum as [Vendor Account]
    ,DirPartyTable.Name as [Vendor Name]

    from VendInvoiceTrans

    join VendInvoiceJour
    on VendInvoiceJour.PurchId = VendInvoiceTrans.PurchId
    AND VendInvoiceJour.InvoiceId = VendInvoiceTrans.InvoiceId
    AND VendInvoiceJour.InvoiceDate = VendInvoiceTrans.InvoiceDate
    AND VendInvoiceJour.numberSequenceGroup = VendInvoiceTrans.numberSequenceGroup
    AND VendInvoiceJour.InternalInvoiceId = VendInvoiceTrans.InternalInvoiceId
    AND VendInvoiceJour.DataAreaId = VendInvoiceTrans.DataAreaId

    join VendTable
    on VendTable.AccountNum = VendInvoiceJour.OrderAccount
    AND VendTable.DataAreaId = VendInvoiceJour.DataAreaId

    Join DirPartyTable 
    on VendTable.Party = DirPartyTable.RecId

    Where VendInvoiceJour.PurchId = '000005' and VendInvoiceJour.DataAreaId = 'USMF'
     
     
    Apart from that if you need to join the invoice with the GL tables, that question has been answered many time. You can see that on a old thread and on many blogposts. Link to old thread
  • KL-25041631-0 Profile Picture
    8 on at
    Connect VendInvoiceJour to GeneralJournalAccountEntry
    @ the columns that I would essentially need would be the PO#, Voucher Number, Accounting Date, Product Number/Item Number, Vendor Account Number, and Vendor Name. 
  • Sohaib Cheema Profile Picture
    47,259 User Group Leader on at
    Connect VendInvoiceJour to GeneralJournalAccountEntry
    You need to go from Vendor invoice >> SubLedger >> Journal 
    If you could show us the layout/columns of your report, we can try to help
  • Martin Dráb Profile Picture
    235,609 Most Valuable Professional on at
    Connect VendInvoiceJour to GeneralJournalAccountEntry
    Moved from Integration, Dataverse, and general topics forum to Finance | Project Operations, Human Resources, AX, GP, SL forum, because the table and fiels names match tbhose existing in F&O.
     

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Alireza Eshaghzadeh Profile Picture

Alireza Eshaghzadeh 799 Super User 2025 Season 2

#2
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 757 Super User 2025 Season 2

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 751 Super User 2025 Season 2

Product updates

Dynamics 365 release plans