---
id: object/codeunit/1371
type: object
title: Codeunit 1371 "Sales Batch Post Mgt."
summary: Codeunit 1371 "Sales Batch Post Mgt." in Base Application (Microsoft.Sales.Posting). 7 public procedures, 9 events, 8 event subscribers. Present since at least BC23, still in BC30, changed in BC25.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: "25"
  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: 3eddedc740731bc01b6f6e6881e7f3b99cec9814bf137d104815b9f637dabbd2
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Sales/Posting/SalesBatchPostMgt.Codeunit.al
    title: src/Layers/W1/BaseApp/Sales/Posting/SalesBatchPostMgt.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: 1371
name: Sales Batch Post Mgt.
namespace: Microsoft.Sales.Posting
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "25"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 36
  events: 9
  subscribers: 8
relations:
  out: 1
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 11
  called_by: 0
  implements: 0
---

# Codeunit 1371 "Sales Batch Post Mgt."

> Codeunit 1371 "Sales Batch Post Mgt." in Base Application (Microsoft.Sales.Posting). 7 public procedures, 9 events, 8 event subscribers. Present since at least BC23, still in BC30, changed in BC25.

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

## Properties

| Property | Value |
|---|---|
| TableNo | Sales Header |
| Permissions | TableData "Batch Processing Parameter" = rimd, TableData "Batch Processing Session Map" = rimd |

## Events published

- `OnAfterCanPostDocument(var SalesHeader: Record "Sales Header"; var BatchProcessingMgt: Codeunit "Batch Processing Mgt."; var Result: Boolean)` (integration): Raised after determining whether a sales document can be posted in the batch.
- `OnAfterHandleOnCustomProcessing(var RecRef: RecordRef; var SalesHeader: Record "Sales Header"; var BatchProcessingMgt: Codeunit "Batch Processing Mgt."; var Handled: Boolean; var KeepParameters: Boolean)` (integration): Raised after custom processing is handled for a sales document in the batch.
- `OnAfterPrepareSalesHeader(var SalesHeader: Record "Sales Header"; var BatchProcessingMgt: Codeunit "Batch Processing Mgt.")` (integration): Raised after preparing the sales header for batch posting.
- `OnBeforeRunBatch(var SalesHeader: Record "Sales Header"; var ReplacePostingDate: Boolean; var PostingDate: Date; var ReplaceDocumentDate: Boolean; var Ship: Boolean; var Invoice: Boolean)` (integration): Raised before running the batch posting process.
- `OnPrepareSalesHeaderOnAfterBatchConfirmUpdateDeferralDate(var SalesHeader: Record "Sales Header"; var BatchProcessingMgt: Codeunit "Batch Processing Mgt.")` (integration): Raised after updating the deferral date during sales header preparation.
- `OnRunBatchOnAfterAddParameters(var BatchProcessingMgt: Codeunit "Batch Processing Mgt."; var SalesBatchPostMgt: Codeunit "Sales Batch Post Mgt."; PostingCodeunitId: Integer)` (integration): Raised after adding batch posting parameters to the batch processor.
- `OnGetICBatchFileName(var Result: Text)` (integration): Raised to customize the intercompany batch file name.
- `OnBeforeReleaseSalesHeader(var SalesHeader: Record "Sales Header"; var Result: Boolean; var IsHandled: Boolean)` (integration): Raised before releasing the sales header during batch preparation.
- `OnBeforeRunWithUI(var SalesHeader: Record "Sales Header"; TotalCount: Integer; Question: Text; var IsHandled: Boolean)` (integration): Raised before running the batch posting with user interface.

## Event subscriptions

