codeunitSales & Receivablesofficial - Microsoftderived - from the source, no model text

Codeunit 1303 "Correct Posted Sales Invoice"

Base Application · Microsoft.Sales.History

Across versions

  1. BC23present
  2. BC243 events added, 1 procedures added
  3. BC25declaration changed
  4. BC262 procedures added, 1 procedures changed
  5. BC27unchanged
  6. BC283 events added, 1 procedures added
  7. BC291 events added
  8. BC30unchanged

Neighbourhood 18 connected objects and pages

Table 112 "Sales Invoice Header" (relates to)Sales Invoice HeaderCodeunit 5579 "Digital Voucher Impl." (event subscribers)Digital Voucher Impl.Codeunit 408 "DimensionManagement" (calls, 5 links)DimensionManagementCodeunit 1322 "Correct PstdSalesInv (Yes/No)" (calls, 4 links)Correct PstdSalesInv (Yes/No)Codeunit 6620 "Copy Document Mgt." (calls, 3 links)Copy Document Mgt.Page 20012 "APIV1 - Sales Invoices" (calls, 3 links)APIV1 - Sales InvoicesPage 30012 "APIV2 - Sales Invoices" (calls, 3 links)APIV2 - Sales InvoicesCodeunit 1323 "Cancel PstdSalesInv (Yes/No)" (calls, 2 links)Cancel PstdSalesInv (Yes/No)Codeunit 22 "Item Jnl.-Post Line" (calls, 2 links)Item Jnl.-Post LineCodeunit 5817 "Undo Posting Management" (calls, 2 links)Undo Posting ManagementCodeunit 80 "Sales-Post" (calls, 2 links)Sales-PostPage 44 "Sales Credit Memo" (calls, 2 links)Sales Credit MemoPage 456 "No. Series" (calls, 2 links)No. SeriesCodeunit 11 "Gen. Jnl.-Check Line" (calls)Gen. Jnl.-Check LineCodeunit 1511 "Notification Lifecycle Mgt." (calls)Codeunit 700 "Page Management" (calls)Page 61 "Applied Customer Entries" (calls)Table 36 "Sales Header" (calls)

Open in the neighbourhood explorer

One hop out, from the extracted relations and call graph. Up to 40 shown; the sections below list them all.

Base Application · Microsoft.Sales.History · BC23-30 · source at ea08af5e · facts from BC29

Properties

Property Value
TableNo Sales Invoice Header
Permissions TableData “Sales Invoice Header” = rm, TableData “Sales Cr.Memo Header” = rm

