---
id: object/codeunit/5815
type: object
title: Codeunit 5815 "Undo Sales Shipment Line"
summary: Codeunit 5815 "Undo Sales Shipment Line" in Base Application (Microsoft.Sales.History). 7 public procedures, 35 events, 1 event subscribers. Present since at least BC23, still in BC30, changed in BC24-28.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: "28"
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: cb727c440afabb08650b2a7907433345495e3b2a9210338ac53bbf2fbf5374ba
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Sales/History/UndoSalesShipmentLine.Codeunit.al
    title: src/Layers/W1/BaseApp/Sales/History/UndoSalesShipmentLine.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/11367
    - change/bcapps/11274
    - change/bcapps/10290
    - change/bcapps/10165
    - change/bcapps/10005
object_type: codeunit
object_id: 5815
name: Undo Sales Shipment Line
namespace: Microsoft.Sales.History
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 64
  events: 35
  subscribers: 1
relations:
  out: 1
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 6
  calls: 8
  called_by: 2
  implements: 0
---

# Codeunit 5815 "Undo Sales Shipment Line"

> Codeunit 5815 "Undo Sales Shipment Line" in Base Application (Microsoft.Sales.History). 7 public procedures, 35 events, 1 event subscribers. Present since at least BC23, still in BC30, changed in BC24-28.

Base Application · Microsoft.Sales.History · BC23-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Sales/History/UndoSalesShipmentLine.Codeunit.al) · facts from BC29

## Properties

| Property | Value |
|---|---|
| TableNo | Sales Shipment Line |
| Permissions | TableData "Sales Line" = rimd, TableData "Sales Shipment Line" = rimd, TableData "Item Application Entry" = rmd, TableData "Item Entry Relation" = ri |

## Events published

- `OnAfterCode(var SalesShipmentLine: Record "Sales Shipment Line")` (integration): Raised after the undo sales shipment line process is completed.
  - subscribers: [Codeunit 1351 "Telemetry Subscribers"](../codeunit/1351.md) SendTraceUndoSalesShipmentNoOfLines
- `OnAfterCopyItemJnlLineFromSalesShpt(var ItemJournalLine: Record "Item Journal Line"; SalesShipmentHeader: Record "Sales Shipment Header"; SalesShipmentLine: Record "Sales Shipment Line"; var TempWhseJnlLine: Record "Warehouse Journal Line" temporary; var WhseUndoQty: Codeunit "Whse. Undo Quantity"; var ItemLedgEntryNo: Integer; var NextLineNo: Integer; var TempGlobalItemLedgerEntry: Record "Item Ledger Entry" temporary; var TempGlobalItemEntryRelation: Record "Item Entry Relation" temporary; var IsHandled: Boolean)` (integration): Raised after copying the item journal line from the sales shipment during the undo process.
- `OnAfterCheckSalesShptLine(var SalesShptLine: Record "Sales Shipment Line"; var TempItemLedgEntry: Record "Item Ledger Entry" temporary)` (integration): Raised after validating that the sales shipment line can be undone.
- `OnAfterNewSalesShptLineInsert(var NewSalesShipmentLine: Record "Sales Shipment Line"; OldSalesShipmentLine: Record "Sales Shipment Line")` (integration): Raised after inserting a new correction sales shipment line during the undo process.
- `OnAfterSalesShptLineModify(var SalesShptLine: Record "Sales Shipment Line"; DocLineNo: Integer; HideDialog: Boolean)` (integration): Raised after modifying the original sales shipment line during the undo process.
- `OnAfterGetCorrectionLineNo(SalesShipmentLine: Record "Sales Shipment Line"; var Result: Integer)` (integration): Raised after calculating the correction line number for the undo shipment line.
- `OnAfterUpdateSalesLine(var SalesLine: Record "Sales Line"; var SalesShptLine: Record "Sales Shipment Line")` (integration): Raised after updating the related sales order line during the undo shipment process.
- `OnBeforeBlanketOrderInitOutstanding(var BlanketOrderSalesLine: Record "Sales Line"; SalesShipmentLine: Record "Sales Shipment Line")` (integration): Raised before initializing outstanding quantities on the blanket order line during undo.
- `OnBeforeGetCorrectionLineNo(SalesShipmentLine: Record "Sales Shipment Line"; var Result: Integer; var IsHandled: Boolean)` (integration): Raised before calculating the correction line number for the undo shipment line.
- `OnBeforeCheckSalesShptLine(var SalesShipmentLine: Record "Sales Shipment Line"; var IsHandled: Boolean; var SkipTestFields: Boolean; var SkipUndoPosting: Boolean; var SkipUndoInitPostATO: Boolean)` (integration): Raised before validating that the sales shipment line can be undone.
- `OnAfterInsertNewShipmentLine(var SalesShipmentLine: Record "Sales Shipment Line"; var PostedWhseShipmentLine: Record "Posted Whse. Shipment Line"; var PostedWhseShptLineFound: Boolean; DocLineNo: Integer; ItemShptEntryNo: Integer)` (integration): Raised after inserting a new correction shipment line during the undo process.
- `OnBeforeOnRun(var SalesShipmentLine: Record "Sales Shipment Line"; var IsHandled: Boolean; var SkipTypeCheck: Boolean; var HideDialog: Boolean)` (integration): Raised before the undo sales shipment line process begins.
- `OnBeforeNewSalesShptLineInsert(var NewSalesShipmentLine: Record "Sales Shipment Line"; OldSalesShipmentLine: Record "Sales Shipment Line")` (integration): Raised before inserting a new correction sales shipment line during the undo process.
  - subscribers: [Codeunit 6253 "Sust. Sales Subscriber"](../codeunit/6253.md) OnBeforeNewSalesShptLineInsert