- PrepareSalesHeaderOnBeforeBatchProcessing subscribes to Codeunit "Batch Processing Mgt." OnBeforeBatchProcessing
- CheckSalesHeaderOnVerifyRecord subscribes to Codeunit "Batch Processing Mgt." OnVerifyRecord
- HandleOnCustomProcessing subscribes to Codeunit "Batch Processing Mgt." OnCustomProcessing
- OnIsPostWithJobQueueEnabledHandler subscribes to Codeunit "Batch Processing Mgt." OnIsPostWithJobQueueEnabled
- OnProcessBatchInBackgroundHandler subscribes to Codeunit "Batch Processing Mgt." OnProcessBatchInBackground
- OnBatchProcessOnBeforeResetBatchID subscribes to Codeunit "Batch Processing Mgt." OnBatchProcessOnBeforeResetBatchID
- OnBeforeUpdateAnalysisView subscribes to Codeunit "Update Analysis View" OnBeforeUpdateAll
- OnBeforeUpdateItemAnalysisView subscribes to Codeunit "Update Item Analysis View" OnBeforeUpdateAll

## Procedures

- `RunBatch(var SalesHeader: Record "Sales Header"; ReplacePostingDate: Boolean; PostingDate: Date; ReplaceDocumentDate: Boolean; CalcInvoiceDiscount: Boolean; Ship: Boolean; Invoice: Boolean)`: Runs batch posting of sales documents with the specified posting parameters.
- `RunWithUI(var SalesHeader: Record "Sales Header"; TotalCount: Integer; Question: Text)`: Runs batch posting with a confirmation dialog and error handling UI.
- `GetBatchProcessor(var ResultBatchProcessingMgt: Codeunit "Batch Processing Mgt.")`: Gets the batch processing management codeunit instance used for batch posting.
- `SetBatchProcessor(NewBatchProcessingMgt: Codeunit "Batch Processing Mgt.")`: Sets the batch processing management codeunit instance to be used for batch posting.
- `Code(var SalesHeader: Record "Sales Header")`: Executes the batch posting of sales documents using the configured batch processor.
- `SetPostingCodeunitId(NewPostingCodeunitId: Integer)`: Sets the codeunit ID to be used for posting each sales document in the batch.
- `SetParameter(ParameterId: Enum "Batch Posting Parameter Type"; ParameterValue: Variant)`: Sets a batch posting parameter value in the batch processor.

Plus 12 local procedures.

## Triggers

OnRun

## Relations

- runs on [Table 36 "Sales Header"](../table/36.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 1380 "Batch Processing Mgt."](../codeunit/1380.md) (9 calls: `Code → BatchProcess`, `Code → SetProcessingCodeunit`, `PrepareSalesHeader → GetBooleanParameter`, …)
- [Codeunit 28 "Error Message Management"](../codeunit/28.md) (4 calls: `PrepareBatch → LogError`, `RunWithUI → Activate`, `RunWithUI → GetLastErrorID`, …)
- [Codeunit 414 "Release Sales Document"](../codeunit/414.md) (2 calls: `PerformManualReleaseOrReopenSalesHeader → PerformManualReopen`, `ReleaseSalesHeader → (object)`)
- [Codeunit 1535 "Approvals Mgmt."](../codeunit/1535.md) (1 call: `CheckApprovalWorkflow → IsSalesApprovalsWorkflowEnabled`)
- [Codeunit 29 "Error Message Handler"](../codeunit/29.md) (1 call: `RunWithUI → ShowErrors`)
- [Codeunit 410 "Update Analysis View"](../codeunit/410.md) (1 call: `OnRun → UpdateAll`)
- [Codeunit 431 "IC Outbox Export"](../codeunit/431.md) (1 call: `OnBatchProcessOnBeforeResetBatchID → DownloadBatchFiles`)
- [Codeunit 60 "Sales-Calc. Discount"](../codeunit/60.md) (1 call: `CalculateInvoiceDiscount → (object)`)
- [Codeunit 7150 "Update Item Analysis View"](../codeunit/7150.md) (1 call: `OnRun → UpdateAll`)
- [Codeunit 85 "Sales Post Batch via Job Queue"](../codeunit/85.md) (1 call: `ProcessBatchInBackground → EnqueueSalesBatch`)
- [Codeunit 88 "Sales Post via Job Queue"](../codeunit/88.md) (1 call: `HandleOnCustomProcessing → EnqueueSalesDocWithUI`)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC25

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