---
id: object/codeunit/1252
type: object
title: Codeunit 1252 "Match Bank Rec. Lines"
summary: Codeunit 1252 "Match Bank Rec. Lines" in Base Application (Microsoft.Bank.Reconciliation). 17 public procedures, 8 events. Present since at least BC23, still in BC30, changed in BC24, BC26-27.
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: 78da5b4b9395553589f5773c4399b19f25da3452264c707716545804f31ba33c
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Bank/Reconciliation/MatchBankRecLines.Codeunit.al
    title: src/Layers/W1/BaseApp/Bank/Reconciliation/MatchBankRecLines.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: 1252
name: Match Bank Rec. Lines
namespace: Microsoft.Bank.Reconciliation
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "24"
  - "26"
  - "27"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 44
  events: 8
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 1
  calls: 3
  called_by: 4
  implements: 0
---

# Codeunit 1252 "Match Bank Rec. Lines"

> Codeunit 1252 "Match Bank Rec. Lines" in Base Application (Microsoft.Bank.Reconciliation). 17 public procedures, 8 events. Present since at least BC23, still in BC30, changed in BC24, BC26-27.

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

## Events published

- `OnShowMatchSummaryOnAfterSetFinalText(var BankAccReconciliation: Record "Bank Acc. Reconciliation"; FinalText: Text; var IsHandled: Boolean)` (integration): Integration event raised after setting the final text in the match summary display. Allows subscribers to customize the summary text or provide alternative display handling.
- `OnFindBestMatches(var BankAccReconciliationLine: Record "Bank Acc. Reconciliation Line"; var TempBankAccLedgerEntryMatchingBuffer: Record "Ledger Entry Matching Buffer" temporary; DaysTolerance: Integer; var TempBankStatementMatchingBuffer: Record "Bank Statement Matching Buffer" temporary; var RemovedPreviouslyAssigned: Boolean; var Handled: Boolean)` (integration): Integration event for finding best matches using custom algorithms or external services. Allows subscribers to implement alternative matching logic, potentially with AI or machine learning.
  - subscribers: [Codeunit 7250 "Bank Rec. AI Matching Impl."](../codeunit/7250.md) HandleOnFindBestMatches
- `OnBeforeRemoveMatchesFromRecLines(var IsHandled: Boolean)` (integration): Integration event raised before removing matches from reconciliation lines. Allows subscribers to implement custom removal logic or prevent the removal operation.
- `OnRemoveMatchOnAfterRemoveApplication(var BankAccountLedgerEntry: Record "Bank Account Ledger Entry")` (integration): Integration event raised after removing an application from a bank account ledger entry during match removal. Allows subscribers to perform cleanup operations or additional processing after application removal.
- `OnPerformManyToOneMatchOnBeforeApplyEntries(var BankAccReconciliationLine: Record "Bank Acc. Reconciliation Line"; var BankAccountLedgerEntry: Record "Bank Account Ledger Entry")` (integration): Integration event raised before applying entries in a many-to-one matching scenario. Allows subscribers to perform validation or modify data before the many-to-one application.
- `OnPerformManyToOneMatchOnAfterApplyEntries(var BankAccReconciliationLine: Record "Bank Acc. Reconciliation Line"; var BankAccountLedgerEntry: Record "Bank Account Ledger Entry")` (integration): Integration event raised after applying entries in a many-to-one matching scenario. Allows subscribers to perform post-application processing or logging for many-to-one matches.
- `OnPerformOneToOneOrManyMatchOnBeforeApplyEntries(var BankAccReconciliationLine: Record "Bank Acc. Reconciliation Line"; var BankAccountLedgerEntry: Record "Bank Account Ledger Entry")` (integration): Integration event raised before applying entries in one-to-one or one-to-many matching scenarios. Allows subscribers to perform validation or modify data before the entry application.
- `OnPerformOneToOneOrManyMatchOnAfterApplyEntries(var BankAccReconciliationLine: Record "Bank Acc. Reconciliation Line"; var BankAccountLedgerEntry: Record "Bank Account Ledger Entry")` (integration): Integration event raised after applying entries in one-to-one or one-to-many matching scenarios. Allows subscribers to perform post-application processing or logging for standard matches.

## Procedures