- `OnBeforePostItemJnlLine(var SalesShipmentLine: Record "Sales Shipment Line"; var DocLineNo: Integer; var ItemLedgEntryNo: Integer; var IsHandled: Boolean; var TempGlobalItemLedgEntry: Record "Item Ledger Entry" temporary; var TempGlobalItemEntryRelation: Record "Item Entry Relation" temporary; var TempWhseJnlLine: Record "Warehouse Journal Line" temporary; var NextLineNo: Integer)` (integration): Raised before posting the item journal line during the undo shipment process.
- `OnBeforeSalesShptLineModify(var SalesShptLine: Record "Sales Shipment Line")` (integration): Raised before modifying the original sales shipment line during the undo process.
- `OnBeforeUpdateBlanketOrder(var SalesShptLine: Record "Sales Shipment Line"; var IsHandled: Boolean)` (integration): Raised before updating the blanket order line during the undo shipment process.
- `OnBeforeUpdateOrderLine(var SalesShptLine: Record "Sales Shipment Line"; var IsHandled: Boolean; var TempGlobalItemLedgEntry: Record "Item Ledger Entry" temporary)` (integration): Raised before updating the sales order line during the undo shipment process.
- `OnCodeOnBeforeUndoLoop(var SalesShptLine: Record "Sales Shipment Line")` (integration): Raised before starting the undo loop for each sales shipment line.
- `OnCodeOnAfterSalesShptLineSetFilters(var SalesShptLine: Record "Sales Shipment Line"; HideDialog: Boolean)` (integration): Raised after setting filters on the sales shipment lines to process.
- `OnPostItemJnlLineOnAfterInsertTempWhseJnlLine(SalesShptLine: Record "Sales Shipment Line"; var ItemJnlLine: Record "Item Journal Line"; var TempWhseJnlLine: Record "Warehouse Journal Line" temporary; var NextLineNo: Integer)` (integration): Raised after inserting a temporary warehouse journal line during item journal posting.
- `OnPostItemJnlLineOnAfterRunItemJnlPostLine(var ItemJnlLine: Record "Item Journal Line"; var SalesShipmentLine: Record "Sales Shipment Line"; var SalesShipmentHeader: Record "Sales Shipment Header"; var ItemJnlPostLine: Codeunit "Item Jnl.-Post Line")` (integration): Raised after running the item journal post line during the undo shipment process.
- `OnPostItemJnlLineOnBeforeRunItemJnlPostLine(var ItemJnlLine: Record "Item Journal Line"; ItemLedgEntryNotInvoiced: Record "Item Ledger Entry"; SalesShptLine: Record "Sales Shipment Line"; SalesShptHeader: Record "Sales Shipment Header"; var IsHandled: Boolean)` (integration): Raised before running the item journal post line during the undo shipment process.
  - subscribers: [Codeunit 6253 "Sust. Sales Subscriber"](../codeunit/6253.md) OnPostItemJnlLineOnBeforeRunItemJnlPostLine
