---
id: object/codeunit/5980
type: object
title: Codeunit 5980 "Service-Post"
summary: Codeunit 5980 "Service-Post" in Base Application (Microsoft.Service.Posting). 11 public procedures, 31 events. Present since at least BC23, still in BC30, changed in BC24, BC27-29.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: "29"
  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: 3e6516bf6b78bf17dab3076333a351a81ab3be15e6928791dfc6f1795ad3aaba
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Service/Posting/ServicePost.Codeunit.al
    title: src/Layers/W1/BaseApp/Service/Posting/ServicePost.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations:
    - localization/it
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/9778
object_type: codeunit
object_id: 5980
name: Service-Post
namespace: Microsoft.Service.Posting
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "24"
  - "27"
  - "28"
  - "29"
source_major: "29"
obsolete: null
countries:
  - it
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 56
  events: 31
  subscribers: 0
relations:
  out: 1
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 8
  calls: 10
  called_by: 8
  implements: 0
---

# Codeunit 5980 "Service-Post"

> Codeunit 5980 "Service-Post" in Base Application (Microsoft.Service.Posting). 11 public procedures, 31 events. Present since at least BC23, still in BC30, changed in BC24, BC27-29.

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

## Properties

| Property | Value |
|---|---|
| TableNo | Service Header |
| Permissions | TableData "Service Header" = rimd, TableData "Service Item Line" = rimd, TableData "Service Line" = rimd, TableData "Service Shipment Item Line" = rimd, TableData "Service Shipment Header" = rimd, TableData "Service Shipment Line" = rimd, TableData "Service Invoice Header" = rimd, TableData "Service... |

## Events published

- `OnAfterFinalizePostingOnBeforeCommit(var ServiceHeader: Record "Service Header"; var ServiceLine: Record "Service Line"; var ServDocumentsMgt: Codeunit "Serv-Documents Mgt."; var PassedShip: Boolean; var PassedConsume: Boolean; var PassedInvoice: Boolean; ServInvoiceNo: Code[20]; ServCrMemoNo: Code[20]; ServShipmentNo: Code[20])` (integration)
- `OnAfterInitialize(var ServiceHeader: Record "Service Header"; var ServiceLine: Record "Service Line")` (integration)
  - subscribers: [Codeunit 6103 "E-Document Subscribers"](../codeunit/6103.md) OnAfterInitializeService
- `OnAfterPostServiceDoc(var ServiceHeader: Record "Service Header"; ServShipmentNo: Code[20]; ServInvoiceNo: Code[20]; ServCrMemoNo: Code[20]; var ServDocumentsMgt: Codeunit "Serv-Documents Mgt."; CommitIsSuppressed: Boolean; PassedShip: Boolean; PassedConsume: Boolean; PassedInvoice: Boolean; WhseShip: Boolean; Invoice: Boolean)` (integration)
  - subscribers: [Codeunit 5579 "Digital Voucher Impl."](../codeunit/5579.md) CheckServiceVoucherOnAfterPostServiceDoc, [Codeunit 6103 "E-Document Subscribers"](../codeunit/6103.md) OnAfterPostServiceDoc
- `OnAfterPostWithLines(var PassedServiceHeader: Record "Service Header"; var IsHandled: Boolean)` (integration)
  - subscribers: [Codeunit 6460 "Serv. Notification Mgt."](../codeunit/6460.md) OnAfterServicePost
