I’m starting with Ax 2012, and there are a lot of changes in
the code. Almost all the tables of General Ledger are new in Dynamics AX 2012. It was difficult to understand how the ledger
posts are now inserted and their relations. Below some important relations of GL
that might help.
How a Ledger post (GeneralJournalEntry)
is related with a General Journal Ledger.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static LedgerJournalTable findByGeneralJournalEntry( GeneralJournalEntry journalEntry ) | |
{ | |
LedgerJournalTable journalTable; | |
LedgerEntryJournal journalLink; | |
; | |
select firstOnly * from journalLink where journalLink.RecId == journalEntry.LedgerEntryJournal | |
join journalTable where journalTable.JournalNum == journalLink.JournalNumber;// && | |
//journalTable.dataAreaId == journalLink.LedgerJournalTableDataAreaId; | |
return journalTable; | |
} |
How a General Journal Line is related with a Ledger post (GeneralJournalEntry)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LedgerJournalTable jourTable, origJornalTable; | |
LedgerJournalTrans jourTrans, origJournalTrans; | |
SubledgerVoucherGeneralJournalEntry jourLink; | |
; | |
origJornalTable = LedgerJournalTable::findByGeneralJournalEntry(journalEntry); | |
if(origJornalTable){ | |
select * from origJournalTrans where origJournalTrans.JournalNum == origJornalTable.JournalNum | |
join jourLink where jourLink.GeneralJournalEntry == journalEntry.RecId && origJournalTrans.Voucher == jourLink.Voucher; |