---
id: object/codeunit/2678
type: object
title: Codeunit 2678 "Sales Alloc. Acc. Mgt."
summary: Codeunit 2678 "Sales Alloc. Acc. Mgt." in Base Application (Microsoft.Finance.AllocationAccount.Sales). 6 public procedures, 3 events, 5 event subscribers. Present since at least BC23, still in BC30, changed in BC24-25, BC27.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: "27"
  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: 038978e3dc147618310038919ac39166cab30238f06da05a3ad347d46095af3f
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Finance/AllocationAccount/Sales/SalesAllocAccMgt.Codeunit.al
    title: src/Layers/W1/BaseApp/Finance/AllocationAccount/Sales/SalesAllocAccMgt.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
object_type: codeunit
object_id: 2678
name: Sales Alloc. Acc. Mgt.
namespace: Microsoft.Finance.AllocationAccount.Sales
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"
  - "27"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 37
  events: 3
  subscribers: 5
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 5
  called_by: 1
  implements: 0
---

# Codeunit 2678 "Sales Alloc. Acc. Mgt."

> Codeunit 2678 "Sales Alloc. Acc. Mgt." in Base Application (Microsoft.Finance.AllocationAccount.Sales). 6 public procedures, 3 events, 5 event subscribers. Present since at least BC23, still in BC30, changed in BC24-25, BC27.

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

## Events published

- `OnBeforeCreateSalesLine(var SalesLine: Record "Sales Line"; var AllocationLine: Record "Allocation Line"; var AllocationSalesLine: Record "Sales Line")` (integration): Integration event raised before creating sales line from allocation line during distribution process. Enables custom modification of sales line fields before standard allocation line processing.
- `OnBeforeVerifySalesLine(var SalesLine: Record "Sales Line")` (integration): Integration event raised before verifying sales line during allocation account validation. Enables custom validation logic for sales lines before standard allocation verification.
- `OnLoadManualAllocationLinesOnBeforeInsertAllocationLine(var AllocAccManualOverride: Record "Alloc. Acc. Manual Override"; var AllocationLine: Record "Allocation Line")` (integration)

## Event subscriptions

- HandlePostDocument subscribes to Codeunit "Sales-Post" OnBeforePostSalesDoc
- HandleShowDimensions subscribes to Table "Sales Line" OnBeforeShowDimensions
- HandleAfterCheckSalesApprovalPossible subscribes to Codeunit "Approvals Mgmt." OnAfterCheckSalesApprovalPossible
- CheckBeforeModifyLine subscribes to Table "Sales Line" OnBeforeModifyEvent
- HandleValidateLineNo subscribes to Table "Sales Line" OnBeforeValidateNo

## Procedures

- `GetOrGenerateAllocationLines(var AllocationLine: Record "Allocation Line"; var ParentSystemId: Guid)` (internal)
- `GetOrGenerateAllocationLines(var AllocationLine: Record "Allocation Line"; var ParentSystemId: Guid; var AmountToAllocate: Decimal; var PostingDate: Date)` (internal)
- `LoadManualAllocationLines(var SalesLine: Record "Sales Line"; var AllocationLine: Record "Allocation Line")` (internal)
- `CreateLinesFromAllocationAccountLine(var AllocationAccountSalesLine: Record "Sales Line")`: Creates individual sales lines from allocation account distribution lines based on allocation percentages or amounts. Processes allocation account configuration and generates corresponding G/L account lines with calculated amounts.
- `VerifyAllocationAccount(var AllocationAccount: Record "Allocation Account")` (internal)
- `VerifySelectedAllocationAccountNo(var SalesLine: Record "Sales Line")`: Validates the selected allocation account number on sales line and verifies compatibility. Ensures the allocation account is properly configured and the sales line uses G/L account type.

Plus 23 local procedures.

## 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 2675 "Allocation Account Mgt."](../codeunit/2675.md) (3 calls: `GetAmount → GetCurrencyRoundingPrecision`, `GetUnitPrice → GetCurrencyUnitAmountPrecision`, `VerifySalesLine → VerifyNoInheritFromParentUsed`)
- [Codeunit 2674 "Alloc. Acc. Handle Doc. Post"](../codeunit/2674.md) (2 calls: `CreateSalesLine → SetVATBusPostingGroupCode`, `CreateSalesLine → SetVATProdPostingGroupCode`)
- [Codeunit 408 "DimensionManagement"](../codeunit/408.md) (2 calls: `TransferDimensionSetID → GetCombinedDimensionSetID`, `TransferDimensionSetID → UpdateGlobalDimFromDimSetID`)
- [Codeunit 1720 "Deferral Utilities"](../codeunit/1720.md) (1 call: `CopyDeferralSchedule → CreateCopyOfDeferralSchedule`)
- [Codeunit 2676 "Alloc. Acc. Telemetry"](../codeunit/2676.md) (1 call: `HandlePostDocument → LogSalesInvoicePostingUsage`)

## Called by

- [Table 2672 "Allocation Line"](../table/2672.md) (1 call: `GetOrGenerateAllocationLines → GetOrGenerateAllocationLines`)

## Across versions

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

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: "Sales Alloc. Acc. Mgt.")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