- `OnAfterValidatePostingAndDocumentDate(var ServiceHeader: Record "Service Header"; PreviewMode: Boolean)` (integration)
- `OnValidatePostingAndDocumentDateOnAfterValidateDocumentDate(var ServiceHeader: Record "Service Header")` (integration)
- `OnBeforeCheckAndSetPostingConstants(var ServiceHeader: Record "Service Header"; var ServDocumentsMgt: Codeunit "Serv-Documents Mgt."; var PassedShip: Boolean; var PassedConsume: Boolean; var PassedInvoice: Boolean; var IsHandled: Boolean)` (integration)
- `OnBeforeCreatePostedWhseShptHeader(var PostedWhseShipmentHeader: Record "Posted Whse. Shipment Header"; WarehouseShipmentHeader: Record "Warehouse Shipment Header"; ServiceHeader: Record "Service Header")` (integration)
- `OnBeforeInitialize(var PassedServiceHeader: Record "Service Header"; var PassedServiceLine: Record "Service Line"; var PassedShip: Boolean; var PassedConsume: Boolean; var PassedInvoice: Boolean; PreviewMode: Boolean)` (integration)
- `OnBeforePostWithLines(var PassedServHeader: Record "Service Header"; var PassedServLine: Record "Service Line"; var PassedShip: Boolean; var PassedConsume: Boolean; var PassedInvoice: Boolean; var PostingDateExists: Boolean; var HideValidationDialog: Boolean; var IsHandled: Boolean; PreviewMode: Boolean; ReplacePostingDate: Boolean; PostingDate: Date; ReplaceDocumentDate: Boolean; SuppressCommit: Boolean)` (integration)
  - subscribers: [Codeunit 20339 "Service Posting Subscribers"](../codeunit/20339.md) OnBeforePostServiceDoc, [Codeunit 6460 "Serv. Notification Mgt."](../codeunit/6460.md) OnBeforeServicePost
- `OnBeforeRun(var ServiceHeader: Record "Service Header")` (integration)
- `OnBeforeSetPostingDate(var PostingDateExists: Boolean; var ReplacePostingDate: Boolean; var ReplaceDocumentDate: Boolean; var PostingDate: Date; var IsHandled: Boolean)` (integration)
- `OnBeforeServiceShptHeaderInsert(var ServiceShipmentHeader: Record "Service Shipment Header"; ServiceHeader: Record "Service Header")` (integration)
- `OnBeforeServiceInvHeaderInsert(var ServiceInvoiceHeader: Record "Service Invoice Header"; ServiceHeader: Record "Service Header")` (integration)
- `OnBeforeServiceCrMemoHeaderInsert(var ServiceCrMemoHeader: Record "Service Cr.Memo Header"; ServiceHeader: Record "Service Header")` (integration)
- `OnBeforeTestMandatoryFields(var PassedServiceHeader: Record "Service Header"; var PassedServiceLine: Record "Service Line"; var Invoice: Boolean; var IsHandled: Boolean)` (integration)
- `OnBeforeUpdateWhseDocuments(var WarehouseShipmentHeader: Record "Warehouse Shipment Header"; var IsHandled: Boolean)` (integration)
- `OnDeleteHeaderOnBeforeServiceShptLineInsert(var ServiceHeader: Record "Service Header"; var ServiceShipmentHeader: Record "Service Shipment Header"; var ServiceShipmentLine: Record "Service Shipment Line")` (integration)
- `OnDeleteHeaderOnBeforeServiceInvLineInsert(var ServiceHeader: Record "Service Header"; var ServiceInvoiceHeader: Record "Service Invoice Header"; var ServiceInvoiceLine: Record "Service Invoice Line")` (integration)
- `OnDeleteHeaderOnBeforeServiceCrMemoLineInsert(var ServiceHeader: Record "Service Header"; var ServiceCrMemoHeader: Record "Service Cr.Memo Header"; var ServiceCrMemoLine: Record "Service Cr.Memo Line")` (integration)
- `OnLockTablesOnBeforeGLEntryFindLast(var GLEntry: Record "G/L Entry")` (integration)
- `OnTestDeleteHeaderOnAfterServiceShptHeaderTransferFields(var ServiceShipmentHeader: Record "Service Shipment Header"; ServiceHeader: Record "Service Header")` (integration)
- `OnTestDeleteHeaderOnAfterServiceInvHeaderTransferFields(var ServiceInvoiceHeader: Record "Service Invoice Header"; ServiceHeader: Record "Service Header")` (integration)
- `OnTestDeleteHeaderOnAfterServiceCrMemoHeaderTransferFields(var ServiceCrMemoHeader: Record "Service Cr.Memo Header"; ServiceHeader: Record "Service Header")` (integration)
- `OnInitializeOnAfterCheckAndSetPostingConstants(var PassedServiceHeader: Record "Service Header"; var PassedServiceLine: Record "Service Line"; var PassedShip: Boolean; var PassedConsume: Boolean; var PassedInvoice: Boolean; PreviewMode: Boolean)` (integration)
  - subscribers: [Codeunit 4812 "Intrastat Report Doc. Compl."](../codeunit/4812.md) OnInitializeOnAfterCheckAndSetPostingConstants, [Codeunit 5579 "Digital Voucher Impl."](../codeunit/5579.md) OnInitializeOnAfterCheckAndSetPostingConstants