- `MatchManually(var SelectedBankAccReconciliationLine: Record "Bank Acc. Reconciliation Line"; var SelectedBankAccountLedgerEntry: Record "Bank Account Ledger Entry")`: Creates manual matches between selected bank reconciliation lines and bank account ledger entries. Enables users to override automatic matching decisions by explicitly linking statement lines with specific ledger entries, supporting complex reconciliation scenarios requiring human judgment.
- `BankReconciliationLineInManyToOne(var BankAccReconciliationLine: Record "Bank Acc. Reconciliation Line"): Boolean` (internal): Determines whether a bank reconciliation line is part of a many-to-one matching relationship. Checks if the line has multiple bank reconciliation lines matched to a single bank account ledger entry, which requires special handling during removal and processing operations.
- `RemoveMatchesFromRecLines(var SelectedBankAccReconciliationLine: Record "Bank Acc. Reconciliation Line")`: Removes all matches from selected bank reconciliation lines, clearing their applied entries. Unlinks bank account ledger entries and check ledger entries from the reconciliation lines, resetting them to unmatched status for potential re-matching with different entries.
- `RemoveMatchesFromRecLines(var SelectedBankAccReconciliationLine: Record "Bank Acc. Reconciliation Line"; var MatchesRemoved: Boolean)`: Removes all matches from selected bank reconciliation lines with detailed tracking of removal status. Unlinks bank account ledger entries and check ledger entries from the reconciliation lines, resetting them to unmatched status while providing feedback on whether any matches were actually removed.
- `RemoveMatch(var SelectedBankAccReconciliationLine: Record "Bank Acc. Reconciliation Line"; var SelectedBankAccountLedgerEntry: Record "Bank Account Ledger Entry")`: Removes specific matches between selected bank reconciliation lines and bank account ledger entries. Provides granular control over match removal by targeting specific entry combinations rather than clearing all matches from a line. Handles both bank account ledger entries and check ledger entries w...
- `BankAccReconciliationAutoMatch(BankAccReconciliation: Record "Bank Acc. Reconciliation"; DaysTolerance: Integer)`: Executes automatic matching algorithm for bank account reconciliation with date tolerance. Analyzes bank statement lines and bank account ledger entries to identify potential matches based on amounts, dates (within tolerance), document numbers, and text descriptions. Updates matched entries by apply...
- `BankAccReconciliationAutoMatch(var BankAccReconciliation: Record "Bank Acc. Reconciliation"; DaysTolerance: Integer; RaiseFindBestMatchesEvent: Boolean; ShouldShowMatchSummary: Boolean)`: Executes comprehensive automatic matching algorithm for bank account reconciliation with advanced options. Provides full control over the matching process including event handling, optimization settings, and result presentation. Analyzes bank statement lines and bank account ledger entries using sop...
- `InitializeBLEMatchingTempTable(var TempBankAccLedgerEntryMatchingBuffer: Record "Ledger Entry Matching Buffer" temporary; var BankAccountLedgerEntry: Record "Bank Account Ledger Entry")`
- `ListOfMatchedFields(AmountMatched: Boolean; DocumentNoMatched: Boolean; ExternalDocumentNoMatched: Boolean; TransactionDateMatched: Boolean; RelatedPartyMatched: Boolean; DescriptionMatched: Boolean): Text`
- `SaveOneToOneMatching(var TempBankStatementMatchingBuffer: Record "Bank Statement Matching Buffer" temporary; BankAccountNo: Code[20]; StatementNo: Code[20])`
- `SaveManyToOneMatching(var TempBankStatementMatchingBuffer: Record "Bank Statement Matching Buffer" temporary; BankAccountNo: Code[20]; StatementNo: Code[20])`
- `ShowMatchSummary(BankAccReconciliation: Record "Bank Acc. Reconciliation")`
- `GetDescriptionMatchScore(BankRecDescription: Text; BankEntryDescription: Text; DocumentNo: Code[20]; ExternalDocumentNo: Code[35]): Integer`
- `SetMatchLengthTreshold(NewMatchLengthThreshold: Integer)`
- `SetNormalizingFactor(NewNormalizingFactor: Integer)`
- `GetMatchLengthTreshold(): Integer`
- `GetNormalizingFactor(): Integer`

Plus 19 local procedures.

## Triggers

OnRun

## 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 375 "Bank Acc. Entry Set Recon.-No."](../codeunit/375.md) (11 calls: `PerformManyToOneMatch → ApplyEntries`, `PerformManyToOneMatch → RemoveApplication`, `PerformManyToOneMatch → SetLineCount`, …)
- [Codeunit 1251 "Record Match Mgt."](../codeunit/1251.md) (4 calls: `BankReconciliationLineTextSimilarityScores → CalculateExactStringNearness`, `BankReconciliationLineTextSimilarityScores → CalculateStringNearness`, `GetDescriptionMatchScore → CalculateStringNearness`, …)
- [Codeunit 376 "Check Entry Set Recon.-No."](../codeunit/376.md) (1 call: `RemoveMatch → RemoveApplication`)

## Called by

- [Codeunit 7250 "Bank Rec. AI Matching Impl."](../codeunit/7250.md) (2 calls: `ApplyToProposedLedgerEntries → SaveManyToOneMatching`, `ApplyToProposedLedgerEntries → SaveOneToOneMatching`)
- [Page 7250 "Bank Acc. Rec. AI Proposal"](../page/7250.md) (2 calls: `AutoMatchWithCopilot → BankAccReconciliationAutoMatch`, `AutoMatchWithCopilot → InitializeBLEMatchingTempTable`)
- [Codeunit 7251 "Bank Acc. Rec. Trans. to Acc."](../codeunit/7251.md) (1 call: `PostNewPaymentsToProposedGLAccounts → SaveOneToOneMatching`)
- [Table 273 "Bank Acc. Reconciliation"](../table/273.md) (1 call: `MatchSingle → BankAccReconciliationAutoMatch`)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC24, BC26-27

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: "Match Bank Rec. Lines")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