- `OnUpdateOrderLineOnBeforeUpdateSalesLine(var SalesShipmentLine: Record "Sales Shipment Line"; var SalesLine: Record "Sales Line")` (integration): Raised before updating the sales order line quantities during the undo process.
- `OnAfterIsSalesInvoiceCancelled(var SalesInvoiceHeader: Record "Sales Invoice Header"; var Result: Boolean)` (integration): Raised after determining whether the related sales invoice was cancelled.
- `OnCheckSalesShptLineOnBeforeCollectItemLedgEntries(SalesShptLine: Record "Sales Shipment Line"; var TempItemLedgEntry: Record "Item Ledger Entry" temporary; var IsHandled: Boolean)` (integration): Raised before collecting item ledger entries during shipment line validation.
- `OnCheckSalesShptLineOnBeforeHasInvoicedNotReturnedQuantity(SalesShptLine: Record "Sales Shipment Line"; var IsHandled: Boolean)` (integration): Raised before checking whether the line has invoiced but not returned quantity.
- `OnSynchronizeATOOnBeforeModify(var SalesLine: Record "Sales Line")` (integration): Raised before modifying the sales line during assemble-to-order synchronization.
- `OnAfterPostItemJnlLine(var ItemJournalLine: Record "Item Journal Line"; var SalesShipmentLine: Record "Sales Shipment Line")` (integration): Raised after posting the item journal line during the undo shipment process.
- `OnItemJnlPostLineOnAfterGetInvoicedShptEntriesOnBeforeExit(var ItemJournalLine: Record "Item Journal Line"; var SalesShipmentLine: Record "Sales Shipment Line")` (integration): Raised after processing invoiced shipment entries before exiting the posting routine.
- `OnPostItemJnlLineOnAfterCalcRemQtyBase(var RemQtyBase: Decimal; var ItemJournalLine: Record "Item Journal Line"; var SalesShipmentLine: Record "Sales Shipment Line"; var ItemLedgerEntryNotInvoiced: Record "Item Ledger Entry")` (integration): Raised after calculating the remaining base quantity during item journal posting.
- `OnGetInvoicedShptEntriesOnAfterSetFilters(var ItemLedgerEntry: Record "Item Ledger Entry"; SalesShipmentLine: Record "Sales Shipment Line")` (integration): Raised after setting filters to retrieve invoiced shipment entries.
- `OnCodeOnBeforeProcessItemShptEntry(var ItemShptEntryNo: Integer; var DocLineNo: Integer; var SalesShipmentLine: Record "Sales Shipment Line"; var IsHandled: Boolean)` (integration): Raised before processing item shipment entries during the undo process.
  - subscribers: [Codeunit 8069 "Sales Subscription Line Mgmt."](../codeunit/8069.md) RemoveQuantityInvoicedForServiceCommitmentItems
- `OnAfterCheckSalesShipmentLines(var SalesShipmentLine: Record "Sales Shipment Line"; var UndoSalesShptLineParams: Record "Undo Sales Shpt. Line Params")` (integration): Raised after validating all sales shipment lines before starting the undo process.
  - subscribers: [Codeunit 6488 "Serv. Undo Sales Shipment Line"](../codeunit/6488.md) OnAfterCheckSalesShipmentLines
- `OnBeforeDeleteRelatedItems(var SalesShipmentLine: Record "Sales Shipment Line"; UndoSalesShptLineParams: Record "Undo Sales Shpt. Line Params")` (integration): Raised before deleting related items during the undo shipment process.
  - subscribers: [Codeunit 6488 "Serv. Undo Sales Shipment Line"](../codeunit/6488.md) OnBeforeDeleteRelatedItems
- `OnUnApplyDropShipmentOnBeforeFindItemApplicationEntry(var ItemApplicationEntry: Record "Item Application Entry"; ItemLedgerEntry: Record "Item Ledger Entry")` (integration): Raised before finding the item application entry for a drop shipment being unapplied.

## Event subscriptions

- OnSetItemAdjmtPropertiesOnBeforeCheckModifyItem subscribes to Codeunit "Item Jnl.-Post Line" OnSetItemAdjmtPropertiesOnBeforeCheckModifyItem

## Procedures

