---
id: object/codeunit/816
type: object
title: Codeunit 816 "Purch. Post Invoice"
summary: Codeunit 816 "Purch. Post Invoice" in Base Application (Microsoft.Purchases.Posting). 18 public procedures, 1 events. 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: 755d5188c75d3338856cb3c919cc7d6786a9f944047bbfbb570b43ff982ae43a
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Purchases/Posting/PurchPostInvoice.Codeunit.al
    title: src/Layers/W1/BaseApp/Purchases/Posting/PurchPostInvoice.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations:
    - localization/au
    - localization/be
    - localization/ca
    - localization/es
    - localization/it
    - localization/mx
    - localization/nz
    - localization/us
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/11160
    - change/bcapps/8959
object_type: codeunit
object_id: 816
name: Purch. Post Invoice
namespace: Microsoft.Purchases.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"
  - "25"
  - "26"
  - "27"
  - "28"
source_major: "29"
obsolete: null
countries:
  - au
  - be
  - ca
  - es
  - it
  - mx
  - nz
  - us
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 45
  events: 1
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 8
  called_by: 0
  implements: 1
---

# Codeunit 816 "Purch. Post Invoice"

> Codeunit 816 "Purch. Post Invoice" in Base Application (Microsoft.Purchases.Posting). 18 public procedures, 1 events. Present since at least BC23, still in BC30, changed in BC24-28.

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

## Properties

| Property | Value |
|---|---|
| Permissions | TableData "Invoice Posting Buffer" = rimd |

## Events published

- `OnSplitFAOnBeforeRunGenJnlPostLine(var GenJournalLine: Record "Gen. Journal Line"; var GenJournalLine2: Record "Gen. Journal Line"; var TotalGenJournalLine: Record "Gen. Journal Line"; IterationCounter: Integer; SplitNo: Integer)` (integration)

## Procedures

- `Check(TableID: Integer)`
- `SetPreviewMode(NewPreviewMode: Boolean)`
- `SetSuppressCommit(NewSuppressCommit: Boolean)`
- `SetHideProgressWindow(NewHideProgressWindow: Boolean)`
- `SetParameters(NewInvoicePostingParameters: Record "Invoice Posting Parameters")`
- `SetTotalLines(TotalDocumentLine: Variant; TotalDocumentLineLCY: Variant)`
- `ClearBuffers()`
- `PrepareLine(DocumentHeaderVar: Variant; DocumentLineVar: Variant; DocumentLineACYVar: Variant)`
- `PrepareInvoicePostingBuffer(var PurchLine: Record "Purchase Line"; var InvoicePostingBuffer: Record "Invoice Posting Buffer")`
- `SetSalesTax(var PurchaseLine: Record "Purchase Line"; var InvoicePostingBuffer: Record "Invoice Posting Buffer")`
- `PostLines(DocumentHeaderVar: Variant; var GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line"; var Window: Dialog; var TotalAmount: Decimal)`
- `PrepareJobLine(DocumentHeaderVar: Variant; DocumentLineVar: Variant; DocumentLineACYVar: Variant)`
- `CheckCreditLine(PurchHeaderVar: Variant; PurchLineVar: Variant)`
- `PostLedgerEntry(PurchHeaderVar: Variant; var GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line")`
- `PostBalancingEntry(PurchHeaderVar: Variant; var GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line")`
- `CalcDeferralAmounts(PurchHeaderVar: Variant; PurchLineVar: Variant; OriginalDeferralAmount: Decimal)`
- `CreatePostedDeferralSchedule(PurchLineVar: Variant; NewDocumentType: Integer; NewDocumentNo: Code[20]; NewLineNo: Integer; PostingDate: Date)`
- `CreateTempFA(GenJnlLine: Record "Gen. Journal Line"; SplitNo: Integer; var TempFA: Record "Fixed Asset" temporary): Boolean`

Plus 26 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 826 "Purch. Post Invoice Events"](../codeunit/826.md) (63 calls: `CalcDeferralAmounts → RunOnBeforeTempDeferralLineInsert`, `CalcDeferralAmounts → RunOnCalcDeferralAmountsOnBeforeTempDeferralHeaderInsert`, `CalcInvoiceDiscountPosting → RunOnAfterCalcInvoiceDiscountPosting`, …)
- [Codeunit 6200 "Non-Deductible VAT"](../codeunit/6200.md) (7 calls: `CalculateVATAmounts → Update`, `InitTotalAmounts → Init`, `PrepareInvoicePostingBuffer → ClearNonDeductibleVAT`, …)
- [Codeunit 1720 "Deferral Utilities"](../codeunit/1720.md) (4 calls: `CalcDeferralAmounts → FilterDeferralLines`, `CreatePostedDeferralSchedule → FilterDeferralLines`, `PrepareDeferralLine → FilterDeferralLines`, …)
- [Codeunit 1001 "Job Post-Line"](../codeunit/1001.md) (3 calls: `CheckCreditLine → CheckItemQuantityPurchCredit`, `PostLines → PostJobPurchaseLines`, `PrepareJobLine → PostJobOnPurchaseLine`)
- [Codeunit 12 "Gen. Jnl.-Post Line"](../codeunit/12.md) (3 calls: `PostBalancingEntry → RunWithCheck`, `PostLedgerEntry → RunWithCheck`, `RunGenJnlPostLine → RunWithCheck`)
- [Codeunit 444 "Purchase-Post Prepayments"](../codeunit/444.md) (2 calls: `PrepareLine → GetCorrBalAccNo`, `PrepareLine → GetInvRoundingAccNo`)
- [Codeunit 398 "Sales Tax Calculate"](../codeunit/398.md) (1 call: `CalculateVATAmounts → CalculateTax`)
- [Codeunit 408 "DimensionManagement"](../codeunit/408.md) (1 call: `PrepareInvoicePostingBuffer → UpdateGlobalDimFromDimSetID`)

## Implements

- [Interface "Invoice Posting"](../interface/invoice-posting.md)

## Recent changes

- 2026-09-09 [#11160 Ruleset hardening: promote three mechanical rules to Error](../../changes/bcapps/11160.md) (main, BC30, refactor)
- 2026-07-31 [#8959 Deliverable 638799: Spend Requests in Base App](../../changes/bcapps/8959.md) (main, BC30, feature)

## Across versions

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

## Countries that replace it

[AU](../../localizations/au.md), [BE](../../localizations/be.md), [CA](../../localizations/ca.md), [ES](../../localizations/es.md), [IT](../../localizations/it.md), [MX](../../localizations/mx.md), [NZ](../../localizations/nz.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: "Purch. Post Invoice")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
