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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

GeneralJournalAccountEntry to Purchtable

(0) ShareShare
ReportReport
Posted on by

 

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
    Vilmos Kintera Profile Picture
    46,149 on at

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

    community.dynamics.com/.../148688

  • Suggested answer
    Chaitanya Golla Profile Picture
    17,225 on at

    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

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Prashant Singh Profile Picture

Prashant Singh 2

#1
nmaenpaa Profile Picture

nmaenpaa 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans