Dynamics 365 Business Central: Empty Posted Sales Invoice with only one comment “Document created to avoid gap in No. Series”? Why?

Dynamics 365 Business Central

Hi, Readers.
I was asked a very interesting question last week that I would like to share with you in this post. Why are there empty Posted Sales Invoices with only one comment “Document created to avoid gap in No. Series” in Business Central?
For example,

As you know, if the sales invoice does not contain any quantity or amount, there is no way to post it.

There is nothing to post because the document does not contain a quantity or amount.

So obviously, the empty invoice above is automatically generated by the system. But why?

Let’s look at this generated comment again, “Document created to avoid gap in No. Series”.

Yes, this is related to the Allow Gaps in Nos. setting of the No. Series.

Allow Gaps in Nos.
Specifies that a number assigned from the number series can later be deleted. This is practical for records, such as item cards and warehouse documents that, unlike financial transactions, can be deleted and cause gaps in the number sequence. This setting also means that new numbers will be generated and assigned in a faster, non-blocking way. NOTE: If an error occurs on a new record that will be assigned a number from such a number series when it is completed, the number in question will be lost, causing a gap in the sequence.

For each company that you set up, you need to assign unique identification codes to things such as general ledger accounts, customer and vendor accounts, invoices, and other documents. Numbering is important not only for identification. A well-designed numbering system also makes the company more manageable and easy to analyze, and can reduce the number of errors that occur in data entry. By default, gaps are not allowed in number series because the exact history of financial transactions must be available for auditing, by law, and therefore must follow an unbroken sequence with no deleted numbers. But not all records that you create in Business Central are financial transactions that must use sequential numbering. Customer cards, sales quotes, and warehouse activities are examples of records that are assigned a number from a number series, but are not subject to financial auditing and/or can be deleted. For such number series, you can select the Allow Gaps in Nos. check box on the No. Series Lines page. This setting can also be changed after creating the number series. More details: Create Number Series

What is the logic for generating the posted sales invoice number?
This is related to the “Posting No.” field in the Sales Header, which will be automatically generated based on the No. Series set in the Posting No. Series, and then this Posting No. will be used as the Posted Sales Invoice Number when posting.

We have discussed Manual number for Posted Sales invoice and Posted Purchase invoice (Use the same number in Sales Order and Posted Sales Invoice?) before, and we also use the “Posting No.” field.

There is an anomaly. When a posting error occurs, the Posting No. has been generated on the sales invoice, but you want to delete this invoice.

Let’s see an example.

First, I enabled Ext. Doc. No. Mandatory on the Sales & Receivables Setup page.

Before posting, Posting No. is blank.

Then I keep the External Document No. blank and post the invoice.

External Document No. must have a value in Gen. Journal Line: Journal Template Name=, Journal Batch Name=, Line No.=0. It cannot be zero or empty.

Go back to the sales invoice, and you will find that the Posting No. has been assigned, 103216. (This does not rollback)

In No. Series:

According to the normal process, you should correct this invoice and re-post it. However, if you choose to delete this invoice, it will cause problems with the title.

Let me test it.

Choose Delete icon.

Choose Yes.

You will see the following message, choose Yes.

Deleting this document will cause a gap in the number series for posted invoices. An empty posted invoice 103216 will be created to fill this gap in the number series.

Do you want to continue?

One or more related posted documents have been generated during deletion to fill gaps in the posting number series. You can view or print the documents from the respective document archive.

Posted Sales Invoice: 103216

Test Video:

This is the reason why empty invoices happen, so I personally recommend that when an error occurs when posting an invoice, do not delete it, try to modify it and re-post it.

1. If you enable Shipment on Invoice on the Sales & Receivables Setup, the system will also automatically create an empty Posted Sales Shipment.

Deleting this document will cause a gap in the number series for shipments. An empty shipment 102218 will be created to fill this gap in the number series.

Do you want to continue?

2. If you look at the standard code you can see that the automatically generated comment is taken from the Description of the Source Code set in Source Code Setup.

3. This situation is not unique to BC, it has existed since the old days of NAV.
Deleting a sales invoice – Microsoft Dynamics NAV Forum Community Forum


Hope this will help.

Thanks for reading.



Copied title and URL