- `SetHideDialog(NewHideDialog: Boolean)`: Sets whether the confirmation dialog should be hidden when undoing sales shipment lines.
- `SetParameters(var NewUndoSalesShptLineParams: Record "Undo Sales Shpt. Line Params")`: Sets the parameters for the undo sales shipment line operation.
- `GetCorrectionLineNo(SalesShipmentLine2: Record "Sales Shipment Line"): Integer`: Gets the line number to use for the correction line when undoing a sales shipment line.
- `UpdateOrderLine(SalesShipmentLine2: Record "Sales Shipment Line")`: Updates the related sales order line after undoing a sales shipment line.
- `UpdateBlanketOrder(SalesShipmentLine2: Record "Sales Shipment Line")`: Updates the related blanket sales order line after undoing a sales shipment line.
- `GetInvoicedShptEntries(SalesShipmentLine2: Record "Sales Shipment Line"; var ItemLedgerEntry: Record "Item Ledger Entry"): Boolean`: Gets the item ledger entries for shipments that have been invoiced but not completely invoiced.
- `SetCalledFromUndoPurchaseReceiptLine(NewCalledFromPurchRcptLine: Boolean)`

Plus 21 local procedures.

## Triggers

OnRun

## Relations

- runs on [Table 111 "Sales Shipment Line"](../table/111.md)

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

- [Codeunit 5817 "Undo Posting Management"](../codeunit/5817.md) (7 calls: `CheckSalesShptLine → CheckItemLedgEntries`, `CheckSalesShptLine → CollectItemLedgEntries`, `CheckSalesShptLine → TestSalesShptLine`, …)
- [Codeunit 7320 "Whse. Undo Quantity"](../codeunit/7320.md) (5 calls: `Code → FindPostedWhseShptLine`, `Code → PostTempWhseJnlLineCache`, `Code → UndoPostedWhseShptLine`, …)
- [Codeunit 900 "Assembly-Post"](../codeunit/900.md) (4 calls: `UndoFinalizePostATO → UndoFinalizePostATO`, `UndoInitPostATO → UndoInitPostATO`, `UndoPostATO → UndoPostATO`, …)
- [Codeunit 5813 "Undo Purchase Receipt Line"](../codeunit/5813.md) (3 calls: `UndoPurchaseReceiptLineForDropShipment → (object)`, `UndoPurchaseReceiptLineForDropShipment → IsUndoSalesShipmentLineForDropShipment`, `UndoPurchaseReceiptLineForDropShipment → SetHideDialog`)
- [Codeunit 22 "Item Jnl.-Post Line"](../codeunit/22.md) (2 calls: `PostItemJnlLine → (object)`, `UnApplyDropShipment → UnApplyDropShipment`)
- [Codeunit 5894 "Inventory Adjustment Handler"](../codeunit/5894.md) (2 calls: `MakeInventoryAdjustment → MakeAutomaticInventoryAdjustment`, `MakeInventoryAdjustment → SetJobUpdateProperties`)
- [Codeunit 5402 "Unit of Measure Management"](../codeunit/5402.md) (1 call: `UpdateBlanketOrder → QtyRndPrecision`)
- [Codeunit 7150 "Update Item Analysis View"](../codeunit/7150.md) (1 call: `OnRun → UpdateAll`)

## Called by

- [Codeunit 5813 "Undo Purchase Receipt Line"](../codeunit/5813.md) (3 calls: `UndoDropShipmentPurchRcptLine → (object)`, `UndoDropShipmentPurchRcptLine → SetCalledFromUndoPurchaseReceiptLine`, `UndoDropShipmentPurchRcptLine → SetHideDialog`)
- [Page 131 "Posted Sales Shpt. Subform"](../page/131.md) (1 call: `UndoShipmentPosting → (object)`)

## Recent changes

- 2026-09-17 [#11367 [29.X][Repair Item][SaaS][Drop shipment reversal] Undo Shipment fails with blank Bin Code at bin-mandatory location](../../changes/bcapps/11367.md) (releases/29.x, BC29, fix)
- 2026-09-14 [#11274 [Master]-[Drop shipment reversal] Undo Shipment fails with blank Bin Code at bin-mandatory location](../../changes/bcapps/11274.md) (main, BC30, fix)
- 2026-08-18 [#10290 [Main] -Drop shipment undo receipt fails for service and non-inventory items.](../../changes/bcapps/10290.md) (main, BC30, fix)
- 2026-08-16 [#10165 [Extensibility Request] issue 29901: expose item application entry before find](../../changes/bcapps/10165.md) (main, BC30, feature)
- 2026-08-06 [#10005 Improve error messages when there are no quantities to reverse in shipped/received lines in Sales/Purchase/Transfer](../../changes/bcapps/10005.md) (main, BC30, fix)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC24-28

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: "Undo Sales Shipment Line")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
