Create ledger tables

Completed

A ledger table contains the transactional information that is the primary focus of its application area. For example, the Cust. Ledger Entry table is a ledger table; it contains all transaction information that is the primary focus of the sales and receivables application area.

A ledger table resembles a subsidiary table because it is related to the corresponding master table. However, it has different characteristics. It is related to many other tables, mostly supplemental tables. Register tables are related to ledger tables, but no other tables typically relate to a ledger table.

Most application areas have at least one ledger table, depending on functionality (many application areas contain two or more ledger tables). Some ledger tables, such as G/L Entry or Item Ledger Entry, are shared between several application areas.

To maintain an audit trail for transactional information, ledger tables can't be changed by users except for a few highly controlled exceptions. These exceptions exclude the ability to add or delete a record. Examples of such exceptions are the Cust. Ledger Entry and Vendor Ledger Entry tables, which allow users to change certain fields such as On Hold or Pmt. Disc. Tolerance Date.

Ledger table names

The name of the ledger table is usually the name of the master table to which it is related, plus the words ledger entry, which describes one of the records in it (an entry). Because the name can be lengthy, the name is sometimes abbreviated. For example, the customer ledger entry table is named Cust. Ledger Entry. When more than one master table exists, the name is the application area followed by the words ledger entry, for example G/L Entry.

Primary key and other standard fields

The primary key of a ledger table is an integer field named Entry No. This key is automatically generated by the posting routine that controls the ledger table and is incremented by one.

The ledger table always contains a field that has a table relationship with the master table that is associated with this ledger table. The description field of this table is a text field of length 100 and is named Description.

In addition to the primary key, ledger tables generally have many secondary keys that are used together with the FlowFields on the master table to calculate information for the user. Consequently, at least one of the secondary keys has a field that is related to the master table as the first field in the key.

Associated pages

A list page is used to view the records in the Ledger table. The name of the page is the plural of the name of the ledger table. Therefore, the page that is used to display records from the Cust. Ledger Entry table is named Customer Ledger Entries.

This page is set as the LookupPageID property and the DrillDownPageID property of the table because they are used for viewing and for lookups and drilldowns into this table.

The following example shows a snippet of the Cust. Ledger Entry table.

table 21 "Cust. Ledger Entry"
{
    Caption = 'Cust. Ledger Entry';
    DrillDownPageID = "Customer Ledger Entries";
    LookupPageID = "Customer Ledger Entries";

    fields
    {
        field(1; "Entry No."; Integer)
        {
        }
        field(3; "Customer No."; Code[20])
        {
            TableRelation = Customer;
        }
        field(4; "Posting Date"; Date)
        {
        }
        field(5; "Document Type"; Option)
        {
        }
        field(6; "Document No."; Code[20])
        {
        }
        field(7; Description; Text[100])
        {
        }
        field(8; "Customer Name"; Text[100])
        {
        }
        ...
    }
    keys
    {
        key(Key1; "Entry No.")
        {
            Clustered = true;
        }
    }
}