code change · fixPurchasing & Payablesofficial - Microsoftreviewed - checked by Opus

#14687 [Main] [All-e]Correct/Cancel on Posted Purchase Invoice fails with "External Document No. must have a value" when Ext. Doc. No. Mandatory and Calc. Inv. Discount are enabled and Credit Memo Nos. and Posted Credit Memo Nos. has the same code

Correct and Cancel on a posted purchase invoice no longer fail with External Document No. must have a value when Ext. Doc. No. Mandatory and Calc. Inv. Discount are on and credit memo series match. The corrective credit memo header is now saved right after its vendor reference is set.

Pull request · merged into main (BC30) on 2026-12-03 by sanjmaurya · 11 files (+712 -1), 4 AL · fix · tier official · reviewed (checked by Opus)

What changed

  • Corrective credit memo header is now saved immediately after vendor reference assignment
  • Prevents loss of vendor reference during invoice discount calculation
  • Fixes both Correct and Cancel operations on posted purchase invoices
  • Regression tests added for matching and different number series scenarios
  • Behaviour changes for users or extensions.

AL objects touched

Context

  • Work items: AB#659717
  • Labels: Team: SCM
  • Systems: purchasing
  • From the description: “Save the corrective credit memo header immediately after assigning its vendor reference using PurchaseHeader.Modify()”

No source states these links: they share an object, a model read them, or a person found the same subject.

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).