Events published

  • OnAfterCreateCopyDocument(var SalesHeader: Record "Sales Header"; var SalesInvoiceHeader: Record "Sales Invoice Header") (integration): Raised after creating a copy document from a posted sales invoice.
  • OnBeforeTestIfDropShipmentDocument(var SalesInvoiceHeader: Record "Sales Invoice Header"; var IsHandled: Boolean) + BC28 (integration): Raised before testing whether to drop shipment document exists for the posted sales invoice.
  • OnAfterIsCommentLine(SalesInvoiceLine: Record "Sales Invoice Line"; var Result: Boolean) (integration): Raised after determining whether a sales invoice line is a comment line.
  • OnAfterTestCorrectInvoiceIsAllowed(var SalesInvoiceHeader: Record "Sales Invoice Header"; Cancelling: Boolean) (integration): Raised after testing whether the invoice correction or cancellation is allowed.
  • OnAfterTestSalesLineType(SalesInvoiceLine: Record "Sales Invoice Line"; var IsHandled: Boolean) (integration): Raised after testing whether the sales invoice line type is allowed for correction.
  • OnAfterCreateCorrSalesInvoice(var SalesHeader: Record "Sales Header"; var SalesInvoiceHeader: Record "Sales Invoice Header") (integration): Raised after creating a corrective sales invoice from a posted invoice.
  • OnAfterCreateCorrectiveSalesCrMemo(SalesInvoiceHeader: Record "Sales Invoice Header"; var SalesHeader: Record "Sales Header"; var CancellingOnly: Boolean) (integration): Raised after creating a corrective sales credit memo from a posted invoice.
  • OnAfterUpdateSalesOrderLineInvoicedQuantity(var SalesLine: Record "Sales Line"; CancelledQuantity: Decimal; CancelledQtyBase: Decimal) (integration): Raised after updating the invoiced quantity on a sales order line during cancellation.
  • OnBeforeCreateCorrectiveSalesCrMemo(var SalesInvoiceHeader: Record "Sales Invoice Header") (integration): Raised before creating a corrective sales credit memo from a posted invoice.
  • OnBeforeCreateCreditMemoCopyDocument(var SalesInvoiceHeader: Record "Sales Invoice Header") (integration): Raised before creating a credit memo copy document from a posted invoice.
  • OnCreateCreditMemoCopyDocumentOnBeforeConfirm(var SalesInvoiceHeader: Record "Sales Invoice Header"; var SalesHeader: Record "Sales Header"; var ConfirmQuestion: Text) + BC28 (integration): Raised before confirming the creation of a corrective credit memo for an invoice posted from a sales order.
  • OnBeforeSalesHeaderInsert(var SalesHeader: Record "Sales Header"; var SalesInvoiceHeader: Record "Sales Invoice Header"; CancellingOnly: Boolean) (integration): Raised before inserting the sales header during invoice correction.
  • OnBeforeSetTrackInfoForCancellation(var SalesInvoiceHeader: Record "Sales Invoice Header"; var IsHandled: Boolean) (integration): Raised before setting tracking information for invoice cancellation.
  • OnBeforeTestIfAnyFreeNumberSeries(var SalesInvoiceHeader: Record "Sales Invoice Header"; var IsHandled: Boolean) (integration): Raised before testing whether there are free number series for the correction.
  • OnHasLineDiscountSetup(SalesReceivablesSetup: Record "Sales & Receivables Setup"; var Result: Boolean) (integration): Raised to determine whether line discount setup is configured.
  • OnBeforeTestInventoryPostingSetup(SalesInvoiceLine: Record "Sales Invoice Line"; var IsHandled: Boolean) (integration): Raised before testing inventory posting setup for the sales invoice line.
  • OnBeforeUpdateSalesOrderLineInvoicedQuantity(var SalesLine: Record "Sales Line"; CancelledQuantity: Decimal; CancelledQtyBase: Decimal; var IsHandled: Boolean) (integration): Raised before updating the invoiced quantity on a sales order line during cancellation.
  • OnUpdateSalesOrderLinePrepmtAmountOnBeforeUpdatePrepmtAmounts(SalesInvoiceLine: Record "Sales Invoice Line"; var SalesLine: Record "Sales Line"; SalesHeader: Record "Sales Header"; Currency: Record Currency; var IsHandled: Boolean) + BC29 (integration): Raised before updating prepayment amounts on a sales order line during correction.
  • OnCreateCreditMemoOnBeforePageRun(var SalesHeader: Record "Sales Header"; var IsHandled: Boolean) (integration): Raised before opening the credit memo page during invoice correction.
  • OnCreateCreditMemoOnBeforePostedPageRun(var SalesCrMemoHeader: Record "Sales Cr.Memo Header"; var IsHandled: Boolean) (integration): Raised before opening the posted credit memo page during invoice correction.
  • OnBeforeUnapplyCostApplication(InvNo: Code[20]; var IsHandled: Boolean) (integration): Raised before unapplying cost applications for the invoice.
  • OnTestSalesLinesOnAfterCalcShippedQtyNoReturned(SalesInvoiceLine: Record "Sales Invoice Line"; var ShippedQtyNoReturned: Decimal) (integration): Raised after calculating the shipped quantity not returned during sales line validation.
  • OnOnRunOnAfterUpdateSalesOrderLinesFromCancelledInvoice(var Rec: Record "Sales Invoice Header"; var SalesHeader: Record "Sales Header") (integration): Raised after updating sales order lines from a cancelled invoice during the OnRun trigger.
  • OnBeforeTestIfInvoiceIsPaid(var SalesInvoiceHeader: Record "Sales Invoice Header"; var IsHandled: Boolean) (integration): Raised before testing whether the invoice has been paid.
  • OnCreateCorrectiveCreditMemoOnBeforePageRun(var SalesHeader: Record "Sales Header"; var IsHandled: Boolean) (integration): Raised before opening the corrective credit memo page from a notification action.
  • OnBeforeTestVATPostingSetup(SalesInvoiceLine: Record "Sales Invoice Line"; var IsHandled: Boolean) (integration): Raised before testing VAT posting setup for the sales invoice line.
  • OnBeforeErrorHelperHeader(HeaderErrorType: Enum "Correct Sales Inv. Error Type"; SalesInvoiceHeader: Record "Sales Invoice Header"; CancellingOnly: Boolean) (integration): Raised before raising a header-level error during invoice correction validation.
  • OnBeforeTestIfInvoiceIsCorrectedOnce(var SalesInvoiceHeader: Record "Sales Invoice Header"; var IsHandled: Boolean) (integration): Raised before testing whether the invoice has already been corrected.
  • OnBeforeWasNotCancelled(InvNo: Code[20]; var Result: Boolean; var IsHandled: Boolean) (integration): Raised before checking whether the invoice was not cancelled.
  • OnRunOnBeforePostCorrectiveSalesCrMemo(var SalesInvoiceHeader: Record "Sales Invoice Header"; var SalesHeader: Record "Sales Header"; var IsHandled: Boolean; var SuppressCommit: Boolean) + BC24 − BC24 (integration): Raised before posting the corrective sales credit memo during the OnRun trigger.
  • OnBeforeTestWMSLocation(var SalesInvoiceLine: Record "Sales Invoice Line"; var IsHandled: Boolean) (integration): Raised before testing warehouse management system location for the sales invoice line.
  • OnBeforeCreateAndProcessJobPlanningLines(var SalesHeader: Record "Sales Header"; var IsHandled: Boolean) (integration): Raised before creating and processing project planning lines during invoice correction.
  • OnTestGenPostingSetupOnBeforeTestTypeItem(SalesInvoiceLine: Record "Sales Invoice Line"; var IsHandled: Boolean) (integration): Raised before testing general posting setup for item type lines.
  • OnBeforeUpdateSalesOrderLinesFromCancelledInvoice(SalesInvoiceHeaderNo: Code[20]; var IsHandled: Boolean) + BC24 (integration): Raised before updating sales order lines from a cancelled invoice.
  • OnBeforeUpdateSalesOrderLinesFromCreditMemo(var SalesInvoiceLine: Record "Sales Invoice Line"; var SalesCrMemoLine: Record "Sales Cr.Memo Line"; var IsHandled: Boolean) + BC28 (integration): Raised before updating sales order lines from a credit memo.
  • OnCreateJobPlanningLineOnAfterInitFromJobPlanningLine(var ToJobPlanningLine: Record "Job Planning Line"; FromJobPlanningLine: Record "Job Planning Line"; SalesLine: Record "Sales Line") + BC24 (integration): Raised after initializing a project planning line from another project planning line during correction.

