---
id: change/bcapps/8553
type: change
title: "#8553 [Bug][SubscriptionBilling]: Performance: Billing document creation does not scale to large datasets (4M+ subscription lines)"
summary: Billing document creation now scales to millions of subscription lines through code optimizations, database indexes, transaction checkpoints, and progress tracking, eliminating redundant lookups and event dispatch overhead.
tier: official
language: en
tags:
  - performance
  - main
  - bc30
  - codeunit billing proposal
  - codeunit create billing documents
  - codeunit purchase documents
  - codeunit sales documents
  - page recurring billing
  - table billing line
system: sales
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:10:54.075Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: aea3fe77199a9e88287de991ce81c065d2027339
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/8553
    title: "microsoft/BCApps#8553: [Bug][SubscriptionBilling]: Performance: Billing document creation does not scale to large datasets (4M+ subscription lines)"
    date: "2026-07-30"
    commit: aea3fe77199a9e88287de991ce81c065d2027339
    t: null
    quote: null
links:
  learn: []
  objects:
    - object/codeunit/8062
    - object/codeunit/8060
    - object/codeunit/8066
    - object/codeunit/8063
    - object/page/8067
    - object/table/8061
    - object/table/8064
    - object/table/8059
    - object/codeunit/8033
    - object/codeunit/8026
    - object/codeunit/8028
    - object/table/8006
    - object/table/8018
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 8553
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/8553
kind: pr
base_branch: main
major: "30"
merged_at: "2026-07-30T11:17:04Z"
author: miljance
author_type: User
community_contribution: true
labels:
  - "ADO: Sync"
  - "AL: Apps (W1)"
  - From Fork
  - "Team: Finance"
change_class: code
change_kind: performance
behavior_change: true
breaking: false
files:
  count: 14
  additions: 770
  deletions: 170
  al: 14
apps:
  - Subscription Billing
objects_touched:
  - key: codeunit/8062
    page: codeunit/8062
    type: codeunit
    id: 8062
    name: Billing Proposal
    app: Subscription Billing
    status: modified
  - key: codeunit/8060
    page: codeunit/8060
    type: codeunit
    id: 8060
    name: Create Billing Documents
    app: Subscription Billing
    status: modified
  - key: codeunit/8066
    page: codeunit/8066
    type: codeunit
    id: 8066
    name: Purchase Documents
    app: Subscription Billing
    status: modified
  - key: codeunit/8063
    page: codeunit/8063
    type: codeunit
    id: 8063
    name: Sales Documents
    app: Subscription Billing
    status: modified
  - key: page/8067
    page: page/8067
    type: page
    id: 8067
    name: Recurring Billing
    app: Subscription Billing
    status: modified
  - key: table/8061
    page: table/8061
    type: table
    id: 8061
    name: Billing Line
    app: Subscription Billing
    status: modified
  - key: table/8064
    page: table/8064
    type: table
    id: 8064
    name: Billing Line Archive
    app: Subscription Billing
    status: modified
  - key: table/8059
    page: table/8059
    type: table
    id: 8059
    name: Subscription Line
    app: Subscription Billing
    status: modified
  - key: codeunit/8033
    page: codeunit/8033
    type: codeunit
    id: 8033
    name: Generic Connector Processing
    app: Subscription Billing
    status: modified
  - key: codeunit/8026
    page: codeunit/8026
    type: codeunit
    id: 8026
    name: Process Usage Data Billing
    app: Subscription Billing
    status: modified
  - key: codeunit/8028
    page: codeunit/8028
    type: codeunit
    id: 8028
    name: Usage Based Contr. Subscribers
    app: Subscription Billing
    status: modified
  - key: table/8006
    page: table/8006
    type: table
    id: 8006
    name: Usage Data Billing
    app: Subscription Billing
    status: modified
  - key: table/8018
    page: table/8018
    type: table
    id: 8018
    name: Usage Data Generic Import
    app: Subscription Billing
    status: modified
objects_unjoined:
  - path: src/Apps/W1/Subscription Billing/App/Base/Codeunits/ProgressTracker.Codeunit.al
    status: added
    reason: not-in-snapshot
obsoletions: []
backports: []
fixes_issues:
  - 7690
work_items:
  - 641986
systems:
  - sales
quote: null
joined_against:
  major: "30"
  commit: f18567dc08e2bd162bf192e1da4d714b57eb099f
---

# #8553 [Bug][SubscriptionBilling]: Performance: Billing document creation does not scale to large datasets (4M+ subscription lines)

> Billing document creation now scales to millions of subscription lines through code optimizations, database indexes, transaction checkpoints, and progress tracking, eliminating redundant lookups and event dispatch overhead.

[Pull request](https://github.com/microsoft/BCApps/pull/8553) · merged into `main` (BC30) on 2026-07-30 by miljance (community contribution) · 14 files (+770 -170), 14 AL · performance · tier official · reviewed (checked by Opus)

## What changed

- New Progress Tracker codeunit gives a reusable, GuiAllowed-guarded ETA dialog that is safe for Job Queue runs
- Commit checkpoints added every 10 contracts in billing proposals and per document on the non-posting creation path; per-commitment commit removed in usage data billing
- New subscriber codeunit skips redundant unit price and cost calculations when inserting billing document lines
- Dictionary-based aggregation, SetLoadFields and IsEmpty checks replace costly loops and lookups
- New or extended keys on Billing Line, Subscription Line, Usage Data Billing and Usage Data Generic Import; three event subscribers inlined into hot paths
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 8062 "Billing Proposal"](../../objects/codeunit/8062.md), Subscription Billing: modified
- [Codeunit 8060 "Create Billing Documents"](../../objects/codeunit/8060.md), Subscription Billing: modified
- [Codeunit 8066 "Purchase Documents"](../../objects/codeunit/8066.md), Subscription Billing: modified
- [Codeunit 8063 "Sales Documents"](../../objects/codeunit/8063.md), Subscription Billing: modified
- [Page 8067 "Recurring Billing"](../../objects/page/8067.md), Subscription Billing: modified
- [Table 8061 "Billing Line"](../../objects/table/8061.md), Subscription Billing: modified
- [Table 8064 "Billing Line Archive"](../../objects/table/8064.md), Subscription Billing: modified
- [Table 8059 "Subscription Line"](../../objects/table/8059.md), Subscription Billing: modified
- [Codeunit 8033 "Generic Connector Processing"](../../objects/codeunit/8033.md), Subscription Billing: modified
- [Codeunit 8026 "Process Usage Data Billing"](../../objects/codeunit/8026.md), Subscription Billing: modified
- [Codeunit 8028 "Usage Based Contr. Subscribers"](../../objects/codeunit/8028.md), Subscription Billing: modified
- [Table 8006 "Usage Data Billing"](../../objects/table/8006.md), Subscription Billing: modified
- [Table 8018 "Usage Data Generic Import"](../../objects/table/8018.md), Subscription Billing: modified
- `src/Apps/W1/Subscription Billing/App/Base/Codeunits/ProgressTracker.Codeunit.al`: added, not in the BC30 snapshot yet

## Context

- Fixes: [#7690 [Bug][SubscriptionBilling]: Performance: Billing document creation does not scale to large datasets (4M+ subscription lines)](https://github.com/microsoft/BCApps/issues/7690) (closed)
- Work items: AB#641986
- Labels: ADO: Sync, AL: Apps (W1), From Fork, Team: Finance
- Systems: sales

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).
