---
id: object/codeunit/5987
type: object
title: Codeunit 5987 "Serv-Posting Journals Mgt."
summary: Codeunit 5987 "Serv-Posting Journals Mgt." in Base Application (Microsoft.Service.Posting). 25 public procedures, 13 events, 1 event subscribers. Present since at least BC23, still in BC30, changed in BC24, BC26-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: a1d1d296cf1c864e425d702172c9994831cb8f073b25a81ccf7713d427528071
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Service/Posting/ServPostingJournalsMgt.Codeunit.al
    title: src/Layers/W1/BaseApp/Service/Posting/ServPostingJournalsMgt.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations:
    - localization/ca
    - localization/mx
    - localization/us
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/11798
object_type: codeunit
object_id: 5987
name: Serv-Posting Journals Mgt.
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"
  - "26"
  - "27"
  - "28"
  - "29"
source_major: "29"
obsolete: null
countries:
  - ca
  - mx
  - us
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 45
  events: 13
  subscribers: 1
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 3
  calls: 9
  called_by: 1
  implements: 0
---

# Codeunit 5987 "Serv-Posting Journals Mgt."

> Codeunit 5987 "Serv-Posting Journals Mgt." in Base Application (Microsoft.Service.Posting). 25 public procedures, 13 events, 1 event subscribers. Present since at least BC23, still in BC30, changed in BC24, BC26-29.

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

## Events published

- `OnAfterTransferValuesToJobJnlLine(var JobJournalLine: Record "Job Journal Line"; ServiceLine: Record "Service Line")` (integration)
  - subscribers: [Codeunit 6285 "Sust. Service Subscriber"](../codeunit/6285.md) OnAfterTransferValuesToJobJnlLine
- `OnBeforePostItemJnlLine(var ItemJournalLine: Record "Item Journal Line"; ServiceShipmentHeader: Record "Service Shipment Header"; ServiceLine: Record "Service Line"; GenJnlLineDocNo: Code[20]; QtyToBeShipped: Decimal; QtyToBeShippedBase: Decimal; QtyToBeInvoiced: Decimal; QtyToBeInvoicedBase: Decimal)` (integration)
  - subscribers: [Codeunit 6285 "Sust. Service Subscriber"](../codeunit/6285.md) OnBeforePostItemJnlLine
- `OnBeforePostJobJnlLine(var ServiceHeader: Record "Service Header"; var ServiceLine: Record "Service Line"; QtyToBeConsumed: Decimal; var Result: Boolean; var IsHandled: Boolean)` (integration)
- `OnBeforeResJnlPostLine(var ResJnlLine: Record "Res. Journal Line"; ServiceHeader: Record "Service Header"; ServiceLine: Record "Service Line")` (integration)
  - subscribers: [Codeunit 6285 "Sust. Service Subscriber"](../codeunit/6285.md) OnBeforeResJnlPostLine
- `OnPostItemJnlLineOnBeforeCreateWhseJnlLine(var ItemJournalLine: Record "Item Journal Line"; ServiceHeader: Record "Service Header"; var ShouldCreateWhseJnlLine: Boolean; ServiceShipmentHeader: Record "Service Shipment Header"; var ServiceLine: Record "Service Line"; var TempWarehouseJournalLine: Record "Warehouse Journal Line" temporary; var WhsePosting: Boolean; var CheckApplFromItemEntry: Boolean)` (integration)
- `OnPostJobJnlLineOnBeforeCalcCurrencyFactor(ServLine: Record "Service Line"; var CurrExchRate: Record "Currency Exchange Rate")` (integration)
- `OnPostJobJnlLineOnBeforeValidateNo(var JobJournalLine: Record "Job Journal Line"; ServiceLine: Record "Service Line")` (integration)
- `OnPostResJnlLineOnAfterResJnlLineInit(var ResJnlLine: Record "Res. Journal Line"; EntryType: Enum "Res. Journal Line Entry Type"; Qty: Decimal)` (integration)
- `OnAfterPostItemJnlLine(ServiceHeader: Record "Service Header"; var ItemJournalLine: Record "Item Journal Line"; var TempHandlingTrackingSpecification: Record "Tracking Specification")` (integration)
- `OnAfterPostResJnlLine(ServiceHeader: Record "Service Header"; var ResJournalLine: Record "Res. Journal Line")` (integration)
- `OnBeforePostResJnlLineShip(var ServiceLine: Record "Service Line"; DocNo: Code[20]; ExtDocNo: Code[35]; var IsHandled: Boolean)` (integration)
- `OnBeforePostResJnlLineConsume(var ServiceLine: Record "Service Line"; var ServiceShipmentHeader: Record "Service Shipment Header"; var IsHandled: Boolean)` (integration)
- `OnPostSalesTaxLines(var ServHeader: Record "Service Header"; var TotalServiceLineLCY: Record "Service Line"; InvoicePostingParameters: Record "Invoice Posting Parameters"; var GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line"; Invoice: Boolean)` (internal)

