code change · featureAL Developmentofficial - Microsoftreviewed - checked by Opus

#223 knowledge(data-modeling): code that calculates a unit price rounds it to the currency's Unit-Amount Rounding Precision

A knowledge article explains when and how to round unit prices to the currency's Unit-Amount Rounding Precision, covering the gap between what Business Central's standard calculation ensures and what custom code must handle to avoid mismatches in line amounts.

Pull request · merged into main on 2026-10-19 by MichaelDieringer · 5 files (+131 -1), 4 AL · feature · tier official · reviewed (checked by Opus)

What changed

  • Unit prices computed by custom code must be explicitly rounded to currency’s Unit-Amount Rounding Precision, unlike the standard calculation
  • Subscribers that handle OnUpdateUnitPriceOnBeforeFindPrice or OnUpdateDirectUnitCostOnBeforeFindPrice skip built-in rounding and must implement it themselves
  • Round once at the end after all factors, and prefer post-calculation adjustment over replacing the standard result entirely
  • Specific exclusions apply to values copied unchanged from rounded fields or taken from external documents without modification
  • Mismatch between stored decimal places and displayed rounded value causes line amount discrepancies visible to external systems like e-invoicing and EDI

AL objects touched

Context

  • Systems: development, finance, sales

Source: metadata of a merged pull request in microsoft/BCQuality (bcquality): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).