Describe the issue
When a user attempts to print more than one posted sales invoice generated from a subscription contract in a single print run, the operation fails with an error indicating a duplicate record in the billing details buffer.
The root cause appears to be that Sub. Contract Billing Printout (CodeUnit 8064) uses a shared buffer (FillContractBillingDetailsBufferFromSalesInvoice) that is not cleared or scoped per invoice, causing collisions when iterating over multiple invoices. Additionally, this likely results in billing details from one invoice bleeding into others in the printout.
Expected behavior
Printing multiple posted sales invoices from subscription contracts in a single run should succeed without errors. Each invoice should contain only its own billing details.
Steps to reproduce
-
Create a subscription contract with at least one contract line.
-
Run the billing process and post two or more sales invoices from the contract.
-
Open the list of posted sales invoices, select multiple invoices generated from subscription contracts, and trigger Print.
AL call stack:
"Sub. Contract Billing Printout"(CodeUnit 8064).FillContractBillingDetailsBufferFromSalesInvoice line 82
"Contract Standard Sales Inv."(ReportExtension 8008)."Header - OnAfterAfterGetRecord"(Trigger) line 2
Additional context
No response
I will provide a fix for a bug
Describe the issue
When a user attempts to print more than one posted sales invoice generated from a subscription contract in a single print run, the operation fails with an error indicating a duplicate record in the billing details buffer.
The root cause appears to be that
Sub. Contract Billing Printout(CodeUnit 8064) uses a shared buffer (FillContractBillingDetailsBufferFromSalesInvoice) that is not cleared or scoped per invoice, causing collisions when iterating over multiple invoices. Additionally, this likely results in billing details from one invoice bleeding into others in the printout.Expected behavior
Printing multiple posted sales invoices from subscription contracts in a single run should succeed without errors. Each invoice should contain only its own billing details.
Steps to reproduce
Create a subscription contract with at least one contract line.
Run the billing process and post two or more sales invoices from the contract.
Open the list of posted sales invoices, select multiple invoices generated from subscription contracts, and trigger Print.
❌ The following error is thrown:
AL call stack:
Additional context
No response
I will provide a fix for a bug