Hello everyone,
I’m facing an issue with Sales Order prepayments and credit memos in Microsoft Dynamics 365 Business Central and would appreciate any guidance.
Here is the scenario:
- I created a Sales Order with 4 sales lines, with 100 quantity on each line.
- Initially, I set Prepayment % = 100% on Line 1 and Line 3 and posted the corresponding Prepayment Invoices.
- Later, I also set Prepayment % = 100% on Line 2 and Line 4 and posted the Prepayment Invoice for those lines.
- I then started invoicing Line 1 partially, in three separate Sales Invoices:
- 25 Qty
- 25 Qty
- 50 Qty
- Later, I needed to cancel these posted Sales Invoices, so I created and posted Sales Credit Memos against all three invoices.
- After posting the credit memos, when I try to create/post the Sales Invoice again for Line 1, I receive a "Divide by Zero" error.
After investigating, I noticed that the Prepayment Amount Deducted on the sales line is not being updated/recalculated after posting the Sales Credit Memo.
Interestingly, this issue occurs only for Line 1 and Line 3, where the prepayment was posted initially.
When I performed the same process with Line 2 and Line 4—i.e., invoicing partially, posting the Sales Credit Memo, and then invoicing again—the Prepayment Amount Deducted is updated correctly, and I do not get the Divide by Zero error.
My Questions
- Has anyone encountered this issue with Sales Order Prepayments and Sales Credit Memos in Business Central?
- Is there a specific standard process or setup that needs to be followed when cancelling invoices that have prepayments applied?
- Why would Prepayment Amount Deducted be updated correctly for Lines 2 and 4 but not for Lines 1 and 3?
- Could this be a standard Business Central bug, or is there a specific field/table/event that needs to be handled when posting the Sales Credit Memo?
- Has anyone faced the Divide by Zero error in a similar prepayment scenario, and if so, how did you resolve it?
Any suggestions regarding the relevant standard codeunits, tables, or posting routines that I should investigate would also be very helpful.
Thanks in advance!
Suketu Piprotar

Report
All responses (
Answers (