The posting process

The posting process is the most important process of the system. Actually, there are a few different posting processes, but they all follow the same structure. The posting process is complicated. If you try to debug a posting process, you will see that a lot of code from a lot of functions is executed to achieve the purpose of the posting process. In fact, many functions are executed many times. This section does not cover the posting process in depth; refer to Chapter 3, Dynamics NAV General Considerations for detailed information. Instead, this section shows the existing post codeunits and how they are structured.

There are several posting routines, one for each journal table and one for each group of documents. All posting routines use more than one codeunit. In Dynamics NAV, you can find more than 80 codeunits with the word post on their description. That's quiet a few!

Let's see a couple of examples of the posting's codeunits structure. The first example is posting codeunits for sales documents. In the second example, we will see posting's codeunits for general journal lines.

The codeunit structure for sales posting

The sales posting routine consists of 4 codeunits. The following diagram shows the schema that shows how each codeunit relates to one another:

The codeunit structure for sales posting

A user can start the posting process by selecting the Post or the Post & Print action, which will run Codeunit 81 Sales-Post (Yes/No) and Codeunit 82 Sales-Post + Print respectively. Both codeunits perform the same action; the only difference is that the Codeunit 82 Sales-Post + Print prints the posted sales document at the end. Both codeunits ask a confirmation from the user and check whether the post with the job queue is activated. If the post with job queue is activated, they call the Codeunit 88 Sales Post via Job Queue, which creates new records on a queue table to post the document later in a batch job. When the record in the queue is processed, Codeunit 80 Sales-Post is called in order to end the posting routine. If the post with the job queue is not activated, Codeunit 80 Sales-Post is called from Codeunit 81 or Codeunit 82.

Codeunit 80 Sales-Post is the most important one. It checks data, inserts records into the historical document tables, and creates all the required journal lines. It also calls the posting routines for the journal lines. You will find similar structures in other document-posting routines.

The codeunit structure for general journal posting

The general journal routine consists of 7 codeunits. The following screenshot shows us the schema of how each codeunit relates to each other:

The codeunit structure for general journal posting

The general journal posting routine can start from several places. Either from a general journal page or a general journal batch page, or the user can start the routine by selecting the Post or the Post & Print action. This will run one of the following codeunits: Codeunit 231 Gen. Jnl.-Post, codeunit 232 Gen. Jnl.-Post + Print, codeunit 233 Gen. Jnl.-B.Post, or codeunit 234 Gen. Jnl.-B.Post + Print.

All these codeunits ask for confirmation from the user, and codeunits 232 and 234 also print the posted entries at the end. After that, they all call codeunit 13 Gen. Jnl.-Post Batch. This codeunit checks the consistency of all the lines individually, by calling Codeunit 11 Gen. Jnl.-Check Line. Codeunit 13 also checks that all lines in the transactions are balanced, and if so it inserts some secondary data into the records.

Finally, codeunit 13 calls codeunit 12 Gen. Jnl.-Post Line for each line. Codeunit 12 is the one in charge of creating the corresponding ledger entries. If some other posting routines need to post General Journal Lines, they do so by calling codeunit 12 directly.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset