Ever run into an issue where you get duplicate number sequence errors in AX 2012 but you know you are using a different number sequence reference for the transaction? Below is a simple walkthrough explaining why you get theses types of errors.
Let's use the AP Invoice voucher and AP Payment voucher as examples. Below are 2 new number sequences that are setup under Accounts Payable > Setup > Accounts Payable Parameters > Number Sequences.
Notice that the format of the 2 number sequences is the same and the starting number for these 2 number sequences are both CEU-000001.
Let's move forward and enter a new Invoice Journal which is populated with number CEU-000001. Posting this Invoice Journal is fine.
Now move forward with creating a new Payment Journal. As you can see below this is also populated with CEU-000001. At this point we assume that this is not an issue as the number sequences are not named the same and are created for different reference.
However this will also attempt to write a record into the SUBLEDGERVOUCHERGENERALJOURNALENTRY table upon posting. A check is done to see if the voucher exists, and in this case it does, so we get the error below. Even though the voucher number is associated to a different reference via a different number sequence code you cannot post as it already exists as we only validate the voucher number and not the voucher number/reference combination.
In closing it is always best to use a unique format for transactional related number sequences. In this case it may have been best to use a format of CEU-APIJ000001 as seen below for the Invoice Journal number sequence, and CEU-APPJ000001 for the Payment Journal.
I hope this is helpful information to resolve some of the Number Sequence issues that you are encountering.
Dave B.Sr. Support EngineerDynamics AX