#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.
- 11files
- 4AL files
- 1objects
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
- Codeunit 1313 “Correct Posted Purch. Invoice”, Base Application: modified
src/Layers/ES/BaseApp/Purchases/History/CorrectPostedPurchInvoice.Codeunit.al: modified, not in the BC30 snapshot
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()”
Possibly related
No source states these links: they share an object, a model read them, or a person found the same subject.
- Amend or cancel unpaid purchase invoices — possibly related: Correct/Cancel on posted purchase invoice documents the correction process for purchase invoices. (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).