- `OnAfterDeleteHeader(var ServiceHeader: Record "Service Header"; var ServiceShipmentHeader: Record "Service Shipment Header"; var ServiceInvoiceHeader: Record "Service Invoice Header"; var ServiceCrMemoHeader: Record "Service Cr.Memo Header")` (integration)
- `OnBeforeValidatePostingAndDocumentDate(var ServiceHeader: Record "Service Header"; var PostingDateExists: Boolean; var ReplacePostingDate: Boolean; var ReplaceDocumentDate: Boolean; var PostingDate: Date)` (integration)
- `OnBeforeCheckDateNotAllowedForServiceLine(var PassedServiceLine: Record "Service Line"; var IsHandled: Boolean)` (integration)
- `OnCheckAndSetConstantsOnBeforeSetPostingOptions(var ServiceHeader: Record "Service Header"; Invoice: Boolean; Ship: Boolean)` (integration)
- `OnSetCommitBehavior(var IgnoreCommit: Boolean)` (integration)
- `OnPostDocumentLinesOnBeforeInsertPostedHeaders(var ServiceHeader: Record "Service Header"; var ServDocumentsMgt: Codeunit "Serv-Documents Mgt."; var IsHandled: Boolean; var ServInvoiceNo: Code[20]; var ServCrMemoNo: Code[20])` (integration)

## Procedures

- `PostWithLines(var PassedServHeader: Record "Service Header"; var PassedServLine: Record "Service Line"; var PassedShip: Boolean; var PassedConsume: Boolean; var PassedInvoice: Boolean)`
- `CheckServiceDocument(var PassedServiceHeader: Record "Service Header"; var PassedServiceLine: Record "Service Line")`
- `SetPostingDate(NewReplacePostingDate: Boolean; NewReplaceDocumentDate: Boolean; NewPostingDate: Date)`
- `SetPostingOptions(PassedShip: Boolean; PassedConsume: Boolean; PassedInvoice: Boolean)`
- `SetHideValidationDialog(NewHideValidationDialog: Boolean)`
- `SetSuppressCommit(NewSuppressCommit: Boolean)`
- `TestDeleteHeader(ServiceHeader: Record "Service Header"; var ServiceShptHeader: Record "Service Shipment Header"; var ServiceInvHeader: Record "Service Invoice Header"; var ServiceCrMemoHeader: Record "Service Cr.Memo Header")`
- `DeleteHeader(ServiceHeader: Record "Service Header"; var ServiceShptHeader: Record "Service Shipment Header"; var ServiceInvHeader: Record "Service Invoice Header"; var ServiceCrMemoHeader: Record "Service Cr.Memo Header")`
- `SetPreviewMode(NewPreviewMode: Boolean)`
- `GetPostedDocumentRecord(ServiceHeader: Record "Service Header"; var PostedServiceDocumentVariant: Variant)`
- `SendPostedDocumentRecord(ServiceHeader: Record "Service Header"; var DocumentSendingProfile: Record "Document Sending Profile")`