## Event subscriptions

- SkipSalesExtDocNoCheckForService subscribes to Codeunit "Gen. Jnl.-Post Line" OnBeforeCheckSalesExtDocNo

## Procedures

- `Initialize(var TempServHeader: Record "Service Header"; TmpConsume: Boolean; TmpInvoice: Boolean)`
- `Finalize()`
- `SetPostingOptions(PassedConsume: Boolean; PassedInvoice: Boolean)`
- `SetItemJnlRollRndg(PassedItemJnlRollRndg: Boolean)`
- `SetGenJnlLineDocNos(DocNo: Code[20]; ExtDocNo: Code[35])`
- `PostItemJnlLine(var ServiceLine: Record "Service Line"; QtyToBeShipped: Decimal; QtyToBeShippedBase: Decimal; QtyToBeConsumed: Decimal; QtyToBeConsumedBase: Decimal; QtyToBeInvoiced: Decimal; QtyToBeInvoicedBase: Decimal; ItemLedgShptEntryNo: Integer; var TrackingSpecification: Record "Tracking Specification"; var TempTrackingSpecificationInv: Record "Tracking Specification"; var TempHandlingSpecification: Record "Tracking Specification"; var TempTrackingSpecification: Record "Tracking Specification" temporary; var ServShptHeader: Record "Service Shipment Header"; ServShptLineDocNo: Code[20]): Integer`
- `PostLines(ServiceHeader: Record "Service Header"; var InvoicePostingInterface: Interface "Invoice Posting"; var Window: Dialog; var TotalAmount: Decimal)`
- `PostSalesTaxLines(var ServHeader: Record "Service Header"; var TotalServiceLineLCY: Record "Service Line"; InvoicePostingParameters: Record "Invoice Posting Parameters")`
- `PostLedgerEntry(ServiceHeader: Record "Service Header"; var InvoicePostingInterface: Interface "Invoice Posting")`
- `PostBalancingEntry(ServiceHeader: Record "Service Header"; var InvoicePostingInterface: Interface "Invoice Posting")`
- `PostResJnlLineShip(var ServiceLine: Record "Service Line"; DocNo: Code[20]; ExtDocNo: Code[35])`
- `PostResJnlLineUndoUsage(var ServiceLine: Record "Service Line"; DocNo: Code[20]; ExtDocNo: Code[35])`
- `PostResJnlLineSale(var ServiceLine: Record "Service Line"; DocNo: Code[20]; ExtDocNo: Code[35])`
- `PostResJnlLineConsume(var ServiceLine: Record "Service Line"; var ServShptHeader: Record "Service Shipment Header")`
- `InitServiceRegister(var NextServLedgerEntryNo: Integer; var NextWarrantyLedgerEntryNo: Integer)`
- `FinishServiceRegister(var nextServEntryNo: Integer; var nextWarrantyEntryNo: Integer)`
- `InsertServLedgerEntry(var NextEntryNo: Integer; var ServiceHeader: Record "Service Header"; var ServiceLine: Record "Service Line"; var ServItemLine: Record "Service Item Line"; Qty: Decimal; DocNo: Code[20]): Integer`
- `InsertServLedgerEntrySale(var passedNextEntryNo: Integer; var ServHeader: Record "Service Header"; var ServLine: Record "Service Line"; var ServItemLine: Record "Service Item Line"; Qty: Decimal; QtyToCharge: Decimal; GenJnlLineDocNo: Code[20]; DocLineNo: Integer)`
- `CreateCreditEntry(var passedNextEntryNo: Integer; var ServHeader: Record "Service Header"; var ServLine: Record "Service Line"; GenJnlLineDocNo: Code[20])`
- `InsertWarrantyLedgerEntry(var NextWarrantyEntryNo: Integer; var ServiceHeader: Record "Service Header"; var ServiceLine: Record "Service Line"; var ServItemLine: Record "Service Item Line"; Qty: Decimal; GenJnlLineDocNo: Code[20]): Integer`
- `CalcSLEDivideAmount(Qty: Decimal; var passedServHeader: Record "Service Header"; var passedTempServLine: Record "Service Line"; var passedVATAmountLine: Record "VAT Amount Line")`
- `TestSrvCostDirectPost(ServLineNo: Code[20])`
- `TestGLAccDirectPost(ServLineNo: Code[20])`
- `CollectValueEntryRelation(var PassedValueEntryRelation: Record "Value Entry Relation"; RowId: Text[100])`
- `PostJobJnlLine(var ServHeader: Record "Service Header"; ServLine: Record "Service Line"; QtyToBeConsumed: Decimal): Boolean`

