---
title: "Codeunit 1313 Correct Posted Purch. Invoice"
author: "Jonas Paprotka"
url: https://jonas-paprotka.de/ref/codeunit/1313-correct-posted-purch-invoice/
type: codeunit
id: 1313
name: "Correct Posted Purch. Invoice"
app: "Base Application"
namespace: Microsoft.Purchases.History
versions: "17-28"
build: 28.5.54151.54365
source: "https://jonas-paprotka.de/ref/codeunit/1313-correct-posted-purch-invoice/source/29/"
checked: 2026-09-20
subject: "Microsoft Dynamics 365 Business Central"
license: "Content © 2026 Jonas Paprotka. Quote freely with attribution and a link."
---

# Codeunit 1313 Correct Posted Purch. Invoice

Jonas Paprotka, https://jonas-paprotka.de/ref/codeunit/1313-correct-posted-purch-invoice/

| | |
| --- | --- |
| App | Base Application |
| Namespace | Microsoft.Purchases.History |
| Versions | 17-28 |
| Source file | Purchases/History/CorrectPostedPurchInvoice.Codeunit.al |

## Procedures

| Name | Parameters | Returns | Access | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- | --- |
| CancelPostedInvoice | (var Record Purch. Inv. Header) | Boolean | public | 17-28 | - | - |
| CreateCreditMemoCopyDocument | (var Record Purch. Inv. Header, var Record Purchase Header) | Boolean | public | 17-28 | - | - |
| CreateCorrectiveCreditMemo | (var Notification) | - | public | 17-28 | - | - |
| ShowAppliedEntries | (var Notification) | - | public | 17-28 | - | - |
| SkipCorrectiveCreditMemo | (var Notification) | - | public | 17-28 | - | - |
| CancelPostedInvoiceStartNewInvoice | (var Record Purch. Inv. Header, var Record Purchase Header) | - | public | 17-28 | - | - |
| TestCorrectInvoiceIsAllowed | (var Record Purch. Inv. Header, Boolean) | - | public | 17-28 | - | - |
| FindItemLedgEntries | (var Record Item Ledger Entry, Code[20]) | - | public | 17-28 | - | - |
| ErrorHelperHeader | (Enum Correct Purch. Inv. Error Type, Record Purch. Inv. Header) | - | public | 21-28 | - | - |
| UpdatePurchaseOrderLineIfExist | (Code[20]) | - | internal | 26-28 | - | - |

## Events

| Kind | Name | Parameters | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- |
| Integration event | OnAfterCreateCorrectivePurchCrMemo | (Record Purch. Inv. Header, var Record Purchase Header, var Boolean) | 17-23 | - | - |
| Integration event | OnAfterTestCorrectInvoiceIsAllowed | (var Record Purch. Inv. Header, Boolean) | 17-28 | - | - |
| Integration event | OnBeforePurchaseHeaderInsert | (var Record Purchase Header, Record Purch. Inv. Header) | 17-28 | - | - |
| Integration event | OnBeforeUnAppyCostApplication | (Code[20], var Boolean) | 17-28 | - | - |
| Integration event | OnBeforeUpdatePurchaseOrderLineInvoicedQuantity | (var Record Purchase Line, Decimal, Decimal, var Boolean) | 17-28 | - | - |
| Integration event | OnBeforeTestInventoryPostingSetup | (Record Purch. Inv. Line, var Boolean) | 17-28 | - | - |
| Integration event | OnHasLineDiscountSetup | (Record Purchases & Payables Setup, var Boolean) | 17-28 | - | - |
| Integration event | OnAfterIsCheckDirectCostAppliedAccount | (Record Purch. Inv. Line, var Boolean) | 17-28 | - | - |
| Integration event | OnAfterCreateCopyDocument | (var Record Purchase Header) | 17-20 | - | - |
| Integration event | OnBeforeCreateCopyDocument | (var Record Purch. Inv. Header, var Record Purchase Header, Enum Purchase Document Type, Boolean) | 19-28 | - | - |
| Integration event | OnBeforeTestIfInvoiceIsPaid | (var Record Purch. Inv. Header, var Boolean) | 19-28 | - | - |
| Integration event | OnRunOnAfterUpdatePurchaseOrderLinesFromCancelledInvoice | (var Record Purch. Inv. Header, var Record Purchase Header) | 19-28 | - | - |
| Integration event | OnRunOnBeforeCreateCopyDocument | (var Record Purch. Inv. Header) | 19-28 | - | - |
| Integration event | OnTestPurchaseLinesOnAfterCalcThrowItemReturnedError | (Record Purch. Inv. Header, Record Purch. Inv. Line, var Boolean) | 20-28 | - | - |
| Integration event | OnBeforeTestIfAnyFreeNumberSeries | (var Record Purch. Inv. Header, Boolean, var Boolean) | 21-28 | - | - |
| Integration event | OnAfterCreateCopyDocument | (var Record Purchase Header, Boolean, Record Purch. Inv. Header) | 21-28 | - | - |
| Integration event | OnBeforeShowPostedPurchCreditMemo | (var Record Purch. Cr. Memo Hdr., var Boolean) | 21-28 | - | - |
| Integration event | OnBeforeShowPurchaseCreditMemo | (var Record Purchase Header, var Boolean) | 21-28 | - | - |
| Integration event | OnCreateCreditMemoOnBeforeConfirmPostingCreditMemoFailedOpen | (var Record Purchase Header, var Boolean) | 23-28 | - | - |
| Integration event | OnBeforeTestPurchaseInvoiceHeaderAmount | (var Record Purch. Inv. Header, Boolean, var Boolean) | 23-27 | Pending 25.0 | OnBeforeTestPurchaseInvoiceHeaderAmount is not supported anymore. |
| Integration event | OnAfterCreateCorrectivePurchCrMemo | (Record Purch. Inv. Header, var Record Purchase Header, var Boolean, var Boolean) | 24-28 | - | - |
| Integration event | OnCancelPostedInvoiceStartNewInvoiceOnAfterCreateCorrPurchaseInvoice | (var Record Purchase Header, var Record Purch. Inv. Header) | 24-28 | - | - |
| Integration event | OnAfterIsCommentLine | (Record Purch. Inv. Line, var Boolean) | 24-28 | - | - |
| Integration event | OnBeforeSetTrackInfoForCancellation | (var Record Purch. Inv. Header, var Boolean) | 24-28 | - | - |
| Integration event | OnBeforeTestVATPostingSetup | (Record Purch. Inv. Line, var Boolean) | 27-28 | - | - |

## Source

Symbols: Microsoft.BaseApplication.symbols.437dbf0e-84ff-417a-965d-ed2bb9650972, https://dynamicssmb2.pkgs.visualstudio.com/DynamicsBCPublicFeeds/_packaging/MSSymbols/nuget/v3/index.json, highest build per major on 2026-09-20.
AL source 29: https://github.com/microsoft/BCApps, MIT, releases/29.x at a66254c3b8b5bb1cea290dc8f9d097aec4381153.

Jonas Paprotka, 2026-09-20.
