microsoft / microsoft/BCApps

[Bug]: [Subcontracting] Item charge on a last-operation subcontracting receipt line links to a wrong, unrelated item ledger entry

Open
#8,743 1 comment 0 reactions 1 assignee View on GitHub

@alexei-dobriansky is already working on this.

Since Jun 23, 2026.

Bug Subcontracting Team: SCM
Dominant language
AL
Stars
683
Forks
459
Avg merge
3d 26m
Merged PRs (30d)
633

Description

Describe the issue

When an Item Charge is assigned to a posted subcontracting purchase receipt line for the last operation of a routing (the operation whose Next Operation No. is blank), the charge gets linked to a completely unrelated item ledger entry.

The posting routine resolves the wrong link: it finds the subcontracting operation's capacity ledger entry, takes its entry number, and then searches for an item ledger entry with that same number. Because the Capacity Ledger Entry and Item Ledger Entry tables have independent numbering, the entry number from one table does not correspond to the same record in the other. As a result the item charge is linked to an arbitrary, irrelevant item ledger entry instead of the correct one.

Internal workitem: AB#640042

Expected behavior

The item charge is linked to the correct ledger entry for the subcontracting receipt line. Linking the charge to an item ledger entry is acceptable in this case, but it must be the related entry — not one found by reusing a capacity ledger entry number to look up an item ledger entry across two differently-numbered tables.

Steps to reproduce
  1. Create a manufacturing item with:
    • A Routing of type Serial containing a single operation 10 on the subcontracting work center, so that operation is the last operation (its Next Operation No. = blank). Certify the routing.
    • A certified Production BOM (e.g. two components). Assign both routing and BOM to the item and certify.
  2. Create and refresh a released production order for the item with Quantity = 5-10.
  3. Create subcontracting purchase order from the first routing line.
  4. the Purchase Order and Post it with Receive = Yes, Invoice = No (post the receipt only).
  5. Create a separate purchase invoice for the vendor and add a line of Type = Charge (Item) with Quantity = 1 and a Direct Unit Cost.
  6. On that charge line choose Line > Item Charge Assignment, Get Receipt Lines, pick the receipt line, then Suggest Item Charge Assignment
  7. Post the purchase invoice.
  8. Open Value Entries and filter to the entries where Item Charge No. is filled in. The charge points to an unrelated item ledger entry whose number happens to equal the capacity ledger entry number.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.