Procedures

  • CancelPostedInvoice(var SalesInvoiceHeader: Record "Sales Invoice Header"): Boolean: Cancels the posted sales invoice by creating and posting a corrective credit memo.
  • CreateCreditMemoCopyDocument(var SalesInvoiceHeader: Record "Sales Invoice Header"; var SalesHeader: Record "Sales Header"): Boolean: Creates a credit memo document as a copy of the posted sales invoice without posting it.
  • CreateCorrectiveCreditMemo(var InvoiceNotification: Notification): Creates a corrective credit memo from a notification action triggered on a posted sales invoice.
  • ShowAppliedEntries(var InvoiceNotification: Notification): Shows the applied customer ledger entries for the posted sales invoice referenced in the notification.
  • SkipCorrectiveCreditMemo(var InvoiceNotification: Notification): Dismisses the corrective credit memo notification without taking any action.
  • CancelPostedInvoiceCreateNewInvoice(var SalesInvoiceHeader: Record "Sales Invoice Header"; var SalesHeader: Record "Sales Header"): Cancels the posted sales invoice and creates a new sales invoice as a copy for correction.
  • TestCorrectInvoiceIsAllowed(var SalesInvoiceHeader: Record "Sales Invoice Header"; Cancelling: Boolean): Tests whether the posted sales invoice can be corrected or canceled by checking payment status, customer blocks, and other conditions.
  • FindItemLedgEntries(var ItemLedgEntry: Record "Item Ledger Entry"; InvNo: Code[20]): Finds all item ledger entries associated with the specified posted sales invoice.
  • ErrorHelperHeader(HeaderErrorType: Enum "Correct Sales Inv. Error Type"; SalesInvoiceHeader: Record "Sales Invoice Header") Δ BC26: Raises an error message based on the header error type encountered during invoice correction validation.
  • UpdateSalesOrderLineIfExist(SalesCreditMemoNo: Code[20]) (internal): Updates the related sales order lines when a credit memo exists for the specified credit memo number.

Plus 45 local procedures.

Triggers

OnRun

Relations

Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an Object::"Name" argument. Interface dispatch and calls through events are not counted, so the list is not complete.

Called by

Recent changes

Countries that replace it

AU, NZ

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: bcatlas_resolve_node(object_type: "codeunit", object_name: "Correct Posted Sales Invoice"), then bcatlas_get_procedure_body or bcatlas_get_neighbors on the returned id.

Evidence 1 sources