Plus 6 local procedures.

## Triggers

OnRun

## 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 5912 "ServLedgEntries-Post"](../codeunit/5912.md) (7 calls: `CalcSLEDivideAmount → CalcDivideAmount`, `CreateCreditEntry → CreateCreditEntry`, `FinishServiceRegister → FinishServiceRegister`, …)
- [Codeunit 5985 "Serv-Item Tracking Rsrv. Mgt."](../codeunit/5985.md) (4 calls: `PostItemJnlLine → InsertTempHandlngSpecification`, `PostItemJnlLine → TransferReservToItemJnlLine`, `PostItemJnlLine → TransServLineToItemJnlLine`, …)
- [Codeunit 6451 "Serv. Time Sheet Mgt."](../codeunit/6451.md) (4 calls: `PostResJnlLineConsume → CheckServiceLine`, `PostResJnlLineConsume → CreateTSLineFromServiceLine`, `PostResJnlLineShip → CheckServiceLine`, …)
- [Codeunit 22 "Item Jnl.-Post Line"](../codeunit/22.md) (3 calls: `PostItemJnlLine → CollectTrackingSpecification`, `PostItemJnlLine → CollectValueEntryRelation`, `PostItemJnlLine → RunWithCheck`)
- [Codeunit 7302 "WMS Management"](../codeunit/7302.md) (2 calls: `CreateWhseJnlLine → CheckAdjmtBin`, `CreateWhseJnlLine → CreateWhseJnlLine`)
- [Codeunit 1012 "Job Jnl.-Post Line"](../codeunit/1012.md) (1 call: `PostJobJnlLine → RunWithCheck`)
- [Codeunit 212 "Res. Jnl.-Post Line"](../codeunit/212.md) (1 call: `PostResJnlLine → RunWithCheck`)
- [Codeunit 5775 "Whse. Management"](../codeunit/5775.md) (1 call: `CreateWhseJnlLine → GetWhseJnlSourceDocument`)
- [Codeunit 7301 "Whse. Jnl.-Register Line"](../codeunit/7301.md) (1 call: `PostWhseJnlLines → RegisterWhseJnlLine`)

## Called by

- [Codeunit 5988 "Serv-Documents Mgt."](../codeunit/5988.md) (29 calls: `CollectValueEntryRelation → CollectValueEntryRelation`, `Finalize → Finalize`, `Initialize → Initialize`, …)

## Recent changes

- 2026-09-25 [#11798 [main] Bug 650733 External Doc No. now mandatory on Service Invoice](../../changes/bcapps/11798.md) (main, BC30, fix)

## Across versions

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

## Countries that replace it

[CA](../../localizations/ca.md), [MX](../../localizations/mx.md), [US](../../localizations/us.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: "Serv-Posting Journals Mgt.")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
