---
id: change/bcapps/12607
type: change
title: "#12607 [BE] Improve Purchase Ledger report performance"
summary: The Belgian Purchase Ledger report now uses a single left-joined query with temporary buffering instead of per-entry lookups to reduce database calls and improve performance.
tier: official
language: en
tags:
  - performance
  - main
  - bc30
  - table purch. ledger vat buffer
  - query purch. ledger vat detail
  - report purchase ledger
system: purchasing
review:
  state: reviewed
  by: opus
  at: "2026-10-23T01:11:43.893Z"
  flags: []
generated:
  at: "2026-10-29T00:16:37.959Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 41b7bbe136ba834af1210746a43a82c7edadf568
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/12607
    title: "microsoft/BCApps#12607: [BE] Improve Purchase Ledger report performance"
    date: "2026-10-22"
    commit: 41b7bbe136ba834af1210746a43a82c7edadf568
    t: null
    quote: Reduce database overhead in the Belgian Purchase Ledger report (11301).
links:
  learn: []
  objects:
    - object/table/11302-be
    - object/query/11302-be
    - object/report/11301-be
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
  related:
    - to: https://learn.microsoft.com/dynamics365/business-central/dev-itpro/developer/devenv-query-object
      title: Query object
      label: possibly related
      why: Documents query objects that retrieve and display data, improving performance through proper design.
      by: model
number: 12607
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/12607
kind: pr
base_branch: main
major: "30"
merged_at: "2026-10-22T12:16:17Z"
author: dcenic
author_type: User
community_contribution: false
labels:
  - "Ownership: Manual"
  - "Team: Finance"
change_class: code
change_kind: performance
behavior_change: false
breaking: false
files:
  count: 4
  additions: 275
  deletions: 3
  al: 3
apps:
  - Base Application
objects_touched:
  - key: table/11302
    page: table/11302-be
    type: table
    id: 11302
    name: Purch. Ledger VAT Buffer
    app: Base Application
    status: added
  - key: query/11302
    page: query/11302-be
    type: query
    id: 11302
    name: Purch. Ledger VAT Detail
    app: Base Application
    status: added
  - key: report/11301
    page: report/11301-be
    type: report
    id: 11301
    name: Purchase Ledger
    app: Base Application
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 649462
systems:
  - purchasing
quote: Reduce database overhead in the Belgian Purchase Ledger report (11301).
joined_against:
  major: "30"
  commit: 15385dede95a4f9e7be01be47c684fc9d654a7ce
---

# #12607 [BE] Improve Purchase Ledger report performance

> The Belgian Purchase Ledger report now uses a single left-joined query with temporary buffering instead of per-entry lookups to reduce database calls and improve performance.

[Pull request](https://github.com/microsoft/BCApps/pull/12607) · merged into `main` (BC30) on 2026-10-22 by dcenic · 4 files (+275 -3), 3 AL · performance · tier official · reviewed (checked by Opus)

## What changed

- Replaces multiple per-entry VAT link queries and VAT Entry.Get calls with one left-joined query per journal template and period
- Introduces an internal temporary buffer table and query to aggregate results
- Filters on G/L entry dates rather than VAT entry dates to avoid filtering assumptions
- Uses SetLoadFields and SetAutoCalcFields optimizations for supporting lookups
- Maintains existing error handling and currency display behavior

## AL objects touched

- [Table 11302 "Purch. Ledger VAT Buffer"](../../objects/table/11302-be.md), Base Application (BE layer): added
- [Query 11302 "Purch. Ledger VAT Detail"](../../objects/query/11302-be.md), Base Application (BE layer): added
- [Report 11301 "Purchase Ledger"](../../objects/report/11301-be.md), Base Application (BE layer): modified

## Context

- Work items: AB#649462
- Labels: Ownership: Manual, Team: Finance
- Systems: purchasing
- From the description: "Reduce database overhead in the Belgian Purchase Ledger report (11301)."

## Possibly related

No source states these links: they share an object, a model read them, or a person found the same subject.

- [Query object](https://learn.microsoft.com/dynamics365/business-central/dev-itpro/developer/devenv-query-object) — possibly related: Documents query objects that retrieve and display data, improving performance through proper design. (model-linked)

Source: metadata of a merged pull request in microsoft/BCApps (bcapps): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).
