---
title: "Codeunit 1303 Correct Posted Sales Invoice, extension points 29"
author: "JOP-AL"
url: https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/points/
object: https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/
app: "Base Application"
major: 29
source: https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/
checked: 2026-11-20
changed: 2026-11-04
subject: "Microsoft Dynamics 365 Business Central"
license: "Metadata from Microsoft's symbol packages. AL source MIT, Copyright (c) Microsoft Corporation. Selection and wording © 2026 JOP-AL. https://jonas-paprotka.de/licenses/"
---

# Codeunit 1303 Correct Posted Sales Invoice, extension points 29

JOP-AL, https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/points/

50 procedures and triggers with a step in src/Layers/W1/BaseApp/Sales/History/CorrectPostedSalesInvoice.Codeunit.al, in source order, read from the text, not from a run.

## OnRun

[Line 41](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L41), trigger.

- [47](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L47) calls `UnapplyCostApplication`
- [49](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L49) raises `OnBeforeCreateCorrectiveSalesCrMemo`
- [50](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L50) calls `CreateCopyDocument`
- [51](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L51) raises `OnAfterCreateCorrectiveSalesCrMemo`
- [53](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L53) calls `SalesInvoiceLinesContainJob`
- [54](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L54) calls `CreateAndProcessJobPlanningLines`
- [56](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L56) calls [Codeunit 310 No. Series](https://jonas-paprotka.de/ref/codeunit/310-no-series/) `IsNoSeriesInDateOrder`
- [59](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L59) raises `OnRunOnBeforePostCorrectiveSalesCrMemo`, IsHandled
- [63](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L63) runs [Codeunit 80 Sales-Post](https://jonas-paprotka.de/ref/codeunit/80-sales-post/)
- [64](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L64) calls `SetTrackInfoForCancellation`
- [65](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L65) calls `UpdateSalesOrderLinesFromCancelledInvoice`
- [66](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L66) calls `ResetIncomingDocumentForCancelledInvoice`
- [68](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L68) raises `OnOnRunOnAfterUpdateSalesOrderLinesFromCancelledInvoice`

## CancelPostedInvoice

[Line 139](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L139).

- [142](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L142) calls `CreateCreditMemo`

## CreateCreditMemo

[Line 145](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L145), local.

- [152](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L152) calls `TestCorrectInvoiceIsAllowed`
- [153](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L153) runs [Codeunit 1303 Correct Posted Sales Invoice](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/)
- [158](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L158) raises `OnCreateCreditMemoOnBeforePostedPageRun`, IsHandled
- [160](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L160) calls [Codeunit 700 Page Management](https://jonas-paprotka.de/ref/codeunit/700-page-management/) `PageRun`
- [167](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L167) raises `OnCreateCreditMemoOnBeforePageRun`, IsHandled
- [169](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L169) runs [Page 44 Sales Credit Memo](https://jonas-paprotka.de/ref/page/44-sales-credit-memo/)

## CreateCopyDocument

[Line 179](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L179), local.

- [186](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L186) calls [Table 36 Sales Header](https://jonas-paprotka.de/ref/table/36-sales-header/) `SetAllowSelectNoSeries`
- [187](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L187) raises `OnBeforeSalesHeaderInsert`
- [188](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L188) writes [Table 36 Sales Header](https://jonas-paprotka.de/ref/table/36-sales-header/) Insert(true)
- [192](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L192) calls [Codeunit 6620 Copy Document Mgt.](https://jonas-paprotka.de/ref/codeunit/6620-copy-document-mgt/) `SetPropertiesForCorrectiveCreditMemo`
- [194](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L194) calls [Codeunit 6620 Copy Document Mgt.](https://jonas-paprotka.de/ref/codeunit/6620-copy-document-mgt/) `SetPropertiesForInvoiceCorrection`
- [199](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L199) calls [Codeunit 6620 Copy Document Mgt.](https://jonas-paprotka.de/ref/codeunit/6620-copy-document-mgt/) `CopySalesDocForInvoiceCancelling`
- [200](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L200) raises `OnAfterCreateCopyDocument`

## CreateCreditMemoCopyDocument

[Line 209](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L209).

- [214](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L214) raises `OnBeforeCreateCreditMemoCopyDocument`
- [215](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L215) calls `TestNoFixedAssetInSalesInvoice`
- [216](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L216) calls `TestNotSalesPrepaymentlInvoice`
- [217](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L217) calls `TestIfDropShipmentDocument`
- [218](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L218) calls [Table 112 Sales Invoice Header](https://jonas-paprotka.de/ref/table/112-sales-invoice-header/) `IsFullyOpen`
- [219](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L219) calls `ShowInvoiceAppliedNotification`
- [226](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L226) raises `OnCreateCreditMemoCopyDocumentOnBeforeConfirm`
- [231](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L231) calls `CreateCopyDocument`
- [233](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L233) calls `SalesInvoiceLinesContainJob`
- [234](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L234) calls `CreateAndProcessJobPlanningLines`

## CreateCorrectiveCreditMemo

[Line 243](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L243).

- [252](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L252) calls `CreateCopyDocument`
- [254](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L254) calls `SalesInvoiceLinesContainJob`
- [255](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L255) calls `CreateAndProcessJobPlanningLines`
- [258](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L258) raises `OnCreateCorrectiveCreditMemoOnBeforePageRun`, IsHandled
- [260](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L260) runs [Page 44 Sales Credit Memo](https://jonas-paprotka.de/ref/page/44-sales-credit-memo/)

## ShowAppliedEntries

[Line 267](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L267).

- [274](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L274) runs [Page 61 Applied Customer Entries](https://jonas-paprotka.de/ref/page/61-applied-customer-entries/)

## CreateAndProcessJobPlanningLines

[Line 286](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L286), local.

- [292](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L292) raises `OnBeforeCreateAndProcessJobPlanningLines`, IsHandled
- [301](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L301) calls `CreateJobPlanningLine`
- [302](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L302) writes [Table 37 Sales Line](https://jonas-paprotka.de/ref/table/37-sales-line/) Modify

## CreateJobPlanningLine

[Line 306](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L306), local.

- [316](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L316) calls [Table 1003 Job Planning Line](https://jonas-paprotka.de/ref/table/1003-job-planning-line/) `InitFromJobPlanningLine`
- [317](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L317) raises `OnCreateJobPlanningLineOnAfterInitFromJobPlanningLine`
- [318](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L318) calls [Table 1022 Job Planning Line Invoice](https://jonas-paprotka.de/ref/table/1022-job-planning-line-invoice/) `InitFromJobPlanningLine`
- [319](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L319) calls [Table 1022 Job Planning Line Invoice](https://jonas-paprotka.de/ref/table/1022-job-planning-line-invoice/) `InitFromSales`
- [320](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L320) writes [Table 1022 Job Planning Line Invoice](https://jonas-paprotka.de/ref/table/1022-job-planning-line-invoice/) Insert
- [322](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L322) calls [Table 1003 Job Planning Line](https://jonas-paprotka.de/ref/table/1003-job-planning-line/) `UpdateQtyToTransfer`
- [323](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L323) writes [Table 1003 Job Planning Line](https://jonas-paprotka.de/ref/table/1003-job-planning-line/) Insert

## CancelPostedInvoiceCreateNewInvoice

[Line 333](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L333).

- [337](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L337) calls `CreateCreditMemo`
- [338](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L338) calls `CreateCopyDocument`
- [339](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L339) raises `OnAfterCreateCorrSalesInvoice`

## TestCorrectInvoiceIsAllowed

[Line 349](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L349).

- [353](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L353) calls `TestIfPostingIsAllowed`
- [354](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L354) calls `TestIfInvoiceIsCorrectedOnce`
- [355](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L355) calls `TestIfInvoiceIsNotCorrectiveDoc`
- [356](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L356) calls `TestIfInvoiceIsPaid`
- [357](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L357) calls `TestIfCustomerIsBlocked`
- [358](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L358) calls `TestIfCustomerIsBlocked`
- [359](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L359) calls `TestIfJobPostingIsAllowed`
- [360](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L360) calls `TestCustomerDimension`
- [361](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L361) calls `TestDimensionOnHeader`
- [362](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L362) calls `TestSalesLines`
- [363](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L363) calls `TestIfAnyFreeNumberSeries`
- [364](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L364) calls `TestExternalDocument`
- [365](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L365) calls `TestInventoryPostingClosed`
- [366](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L366) calls `TestNotSalesPrepaymentlInvoice`
- [367](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L367) calls `TestIfDropShipmentDocument`
- [369](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L369) raises `OnAfterTestCorrectInvoiceIsAllowed`

## ShowInvoiceAppliedNotification

[Line 372](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L372), local.

- [390](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L390) calls [Codeunit 1511 Notification Lifecycle Mgt.](https://jonas-paprotka.de/ref/codeunit/1511-notification-lifecycle-mgt/) `SendNotification`

## SetTrackInfoForCancellation

[Line 393](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L393), local.

- [400](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L400) raises `OnBeforeSetTrackInfoForCancellation`, IsHandled
- [406](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L406) calls [Table 1900 Cancelled Document](https://jonas-paprotka.de/ref/table/1900-cancelled-document/) `InsertSalesInvToCrMemoCancelledDocument`

## TestDimensionOnHeader

[Line 418](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L418), local.

- [422](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L422) calls [Codeunit 408 DimensionManagement](https://jonas-paprotka.de/ref/codeunit/408-dimensionmanagement/) `CheckDimIDComb`
- [423](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L423) calls `ErrorHelperHeader`

## TestIfCustomerIsBlocked

[Line 426](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L426), local.

- [432](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L432) calls `ErrorHelperHeader`

## TestCustomerDimension

[Line 435](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L435), local.

- [445](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L445) calls [Codeunit 408 DimensionManagement](https://jonas-paprotka.de/ref/codeunit/408-dimensionmanagement/) `CheckDimValuePosting`
- [446](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L446) calls `ErrorHelperAccount`

## TestSalesLines

[Line 449](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L449), local.

- [461](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L461) calls `TestNoFixedAssetInSalesLines`
- [464](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L464) calls `IsCommentLine`
- [465](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L465) calls `TestSalesLineType`
- [469](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L469) calls `WasNotCancelled`
- [471](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L471) calls [Table 113 Sales Invoice Line](https://jonas-paprotka.de/ref/table/113-sales-invoice-line/) `CalcShippedSaleNotReturned`
- [472](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L472) raises `OnTestSalesLinesOnAfterCalcShippedQtyNoReturned`
- [474](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L474) calls `ErrorHelperLine`
- [480](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L480) calls `ErrorHelperLine`
- [484](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L484) calls `ErrorHelperLine`
- [490](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L490) calls [Codeunit 408 DimensionManagement](https://jonas-paprotka.de/ref/codeunit/408-dimensionmanagement/) `CheckDimValuePosting`
- [491](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L491) calls `ErrorHelperAccount`
- [495](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L495) calls `TestInventoryPostingSetup`
- [498](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L498) calls `TestGenPostingSetup`
- [499](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L499) calls `TestCustomerPostingGroup`
- [500](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L500) calls `TestVATPostingSetup`
- [501](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L501) calls `TestWMSLocation`
- [503](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L503) calls [Codeunit 408 DimensionManagement](https://jonas-paprotka.de/ref/codeunit/408-dimensionmanagement/) `CheckDimIDComb`
- [504](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L504) calls `ErrorHelperLine`

## TestGLAccount

[Line 509](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L509), local.

- [519](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L519) calls `ErrorHelperAccount`
- [525](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L525) calls [Codeunit 408 DimensionManagement](https://jonas-paprotka.de/ref/codeunit/408-dimensionmanagement/) `CheckDimValuePosting`
- [526](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L526) calls `ErrorHelperAccount`

## TestGLAccount

[Line 530](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L530), local.

- [540](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L540) calls `ErrorHelperAccount`
- [544](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L544) calls [Codeunit 408 DimensionManagement](https://jonas-paprotka.de/ref/codeunit/408-dimensionmanagement/) `CheckDimValuePosting`
- [545](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L545) calls `ErrorHelperAccount`

## TestIfInvoiceIsPaid

[Line 550](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L550), local.

- [555](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L555) raises `OnBeforeTestIfInvoiceIsPaid`, IsHandled
- [562](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L562) calls `ErrorHelperHeader`

## TestIfInvoiceIsCorrectedOnce

[Line 565](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L565), local.

- [571](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L571) raises `OnBeforeTestIfInvoiceIsCorrectedOnce`, IsHandled
- [575](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L575) calls [Table 1900 Cancelled Document](https://jonas-paprotka.de/ref/table/1900-cancelled-document/) `FindSalesCancelledInvoice`
- [576](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L576) calls `ErrorHelperHeader`

## TestIfInvoiceIsNotCorrectiveDoc

[Line 579](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L579), local.

- [583](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L583) calls [Table 1900 Cancelled Document](https://jonas-paprotka.de/ref/table/1900-cancelled-document/) `FindSalesCorrectiveInvoice`
- [584](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L584) calls `ErrorHelperHeader`

## TestIfPostingIsAllowed

[Line 587](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L587), local.

- [591](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L591) calls [Codeunit 11 Gen. Jnl.-Check Line](https://jonas-paprotka.de/ref/codeunit/11-gen-jnl-check-line/) `DateNotAllowed`
- [592](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L592) calls `ErrorHelperHeader`

## TestIfAnyFreeNumberSeries

[Line 595](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L595), local.

- [605](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L605) raises `OnBeforeTestIfAnyFreeNumberSeries`, IsHandled
- [612](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L612) calls `TryPeekNextNo`
- [613](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L613) calls `ErrorHelperHeader`
- [621](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L621) calls `TryPeekNextNo`
- [622](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L622) calls `ErrorHelperHeader`
- [624](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L624) calls `TryPeekNextNo`
- [625](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L625) calls `ErrorHelperHeader`

## TryPeekNextNo

[Line 629](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L629), local.

- [633](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L633) calls [Codeunit 310 No. Series](https://jonas-paprotka.de/ref/codeunit/310-no-series/) `PeekNextNo`

## TestIfJobPostingIsAllowed

[Line 637](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L637), local.

- [647](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L647) calls [Table 167 Job](https://jonas-paprotka.de/ref/table/167-job/) `TestBlocked`

## TestExternalDocument

[Line 651](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L651), local.

- [657](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L657) calls `ErrorHelperHeader`

## TestInventoryPostingClosed

[Line 660](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L660), local.

- [675](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L675) calls `ErrorHelperHeader`

## TestSalesLineType

[Line 679](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L679), local.

- [683](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L683) calls [Table 113 Sales Invoice Line](https://jonas-paprotka.de/ref/table/113-sales-invoice-line/) `IsCancellationSupported`
- [690](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L690) raises `OnAfterTestSalesLineType`, IsHandled
- [692](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L692) calls `ErrorHelperLine`

## TestGenPostingSetup

[Line 695](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L695), local.

- [707](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L707) calls `TestGLAccount`
- [709](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L709) calls `TestGLAccount`
- [711](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L711) calls `HasLineDiscountSetup`
- [713](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L713) calls `TestGLAccount`
- [716](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L716) raises `OnTestGenPostingSetupOnBeforeTestTypeItem`, IsHandled
- [720](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L720) calls [Table 27 Item](https://jonas-paprotka.de/ref/table/27-item/) `IsInventoriableType`
- [721](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L721) calls `TestGLAccount`
- [721](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L721) calls [Table 252 General Posting Setup](https://jonas-paprotka.de/ref/table/252-general-posting-setup/) `GetCOGSAccount`

## TestCustomerPostingGroup

[Line 725](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L725), local.

- [731](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L731) calls `TestGLAccount`

## TestVATPostingSetup

[Line 734](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L734), local.

- [740](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L740) raises `OnBeforeTestVATPostingSetup`, IsHandled
- [747](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L747) calls `TestGLAccount`

## TestInventoryPostingSetup

[Line 751](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L751), local.

- [757](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L757) raises `OnBeforeTestInventoryPostingSetup`, IsHandled
- [763](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L763) calls `TestGLAccount`

## TestNoFixedAssetInSalesInvoice

[Line 766](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L766), local.

- [771](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L771) calls `TestNoFixedAssetInSalesLines`

## IsCommentLine

[Line 790](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L790), local.

- [793](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L793) raises `OnAfterIsCommentLine`

## WasNotCancelled

[Line 796](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L796), local.

- [803](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L803) raises `OnBeforeWasNotCancelled`, IsHandled

## UnapplyCostApplication

[Line 812](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L812), local.

- [820](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L820) raises `OnBeforeUnapplyCostApplication`, IsHandled
- [824](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L824) calls `FindItemLedgEntries`
- [825](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L825) calls `FindAppliedInbndEntries`
- [827](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L827) calls [Codeunit 22 Item Jnl.-Post Line](https://jonas-paprotka.de/ref/codeunit/22-item-jnl-post-line/) `UnApply`
- [829](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L829) calls [Codeunit 22 Item Jnl.-Post Line](https://jonas-paprotka.de/ref/codeunit/22-item-jnl-post-line/) `RedoApplications`

## FindItemLedgEntries

[Line 838](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L838).

- [846](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L846) calls [Table 113 Sales Invoice Line](https://jonas-paprotka.de/ref/table/113-sales-invoice-line/) `GetItemLedgEntries`

## FindAppliedInbndEntries

[Line 850](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L850), local.

- [855](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L855) writes [Table 339 Item Application Entry](https://jonas-paprotka.de/ref/table/339-item-application-entry/) DeleteAll
- [858](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L858) calls [Table 339 Item Application Entry](https://jonas-paprotka.de/ref/table/339-item-application-entry/) `AppliedInbndEntryExists`
- [862](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L862) writes [Table 339 Item Application Entry](https://jonas-paprotka.de/ref/table/339-item-application-entry/) Insert

## ErrorHelperHeader

[Line 873](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L873).

- [877](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L877) raises `OnBeforeErrorHelperHeader`

## HasLineDiscountSetup

[Line 1013](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1013), local.

- [1015](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1015) calls [Table 311 Sales & Receivables Setup](https://jonas-paprotka.de/ref/table/311-sales-receivables-setup/) `GetRecordOnce`
- [1019](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1019) raises `OnHasLineDiscountSetup`

## UpdateSalesOrderLineIfExist

[Line 1026](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1026), internal.

- [1045](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1045) calls [Table 115 Sales Cr.Memo Line](https://jonas-paprotka.de/ref/table/115-sales-cr-memo-line/) `GetSalesInvoiceLine`
- [1047](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1047) calls `UpdateSalesOrderLinesFromCreditMemo`
- [1049](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1049) writes [Table 113 Sales Invoice Line](https://jonas-paprotka.de/ref/table/113-sales-invoice-line/) Insert

## UpdateSalesOrderLinesFromCreditMemo

[Line 1054](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1054), local.

- [1062](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1062) raises `OnBeforeUpdateSalesOrderLinesFromCreditMemo`, IsHandled
- [1070](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1070) calls [Table 113 Sales Invoice Line](https://jonas-paprotka.de/ref/table/113-sales-invoice-line/) `GetItemLedgEntries`
- [1072](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1072) calls `UpdateSalesOrderLineInvoicedQuantity`
- [1073](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1073) calls `UpdateSalesOrderLinePrepmtAmount`
- [1077](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1077) calls `UpdateWhseRequest`
- [1080](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1080) calls [Codeunit 5817 Undo Posting Management](https://jonas-paprotka.de/ref/codeunit/5817-undo-posting-management/) `RevertPostedItemTracking`

## ResetIncomingDocumentForCancelledInvoice

[Line 1084](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1084), local.

- [1118](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1118) writes [Table 130 Incoming Document](https://jonas-paprotka.de/ref/table/130-incoming-document/) Modify(true)
- [1121](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1121) writes [Table 133 Incoming Document Attachment](https://jonas-paprotka.de/ref/table/133-incoming-document-attachment/) ModifyAll
- [1122](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1122) writes [Table 133 Incoming Document Attachment](https://jonas-paprotka.de/ref/table/133-incoming-document-attachment/) ModifyAll

## UpdateSalesOrderLinesFromCancelledInvoice

[Line 1125](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1125), local.

- [1134](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1134) raises `OnBeforeUpdateSalesOrderLinesFromCancelledInvoice`, IsHandled
- [1142](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1142) writes [Table 32 Item Ledger Entry](https://jonas-paprotka.de/ref/table/32-item-ledger-entry/) DeleteAll
- [1143](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1143) calls [Table 113 Sales Invoice Line](https://jonas-paprotka.de/ref/table/113-sales-invoice-line/) `GetItemLedgEntries`
- [1145](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1145) calls `UpdateSalesOrderLineInvoicedQuantity`
- [1146](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1146) calls `UpdateSalesOrderLinePrepmtAmount`
- [1148](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1148) calls `UpdateWhseRequest`
- [1150](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1150) calls [Codeunit 5817 Undo Posting Management](https://jonas-paprotka.de/ref/codeunit/5817-undo-posting-management/) `RevertPostedItemTracking`

## UpdateWhseRequest

[Line 1155](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1155), local.

- [1160](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1160) calls [Table 5765 Warehouse Request](https://jonas-paprotka.de/ref/table/5765-warehouse-request/) `SetSourceFilter`
- [1164](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1164) writes [Table 5765 Warehouse Request](https://jonas-paprotka.de/ref/table/5765-warehouse-request/) Modify

## UpdateSalesOrderLineInvoicedQuantity

[Line 1168](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1168), local.

- [1173](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1173) raises `OnBeforeUpdateSalesOrderLineInvoicedQuantity`, IsHandled
- [1181](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1181) calls [Table 37 Sales Line](https://jonas-paprotka.de/ref/table/37-sales-line/) `InitOutstanding`
- [1182](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1182) calls [Table 37 Sales Line](https://jonas-paprotka.de/ref/table/37-sales-line/) `InitQtyToShip`
- [1183](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1183) calls [Table 37 Sales Line](https://jonas-paprotka.de/ref/table/37-sales-line/) `UpdateWithWarehouseShip`
- [1184](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1184) writes [Table 37 Sales Line](https://jonas-paprotka.de/ref/table/37-sales-line/) Modify
- [1186](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1186) raises `OnAfterUpdateSalesOrderLineInvoicedQuantity`

## TestWMSLocation

[Line 1189](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1189), local.

- [1196](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1196) raises `OnBeforeTestWMSLocation`, IsHandled
- [1206](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1206) calls [Table 27 Item](https://jonas-paprotka.de/ref/table/27-item/) `IsInventoriableType`

## UpdateSalesOrderLinePrepmtAmount

[Line 1215](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1215), local.

- [1234](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1234) calls [Table 4 Currency](https://jonas-paprotka.de/ref/table/4-currency/) `Initialize`
- [1237](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1237) raises `OnUpdateSalesOrderLinePrepmtAmountOnBeforeUpdatePrepmtAmounts`, IsHandled
- [1242](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1242) validates [Table 37 Sales Line](https://jonas-paprotka.de/ref/table/37-sales-line/) `Prepmt. Amount Inv. (LCY)`
- [1246](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1246) calls [Table 330 Currency Exchange Rate](https://jonas-paprotka.de/ref/table/330-currency-exchange-rate/) `ExchangeAmtFCYToLCY`
- [1255](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1255) validates [Table 37 Sales Line](https://jonas-paprotka.de/ref/table/37-sales-line/) `Prepmt. Amount Inv. (LCY)`
- [1263](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1263) validates [Table 37 Sales Line](https://jonas-paprotka.de/ref/table/37-sales-line/) `Prepmt. VAT Amount Inv. (LCY)`
- [1267](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1267) calls [Table 330 Currency Exchange Rate](https://jonas-paprotka.de/ref/table/330-currency-exchange-rate/) `ExchangeAmtFCYToLCY`
- [1276](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1276) validates [Table 37 Sales Line](https://jonas-paprotka.de/ref/table/37-sales-line/) `Prepmt. VAT Amount Inv. (LCY)`
- [1283](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1283) validates [Table 37 Sales Line](https://jonas-paprotka.de/ref/table/37-sales-line/) `Prepmt Amt Deducted`
- [1290](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1290) validates [Table 37 Sales Line](https://jonas-paprotka.de/ref/table/37-sales-line/) `Prepmt Amt to Deduct`
- [1297](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1297) writes [Table 37 Sales Line](https://jonas-paprotka.de/ref/table/37-sales-line/) Modify(true)

## TestIfDropShipmentDocument

[Line 1300](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1300), local.

- [1307](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1307) raises `OnBeforeTestIfDropShipmentDocument`, IsHandled
- [1314](https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/source/#L1314) calls [Table 113 Sales Invoice Line](https://jonas-paprotka.de/ref/table/113-sales-invoice-line/) `GetSalesShptLines`

## Source

AL source 29: https://github.com/microsoft/BCApps, MIT, releases/29.x at 4303e5e584d3aa5d9e98cbc615525a5396ad6ed7.

JOP-AL, 2026-11-20.
