D365 Business Central : Doc. No. Occurrence
D365 Business Central is a complex system with numerous tables and fields. In this blog post, we will explore the “Doc. No. Occurrence” field found on Purchase and Sales Headers. This field is also part of the primary key for the Purchase and Sales Header Archive, so it is good to understand its purpose.
What is the “Doc. No. Occurrence” Field?
The “Doc. No. Occurrence” field is an integer field, typically displaying the value ‘1.’
While it may not be adequately documented, its function is relatively straightforward – it tracks how often a specific “No.” value has been used within the system. This tracking, in conjunction with the document number, ensures the maintenance of a unique number, particularly for archived documents.
Let’s dive into it to understand how this feature works, using the Sales Order as our example (similarly applicable to purchases).
How Does it Work?
When a new document number is generated, the “Doc. No. Occurrence” field is always set to ‘1.’
If you delete the order and recreate a new sales order with the same “No,” the “Doc. No. Occurrence” field increases to ‘2.’
This functionality depends on the Archive feature. When inserting data into the Sales Header table, the system checks the Sales Header Archive for the last recorded “Doc. No. Occurrence” and increments it by one.
When not using the Archive function, the “Doc. No. Occurrence” remains at ‘1’ because there is no Sales Header Archive record.
If you archive the document now and examine the Sales Order Archive, you can see where multiple documents share the same number, each distinguished by its “Doc. No. Occurrence” field.
Pretty straightforward. Hopefully, you understand now why the “Doc. No. Occurrence” field is not set to one.
Nice information.