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

AP History Extract

(0) ShareShare
ReportReport
Posted on by

I have been asked to generate a file with the following information from AX 2009:

  1. Vendor Number
  2. Vendor Invoice Number
  3. Vendor Invoice Date
  4. Purchase Order ID
  5. Purchase Order Line
  6. AP Document Number (ie. Check number...)
  7. AP Document Date (ie. Date check was issued)
  8. Payment Amount

Has anyone else done something like this or come across a report that gives this information?

is It best to do something like this?

LedgerJournalTrans

inner join

VendTrans

on LedgerJournalTrans.dataAreaId = VendTrans.dataAreaId and

LedgerJournalTrans.VendTransId = VendTrans.RecId

inner join

VendTrans as VendTransOffset

on

VendTransOffset.OffsetRecId = VendTrans.RecId

inner join

VendInvoiceJour

on VendTransOffset.DATAAREAID = VendInvoiceJour.dataAreaId and

VendTransOffset.Voucher = VendInvoiceJour.LedgerVoucher

inner join

VendInvoiceTrans

on VendInvoiceJour.dataAreaId = VendInvoiceTrans.dataAreaId and

VendInvoiceJour.InvoiceId = VendInvoiceTrans.InvoiceId and

VendInvoiceJour.PurchId = VendInvoiceTrans.PurchId and

VendInvoiceJour.InvoiceDate = VendInvoiceTrans.InvoiceDate and

VendInvoiceJour.numberSequenceGroup = VendInvoiceTrans.numberSequenceGroup and

VendInvoiceJour.internalInvoiceId = VendInvoiceTrans.internalInvoiceId

where LedgerJournalTrans.TransactionType = 15 and

LedgerJournalTrans.AccountType = 2 and

VendInvoiceJour.PurchId <> ''

*This post is locked for comments

I have the same question (0)
  • dolee Profile Picture
    11,279 on at
    RE: AP History Extract

    Hi

    I don't have an AX2009 environment available to verify, can you check whether you can get #1 - #7 by just joining VendInvoiceJour and VendInvoiceTrans?

    As for "payment", if that means settled payments against the invoice then you need to look at VendSettlement table.

  • Verified answer
    Community Member Profile Picture
    on at
    RE: AP History Extract

    Yes, settled payments.  

    I was able to get everything except at the PO Line level.

    Here is the code that I came up with:

            while select vendInvoiceJour
                  where vendInvoiceJour.PurchId == purchTable.PurchId
            {
                tmpvendTrans = VendTrans::findVoucherDate(vendInvoiceJour.LedgerVoucher, vendInvoiceJour.InvoiceDate);

                while select crosscompany vendSettlement
                      order by TransDate
                      where vendSettlement.TransCompany == tmpvendTrans.dataAreaId &&
                            vendSettlement.TransRecId == tmpvendTrans.RecId &&
                            vendSettlement.AccountNum == tmpvendTrans.AccountNum
                {
                    select firstonly crossCompany orgVendTrans
                    where orgVendTrans.RecId == vendSettlement.OffsetRecid &&
                          orgVendTrans.AccountNum == vendSettlement.OffsetAccountNum &&
                          orgVendTrans.dataAreaId == vendSettlement.OffsetCompany;

                    select firstonly crossCompany ledgerJournalTable
                    where ledgerJournalTable.Posted == NoYes::Yes &&
                          ledgerJournalTable.JournalType == LedgerJournalType::Payment
                    join ledgerJournalTrans
                    where ledgerJournalTrans.JournalNum == ledgerJournalTable.JournalNum &&
                          ledgerJournalTrans.AccountType == LedgerJournalACType::Vend &&
                          ledgerJournalTrans.Cancel == NoYes::No &&
                          ledgerJournalTrans.Voucher == orgVendTrans.Voucher &&
                          ledgerJournalTrans.AccountNum == orgVendTrans.AccountNum &&
                          ledgerJournalTrans.dataAreaId == orgVendTrans.dataAreaId;


                }
            }

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

#2
NNaumenko Profile Picture

NNaumenko 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans