When/How Is the Document Number Assigned
Warning: 
This section is a technical explanation of how document numbers are assigned. It contains background information for those who wish to understand the rationale of the design.
An installation algorithm assigns a document number to a bill.
Similar to sequential bill numbers, document numbers are allocated as follows:
A document number is allocated when a bill is completed online (by clicking the Complete button on Bill - Main).
The Assign Bill Document Numbers background process (C1-BNBAS) should be scheduled to run immediately after batch billing. This single-threaded process assigns document numbers to completed bills.
The logic used to assign a document number resides in the installation options Document Number (C1–DOC-NBR) algorithm.
The following measures are in place as a fail-safe:
If the billing download process (POSTROUT) encounters a bill without a document number, it will abort with an appropriate error message.
Users are not allowed to delete a completed bill with a document number. Note, deletion of completed bills is typically prohibited due to the presence of frozen bill segments. However, it's possible to create a bill without frozen bill segments and additional logic exist to inhibit the deletion of such bills if they have sequential bill numbers.