When I talk to users about Dynamics 365 Business Central we often discuss the ledger entries, such as Customer and Vendor Ledger Entries, but never really touch on Detailed Ledger Entries.
They kind of go under the radar, however in reality they perform a crucial function, and underpin lots of information shown on the Ledger Entries screen.
In this post I aim to give them some well deserved limelight as I go through just how important a role they play in business central.
If we first take a look at the “Customer Ledger Entries” page we can see this is showing all the various documents we have posted against our customers.
In fact, this is the main page that’s used when you want to see a full history of all the documents we have posted to our customers. Using this page we can quickly see outstanding invoices, payments and much more.
It also displays things like Posting Date, Document Type, Document Number, Customer No and then a variety of Amount columns.
What’s interesting to note is that all the amount columns are hyperlinks, which we can click to view more information on that amount. However before we do this let’s take a deep dive into the “Customer Ledger Entries” table to gather more information on those columns.
Lets get technical
To figure out why those amount columns have hyperlink drilldowns let’s first check what table the “Customer Ledger Entry” page is based on. We can do this by clicking “CTRL + ALT + F1” to view the Page Inspection. In here we can see its based on the “Cust. Ledger Entry (21)” table
Now let’s open that table in “VS Code” and take a look at a couple of those amount columns. Specifically we’ll look at the “Amount” and “Remaining Amount” columns
Here we can see that the “Amount” and “Remaining Amount” columns aren’t physically stored in the “Cust. Ledger Entry” table. They are in fact calculated fields (flowfields) based on data in the “Detailed Ledger Entry” table.
So, when we see those amounts on the “Customer Ledger Entry” page we are in fact seeing totals based on data in the “Detailed Ledger Entry” table. This is why they are showing as hyperlinks. Very cool!
** What’s even more cool is that to maintain high performance they are implemented using SQL indexed views on the Detailed Ledger Entry table (I explain more on how this works in this article)
Armed with this information we can see why whenever we post a sales transaction we get “Detailed Ledger Entries”, as well as the more commonly known “Customer Ledger Entries”. The “Detailed Ledger Entries” are maintaining the “Amount” fields on the “Customer Ledger Entries” table and (therefore) page.
Therefore its now apparent just how much of a crucial role they are playing in maintaining the amounts and outstanding amounts on the “Customer Ledger Entry” page we use so often.
Its worth noting “Detailed Ledger Entries” are created for a whole manner of things that affect balances on transactions. The most obvious would be when we apply one transaction to another. For example if I apply the invoice to the cash receipt from my earlier screen shot I’ll get “Detailed Ledger Entries” to reflect this.
** The system will create two detailed ledger entries. One for the invoice and once for the payment and both will have a type of “Application”
If when I drill down on the “Remaining Amount” on the Invoice it takes me to the related “Detailed Ledger Entries” and if we sum the “Amount” column it comes back to 0.00 which is reflected on the “Customer Ledger Entry”
** Incidentally we can get a list of all the different types by looking at the “Entry Type” on the “Detailed Ledger Entries” table in VS code
In summary the “Detailed Ledger Entries” are there to keep track of changes to the amounts of the “Customer Ledger Entries”. This way the system doesn’t have to maintain summary running totals on the “Customer Ledger Entries”.
Thanks for reading!