---
id: object/codeunit/5831
type: object
title: Codeunit 5831 "PO Matching"
summary: Codeunit 5831 "PO Matching" in Base Application (Microsoft.Inventory.Tracking). 5 public procedures. Introduced in BC29, still in BC30.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: "29"
  last_changed: null
  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: 3b7d5b97eb379240c7662588240215f7603e1f83fef0478eb7d3864804c0055a
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Inventory/Tracking/POMatching.Codeunit.al
    title: src/Layers/W1/BaseApp/Inventory/Tracking/POMatching.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/11815
    - change/bcapps/10700
    - change/bcapps/10524
object_type: codeunit
object_id: 5831
name: PO Matching
namespace: Microsoft.Inventory.Tracking
app: Base Application
extends: null
first_version: "29"
last_version: "30"
present_in:
  - "29"
  - "30"
changed_in: []
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 7
  events: 0
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 3
  called_by: 0
  implements: 0
---

# Codeunit 5831 "PO Matching"

> Codeunit 5831 "PO Matching" in Base Application (Microsoft.Inventory.Tracking). 5 public procedures. Introduced in BC29, still in BC30.

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

## Properties

| Property | Value |
|---|---|
| Access | Public |

## Procedures

- `InvoiceOrderEdge(InvoiceLineSystemId: Guid; OrderLineSystemId: Guid; QtyToAllocate: Decimal): Record "Matched Order Line"`: Builds an invoice-to-order edge.
- `OrderReceiptEdge(OrderLineSystemId: Guid; ReceiptLineSystemId: Guid; QtyToAllocate: Decimal): Record "Matched Order Line"`: Builds an order-to-receipt edge; the invoice is inferred when added if the order has a single invoice edge.
- `InvoiceOrderReceiptEdge(InvoiceLineSystemId: Guid; OrderLineSystemId: Guid; ReceiptLineSystemId: Guid; QtyToAllocate: Decimal): Record "Matched Order Line"`: Builds an order-to-receipt edge with an explicit invoice, used to split a receipt across several invoices.
- `InvoiceReceiptEdge(InvoiceLineSystemId: Guid; ReceiptLineSystemId: Guid; QtyToAllocate: Decimal): Record "Matched Order Line"`: Builds an invoice-to-receipt edge; the order line is derived when added.
- `SuggestCoveringReceipts(var POMatchingGroup: Codeunit "PO Matching Group")`: Enriches the group by covering each invoice-order allocation with the order line's posted receipts that still have quantity received not invoiced, by adding or growing receipt edges.

Plus 2 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 5829 "PO Matching Group"](../codeunit/5829.md) (8 calls: `SuggestCoveringReceipts → AddMatch`, `SuggestCoveringReceipts → AllocatedInInvoiceOrderEdge`, `SuggestCoveringReceipts → GetInvoiceLine`, …)
- [Codeunit 5828 "Invoiceable Receipts"](../codeunit/5828.md) (4 calls: `SuggestCoveringReceipts → GetReceiptLine`, `SuggestCoveringReceipts → Load`, `SuggestCoveringReceipts → NextReceipt`, …)
- [Codeunit 6503 "Item Tracking Doc. Management"](../codeunit/6503.md) (1 call: `ReceiptHasItemTracking → RetrieveEntriesFromShptRcpt`)

## Recent changes

- 2026-09-24 [#11815 Improvements to E-Documents PO matching (E2E findings)](../../changes/bcapps/11815.md) (main, BC30, fix)
- 2026-09-01 [#10700 29.x: PO matching API, E-Documents integration and receipt-on-invoice line tracking](../../changes/bcapps/10700.md) (releases/29.x, BC29, feature, added)
- 2026-08-28 [#10524 Add a purchase order matching API](../../changes/bcapps/10524.md) (main, BC30, feature, added)

## Across versions

- Present in: BC29-30
- Changed (declaration) in: none

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: "PO Matching")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
