#13627 [E-Documents] Fix division by zero importing zero-amount purchase order lines
E-Document import now correctly handles zero-amount purchase order lines by preventing division-by-zero errors when calculating discount percentages.
- 2files
- 1AL files
- 1objects
Pull request · merged into main (BC30) on 2026-11-13 by gggdttt · 2 files (+79 -1), 1 AL · fix · tier official · reviewed (checked by Opus)
What changed
- Guard denominator in discount percentage calculation to prevent division by zero on zero-amount lines
- Set imported discount percentage to zero when denominator is zero while preserving existing calculation for nonzero cases
- Added six regression tests covering nine input combinations including zero/nonzero amounts and discounts
- No schema, API, permission, or upgrade changes required
- Preserves behavior for all nonzero-denominator scenarios including negative amounts
- Behaviour changes for users or extensions.
AL objects touched
- Table 6165 “E-Doc. Imported Line”, EDocument: modified
Context
- Work items: AB#654114
- Labels: AL: Apps (W1), Team: Integrations
- Systems: integration
- From the description: “Guard the denominator and explicitly set the imported discount percentage to zero when it is zero.”
Possibly related
No source states these links: they share an object, a model read them, or a person found the same subject.
- Check amounts on purchase invoices and credit memos — possibly related: Documents amount validation on purchase invoice lines where division by zero error occurs. (model-linked)
Source: metadata of a merged pull request in microsoft/BCApps (bcapps): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).