Plus 14 local procedures.

## Triggers

OnRun

## Relations

- runs on [Table 5900 "Service Header"](../table/5900.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 5988 "Serv-Documents Mgt."](../codeunit/5988.md) (18 calls: `CheckAndSetPostingConstants → CheckAndSetPostingConstants`, `CheckServiceDocument → CheckServiceDocument`, `Finalize → Finalize`, …)
- [Codeunit 11 "Gen. Jnl.-Check Line"](../codeunit/11.md) (3 calls: `CheckDateNotAllowedForServiceLine → DateNotAllowed`, `TestMandatoryFields → DateNotAllowed`, `TestServLinePostingDate → DateNotAllowed`)
- [Codeunit 5763 "Whse.-Post Shipment"](../codeunit/5763.md) (3 calls: `PostDocumentLines → CreatePostedShptHeader`, `PostDocumentLines → CreatePostedShptLine`, `UpdateWhseDocuments → PostUpdateWhseDocuments`)
- [Codeunit 19 "Gen. Jnl.-Post Preview"](../codeunit/19.md) (1 call: `PostDocumentLines → ThrowError`)
- [Codeunit 410 "Update Analysis View"](../codeunit/410.md) (1 call: `PostWithLines → UpdateAll`)
- [Codeunit 5770 "Whse.-Service Release"](../codeunit/5770.md) (1 call: `PostWithLines → Release`)
- [Codeunit 6041 "Service Document Archive Mgmt."](../codeunit/6041.md) (1 call: `PostDocumentLines → AutoArchiveServiceDocument`)
- [Codeunit 6463 "Serv. Report Distribution Mgt."](../codeunit/6463.md) (1 call: `CheckServiceDocument → RunDefaultCheckServiceElectronicDocument`)
- [Codeunit 7150 "Update Item Analysis View"](../codeunit/7150.md) (1 call: `PostWithLines → UpdateAll`)
- [Codeunit 9070 "Document Errors Mgt."](../codeunit/9070.md) (1 call: `CheckAndSetPostingConstants → GetNothingToPostErrorMsg`)

## Called by

- [Report 6001 "Batch Post Service Orders"](../report/6001.md) (4 calls: `PostServiceHeader → (object)`, `PostServiceHeader → SetHideValidationDialog`, `PostServiceHeader → SetPostingDate`, …)
- [Codeunit 5749 "Serv. Whse Post-Shipment"](../codeunit/5749.md) (3 calls: `OnPostSourceDocument → (object)`, `OnPostSourceDocument → SetPostingOptions`, `OnPostSourceDocument → SetSuppressCommit`)
- [Codeunit 5979 "Service-Post and Send"](../codeunit/5979.md) (2 calls: `Code → (object)`, `Code → SendPostedDocumentRecord`)
- [Codeunit 5981 "Service-Post (Yes/No)"](../codeunit/5981.md) (2 calls: `Code → PostWithLines`, `Code → SetPreviewMode`)
- [Table 5900 "Service Header"](../table/5900.md) (2 calls: `ConfirmDeletion → TestDeleteHeader`, `OnDelete → DeleteHeader`)
- [Codeunit 5982 "Service-Post+Print"](../codeunit/5982.md) (1 call: `Code → PostWithLines`)
- [Codeunit 9065 "Check Service Document"](../codeunit/9065.md) (1 call: `RunCheck → CheckServiceDocument`)
- [Report 9091 "Combine Service Shipments"](../report/9091.md) (1 call: `FinalizeServiceInvHeader → (object)`)

## Recent changes

- 2026-09-01 [#9778 [Extensibility Request] issue 30362: add OnPostDocumentLinesOnBeforeInsertPostedHeaders event to Service-Post](../../changes/bcapps/9778.md) (main, BC30, feature)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC24, BC27-29

## Countries that replace it

[IT](../../localizations/it.md)

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: "Service-Post")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
