code change · fixSales & Receivablesofficial - Microsoftreviewed - checked by Opus

#10083 [main]- Negative Shipped and Invoiced Quantities appear on Sales Order Lines after using the Copy Document from a Sales Credit Memo.

When a sales credit memo created with Copy Document from a posted invoice that has the same item on several lines is posted, each credit memo line now resolves to a different invoice line. This stops negative Quantity Shipped and Quantity Invoiced on one sales order line while another order line stays unchanged.

Pull request · merged into main (BC30) on 2026-08-11 by MSNehaNawal · 15 files (+390 -28), 14 AL · fix · tier official · reviewed (checked by Opus)

What changed

  • Added an overload to GetSalesInvoiceLine that tracks already-consumed invoice lines to avoid duplicate matching
  • Introduced FindUnusedSalesInvoiceLine helper method to skip previously matched invoice lines
  • UpdateSalesOrderLineIfExist maintains a temporary buffer of resolved invoice lines to prevent reuse across multiple credit memo lines
  • Fixes issue where all credit memo lines matched the first invoice line when copying from invoices with duplicate items
  • Behaviour changes for users or extensions.

AL objects touched

Context

  • Work items: AB#646375
  • Labels: Team: SCM
  • Systems: sales
  • From the description: “Copy Document does not populate Appl.-from Item Entry on the credit memo lines”

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