Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

GeneralJournalAccountEntry to Purchtable

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

 

Please can anyone tell me how I can link the General Ledger Actual table (GENERALJOURNALACCOUNTENTRY) to either the Purchase Order (PURCHTABLE), Purchase Order Line (PURCHLINE) or another table so I can get the Purchase Order Number.  I need to be able to get the purchase order number for GL records that have not been invoiced.
Many thanks

*This post is locked for comments

  • Suggested answer
    Chaitanya Golla Profile Picture
    Chaitanya Golla 17,225 on at
    RE: GeneralJournalAccountEntry to Purchtable

    Hi,

    You can either refer the post suggested by Vilmos (or) can use the following job to get the link.
    This job helps to find the link for the invoice and product receipt transactions.

    static void PurchTransactions(Args _args)
    {
    GeneralJournalAccountEntry journalAccountEntry;
    GeneralJournalEntry generalJournalEntry;
    PurchTable purchTable;
    PurchLine purchLine;
    VendTrans vendTrans;
    VendInvoiceJour vendInvoiceJour;
    VendPackingSlipJour vendPackingSlipJour;
    VendPackingSlipVersion vendPackingSlipVersion;
    SubledgerVoucherGeneralJournalEntry subledgerVoucherGeneralJournalEntry;

    // Purchase order invoice transactions
    while select journalAccountEntry
    join generalJournalEntry
    where journalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId
    join subledgerVoucherGeneralJournalEntry
    where subledgerVoucherGeneralJournalEntry.GeneralJournalEntry == generalJournalEntry.RecId
    join vendTrans
    where vendTrans.Voucher == subledgerVoucherGeneralJournalEntry.Voucher
    && vendTrans.transDate == subledgerVoucherGeneralJournalEntry.AccountingDate
    && vendTrans.Voucher == "xyz"
    join vendInvoiceJour
    where vendInvoiceJour.LedgerVoucher == vendTrans.Voucher
    && vendInvoiceJour.InvoiceAccount == vendTrans.AccountNum
    && vendInvoiceJour.InvoiceDate == vendTrans.TransDate
    join purchTable
    where purchTable.PurchId == vendInvoiceJour.PurchId
    // join purchLine
    // where purchLine.PurchId == purchTable.PurchId
    {
    info(strFmt("PurchId: %1", purchTable.PurchId));
    }

    // Purchase order product receipt transactions
    while select journalAccountEntry
    join generalJournalEntry
    where journalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId
    join subledgerVoucherGeneralJournalEntry
    where subledgerVoucherGeneralJournalEntry.GeneralJournalEntry == generalJournalEntry.RecId
    join vendPackingSlipVersion
    where (vendPackingSlipVersion.LedgerVoucher == subledgerVoucherGeneralJournalEntry.Voucher
    || vendPackingSlipVersion.CostLedgerVoucher == subledgerVoucherGeneralJournalEntry.Voucher)
    && vendPackingSlipVersion.AccountingDate == subledgerVoucherGeneralJournalEntry.AccountingDate
    //&& subledgerVoucherGeneralJournalEntry.Voucher == "xyz"
    join vendPackingSlipJour
    where vendPackingSlipJour.RecId == vendPackingSlipVersion.VendPackingSlipJour
    join purchTable
    where purchTable.PurchId == vendPackingSlipJour.PurchId
    // join purchLine
    // where purchLine.PurchId == purchTable.PurchId
    {
    info(strFmt("PurchId: %1", purchTable.PurchId));
    }
    }

    If you feel your question is resolved, please mark the answer as verified so that it helps others.

    Thanks,
    Chaitanya Golla

  • Suggested answer
    Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: GeneralJournalAccountEntry to Purchtable

    Have a look at the following post on matching ledger postings with purchases:

    community.dynamics.com/.../148688

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,820 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,514 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans