---
title: "Codeunit 5802 Inventory Posting To G/L"
author: "Jonas Paprotka"
url: https://jonas-paprotka.de/ref/codeunit/5802-inventory-posting-to-g-l/
type: codeunit
id: 5802
name: "Inventory Posting To G/L"
app: "Base Application"
namespace: Microsoft.Inventory.Costing
versions: "17-28"
build: 28.5.54151.54365
source: "https://jonas-paprotka.de/ref/codeunit/5802-inventory-posting-to-g-l/source/29/"
checked: 2026-09-20
subject: "Microsoft Dynamics 365 Business Central"
license: "Content © 2026 Jonas Paprotka. Quote freely with attribution and a link."
---

# Codeunit 5802 Inventory Posting To G/L

Jonas Paprotka, https://jonas-paprotka.de/ref/codeunit/5802-inventory-posting-to-g-l/

| | |
| --- | --- |
| App | Base Application |
| Namespace | Microsoft.Inventory.Costing |
| Versions | 17-28 |
| Source file | Inventory/Costing/InventoryPostingToGL.Codeunit.al |

## Procedures

| Name | Parameters | Returns | Access | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- | --- |
| Initialize | (Boolean) | - | public | 17-28 | - | - |
| SetRunOnlyCheck | (Boolean, Boolean, Boolean) | - | public | 17-28 | - | - |
| BufferInvtPosting | (var Record Value Entry) | Boolean | public | 17-28 | - | - |
| InitInvtPostBuf | (Record Value Entry, Enum Invt. Posting Buffer Account Type, Enum Invt. Posting Buffer Account Type, Decimal, Decimal, Boolean) | - | public | 17-28 | - | - |
| PostInvtPostBufPerEntry | (var Record Value Entry) | - | public | 17-28 | - | - |
| PostInvtPostBufPerPostGrp | (Code[20], Text[50]) | - | public | 17-28 | - | - |
| SetDesc | (var Record Gen. Journal Line, Record Invt. Posting Buffer) | - | public | 17-28 | - | - |
| GetTempInvtPostToGLTestBuf | (var Record Invt. Post to G/L Test Buffer) | - | public | 17-28 | - | - |
| GetAmtToPost | (var Decimal, var Decimal, var Decimal, var Decimal, var Decimal, var Decimal, var Decimal, var Decimal, var Decimal, Boolean) | - | public | 17-28 | - | - |
| GetInvtPostBuf | (var Record Invt. Posting Buffer) | - | public | 17-28 | - | - |
| CheckGenJnlLine | (var Record Gen. Journal Line) | - | public | 18-28 | - | - |
| PostGenJnlLine | (var Record Gen. Journal Line) | - | public | 18-28 | - | - |
| SetGenJnlBatch | (Code[10], Code[10]) | - | public | 20-28 | - | - |
| AdjustPostedWIPForProduction | (Record Value Entry) | Boolean | public | 26-28 | - | - |
| ResetGLPostingState | () | - | public | 28 | - | - |

## Events

| Kind | Name | Parameters | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- |
| Integration event | OnAfterBufferCapacityPosting | (var Record Value Entry, var Decimal, var Decimal) | 17-28 | - | - |
| Integration event | OnAfterBufferConsumpPosting | (var Record Invt. Posting Buffer, Record Value Entry, var Integer, var Decimal, var Decimal) | 17-28 | - | - |
| Integration event | OnAfterBufferOutputPosting | (var Record Value Entry, var Decimal, var Decimal, var Decimal, var Decimal) | 17-28 | - | - |
| Integration event | OnAfterBufferPosting | (var Record Value Entry, var Decimal, var Decimal, var Decimal, var Decimal) | 17-28 | - | - |
| Integration event | OnAfterBufferSalesPosting | (var Record Invt. Posting Buffer, Record Value Entry, var Integer) | 17-28 | - | - |
| Integration event | OnAfterCalcCostToPostFromBuffer | (var Record Value Entry, var Decimal, var Decimal, var Decimal, var Decimal) | 17 | - | - |
| Integration event | OnAfterGLItemLedgRelationInsert | () | 17-28 | - | - |
| Integration event | OnAfterInitInvtPostBuf | (var Record Value Entry) | 17-28 | - | - |
| Integration event | OnAfterInitTempInvtPostBuf | (var Record Invt. Posting Buffer, Record Value Entry, Integer) | 17-28 | - | - |
| Integration event | OnAfterRun | (var Record Value Entry) | 17-28 | - | - |
| Integration event | OnAfterSetAccNo | (var Record Invt. Posting Buffer, Record Value Entry, Boolean) | 17-28 | - | - |
| Integration event | OnAfterSetDesc | (var Record Gen. Journal Line, var Record Invt. Posting Buffer) | 17-28 | - | - |
| Integration event | OnAfterSetAmt | (var Record Gen. Journal Line, Decimal, Decimal, var Boolean) | 17-28 | - | - |
| Integration event | OnBeforeBufferAdjmtPosting | (var Record Value Entry, var Record Invt. Posting Buffer, Decimal, Decimal, Decimal, Decimal, var Boolean) | 17-28 | - | - |
| Integration event | OnBeforeBufferInvtPosting | (var Record Value Entry, var Boolean, var Boolean, Boolean) | 17 | - | - |
| Integration event | OnBeforeBufferOutputPosting | (var Record Value Entry, var Record Invt. Posting Buffer, Decimal, Decimal, Decimal, Decimal, var Boolean) | 17-28 | - | - |
| Integration event | OnBeforeBufferPosting | (var Record Value Entry, var Decimal, var Decimal, var Decimal, var Decimal) | 17-28 | - | - |
| Integration event | OnBeforeBufferPurchPosting | (var Record Value Entry, var Record Invt. Posting Buffer, Decimal, Decimal, Decimal, Decimal, var Boolean) | 17-28 | - | - |
| Integration event | OnBeforeBufferSalesPosting | (var Record Value Entry, var Record Invt. Posting Buffer, Decimal, Decimal, Decimal, Decimal, var Boolean) | 17-28 | - | - |
| Integration event | OnBeforeCheckGLAcc | (var Code[20], Boolean, var Boolean) | 17-28 | - | - |
| Integration event | OnBeforeCheckInvtPostBuf | (var Record Gen. Journal Line, var Record Invt. Posting Buffer, Record Value Entry, var Codeunit Gen. Jnl.-Post Line) | 17 | - | - |
| Integration event | OnBeforeGetInvPostingGroupCode | (var Record Value Entry, var Code[20]) | 17-24 | - | - |
| Integration event | OnBeforeInitInvtPostBuf | (var Record Value Entry) | 17-25 | - | - |
| Integration event | OnBeforePostInvtPostBuf | (var Record Gen. Journal Line, var Record Invt. Posting Buffer, Record Value Entry, var Codeunit Gen. Jnl.-Post Line) | 17-28 | - | - |
| Integration event | OnBeforeGetInvtPostSetup | (var Record Inventory Posting Setup, Code[10], Code[20], var Record General Posting Setup, var Boolean) | 17-21 | - | - |
| Integration event | OnBeforeGLItemLedgRelationInsert | (var Record G/L - Item Ledger Relation, Record Invt. Posting Buffer, Record G/L Register, Record G/L - Item Ledger Relation) | 17-28 | - | - |
| Integration event | OnBeforeSetAccNo | (var Record Invt. Posting Buffer, Record Value Entry, Option, Option, Boolean, var Boolean) | 17-28 | - | - |
| Integration event | OnBeforeOnRun | (var Record Value Entry, Boolean, var Boolean) | 17-28 | - | - |
| Integration event | OnInsertTempInvtPostToGLTestBufOnBeforeInsert | (var Record Invt. Post to G/L Test Buffer, Record Value Entry) | 17-28 | - | - |
| Integration event | OnInsertTempInvtPostToGLTestBufOnBeforeTempInvtPostToGLTestBufInsert | (var Record Invt. Post to G/L Test Buffer, Record Gen. Journal Line, Record Value Entry) | 17-28 | - | - |
| Integration event | OnPostInvtPostBufferOnBeforeFind | (var Record Invt. Posting Buffer, var Record G/L - Item Ledger Relation) | 17-18 | - | - |
| Integration event | OnPostInvtPostBufOnAfterInitGenJnlLine | (var Record Gen. Journal Line, var Record Value Entry) | 17-28 | - | - |
| Integration event | OnPostInvtPostBufferOnAfterPostInvtPostBuf | (var Record Invt. Posting Buffer, var Record Value Entry, Boolean, Boolean, Boolean, Boolean) | 17-28 | - | - |
| Integration event | OnPostInvtPostBufOnAfterUpdateGlobalDimFromDimSetID | (var Record Gen. Journal Line) | 17 | - | - |
| Integration event | OnPostInvtPostBufOnBeforeSetAmt | (var Record Gen. Journal Line, var Record Value Entry, var Record Invt. Posting Buffer) | 17-28 | - | - |
| Integration event | OnSetAccNoOnAfterGetPostingSetup | (var Record Invt. Posting Buffer, var Record Inventory Posting Setup, var Record General Posting Setup, Record Value Entry, Boolean) | 17-28 | - | - |
| Integration event | OnSetAccNoOnBeforeCheckAccNo | (var Record Invt. Posting Buffer, Record Inventory Posting Setup, Record General Posting Setup, Boolean) | 17 | - | - |
| Integration event | OnUpdateGlobalInvtPostBufOnBeforeModify | (var Record Invt. Posting Buffer, Record Invt. Posting Buffer) | 17-28 | - | - |
| Integration event | OnUpdateValueEntryOnBeforeModify | (var Record Value Entry, Record Invt. Posting Buffer) | 17-28 | - | - |
| Integration event | OnBeforeBufferConsumpPosting | (var Record Value Entry, var Record Invt. Posting Buffer, Decimal, Decimal, var Boolean) | 17-28 | - | - |
| Integration event | OnAfteUpdateReportAmounts | (var Record Invt. Posting Buffer, var Decimal, var Decimal) | 17-19 | - | - |
| Integration event | OnAfterCalcCostToPostFromBuffer | (var Record Value Entry, var Decimal, var Decimal, var Decimal, var Decimal, var Boolean) | 18-28 | - | - |
| Integration event | OnBeforeBufferInvtPosting | (var Record Value Entry, var Boolean, var Boolean, Boolean, Boolean) | 18-26 | - | - |
| Integration event | OnBeforeCheckInvtPostBuf | (var Record Gen. Journal Line, var Record Invt. Posting Buffer, Record Value Entry, var Codeunit Gen. Jnl.-Post Line, var Codeunit Gen. Jnl.-Check Line) | 18-28 | - | - |
| Integration event | OnBeforePostInvtPostBufProcessGlobalInvtPostBuf | (var Record Invt. Posting Buffer, var Record Gen. Journal Line, var Record Value Entry, var Codeunit Gen. Jnl.-Post Line, Boolean, Boolean, var Boolean) | 18-28 | - | - |
| Integration event | OnPostInvtPostBufOnAfterUpdateGlobalDimFromDimSetID | (var Record Gen. Journal Line, var Record Invt. Posting Buffer) | 18-28 | - | - |
| Integration event | OnPostInvtPostBufProcessGlobalInvtPostBufOnAfterSetAmt | (var Record Gen. Journal Line) | 18-28 | - | - |
| Integration event | OnPostInvtPostBufProcessGlobalInvtPostBufOnAfterSetDesc | (var Record Gen. Journal Line, var Record Invt. Posting Buffer) | 18-28 | - | - |
| Integration event | OnSetAccNoOnBeforeCheckAccNo | (var Record Invt. Posting Buffer, Record Inventory Posting Setup, Record General Posting Setup, Boolean, var Record Value Entry) | 18-28 | - | - |
| Integration event | OnBeforeBufferAsmOutputPosting | (var Record Value Entry, var Record Invt. Posting Buffer, var Decimal, var Decimal, var Boolean) | 18-28 | - | - |
| Integration event | OnBeforeBufferAsmConsumpPosting | (var Record Value Entry, var Record Invt. Posting Buffer, var Decimal, var Decimal, var Boolean) | 18-28 | - | - |
| Integration event | OnBeforeInitInvtPostBufPerAccount | (var Record Value Entry, Enum Invt. Posting Buffer Account Type, Enum Invt. Posting Buffer Account Type, Decimal, Decimal, Boolean, Boolean, var Boolean) | 19-28 | - | - |
| Integration event | OnPostInvtPostBufferOnBeforeFind | (var Record Invt. Posting Buffer, var Record G/L - Item Ledger Relation, var Record Value Entry) | 19-28 | - | - |
| Integration event | OnUpdateGlobalInvtPostBufOnAfterCalcShouldInsertTempGLItemLedgRelation | (var Record G/L - Item Ledger Relation, Record Invt. Posting Buffer, Integer, Boolean, Boolean, var Boolean) | 20-28 | - | - |
| Integration event | OnAfteUpdateReportAmounts | (var Record Invt. Posting Buffer, var Decimal, var Decimal, var Decimal) | 20-28 | - | - |
| Integration event | OnAfterBufferGLItemLedgRelation | (var Record G/L - Item Ledger Relation, Integer) | 21-28 | - | - |
| Integration event | OnBeforeGetInvtPostSetup | (var Record Inventory Posting Setup, var Code[10], Code[20], var Record General Posting Setup, var Boolean, var Record Invt. Posting Buffer) | 22-28 | - | - |
| Integration event | OnBeforePostInvtPostBufPerEntry | (var Record Value Entry, var Record Invt. Posting Buffer, Boolean, var Boolean) | 23-28 | - | - |
| Integration event | OnAfterSetGenJnlBatch | (Code[10], Code[10]) | 23-28 | - | - |
| Integration event | OnAfterSetRunOnlyCheck | (Boolean, Boolean, Boolean) | 23-28 | - | - |
| Integration event | OnAfterInitialize | (Boolean) | 23-28 | - | - |
| Integration event | OnAfterBufferAdjmtPosting | (var Record Invt. Posting Buffer, Record Value Entry, var Integer) | 23-28 | - | - |
| Integration event | OnAfterBufferPurchPosting | (var Record Invt. Posting Buffer, Record Value Entry, var Integer) | 23-28 | - | - |
| Integration event | OnAfterPostInvtPostBuf | (var Record Gen. Journal Line, var Record Invt. Posting Buffer, Record Value Entry, var Codeunit Gen. Jnl.-Post Line) | 24-28 | - | - |
| Integration event | OnBeforeBufferCapacityPosting | (var Record Value Entry, var Record Invt. Posting Buffer, Decimal, Decimal, var Boolean) | 24-28 | - | - |
| Integration event | OnBeforeGetInvPostingGroupCode | (var Record Value Entry, var Code[20], var Boolean) | 25-28 | - | - |
| Integration event | OnBeforeCreateGLItemLedgerRelationEntry | (var Record G/L Register, var Boolean) | 25-28 | - | - |
| Integration event | OnBeforeUpdateGlobalInvtPostBuf | (Integer, var Record Invt. Posting Buffer, Boolean, Boolean, Boolean, Boolean) | 25-28 | - | - |
| Integration event | OnBeforeInitInvtPostBuf | (var Record Value Entry, var Enum Invt. Posting Buffer Account Type, var Enum Invt. Posting Buffer Account Type) | 26-28 | - | - |
| Integration event | OnBeforeAdjustWIPForProduction | (var Record Value Entry, var Record Invt. Posting Buffer, Decimal, Decimal, var Boolean) | 26-28 | - | - |
| Integration event | OnBeforeBufferInvtPosting | (var Record Value Entry, var Boolean, var Boolean, Boolean, Boolean, var Record Invt. Posting Buffer) | 27-28 | - | - |

## Source

Symbols: Microsoft.BaseApplication.symbols.437dbf0e-84ff-417a-965d-ed2bb9650972, https://dynamicssmb2.pkgs.visualstudio.com/DynamicsBCPublicFeeds/_packaging/MSSymbols/nuget/v3/index.json, highest build per major on 2026-09-20.
AL source 29: https://github.com/microsoft/BCApps, MIT, releases/29.x at a66254c3b8b5bb1cea290dc8f9d097aec4381153.

Jonas Paprotka, 2026-09-20.
