---
id: change/bcapps/12333
type: change
title: "#12333 Keep the draft unit of measure and variant code when creating the purchase line"
summary: Unit of measure and variant code on purchase draft lines now persist when creating the final purchase invoice line.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - codeunit e-doc. purch. doc. helper
  - table e-document purchase line
system: integration
review:
  state: reviewed
  by: opus
  at: "2026-10-16T01:17:14.488Z"
  flags: []
generated:
  at: "2026-11-25T00:13:20.045Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 13b223a8f5952d294130528640ee3768298dd295
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/12333
    title: "microsoft/BCApps#12333: Keep the draft unit of measure and variant code when creating the purchase line"
    date: "2026-10-13"
    commit: 13b223a8f5952d294130528640ee3768298dd295
    t: null
    quote: Moved both to after the No. and Item Reference validations, through Validate so Qty. per Unit of Measure stays right.
links:
  learn: []
  objects:
    - object/codeunit/6402
    - object/table/6101
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
  related:
    - to: https://learn.microsoft.com/dynamics365/business-central/match-purchase-invoice-drafts-to-orders
      title: Match Purchase Invoice Drafts to Purchase Orders
      label: possibly related
      why: E-document purchase line unit of measure handling relates to matching invoices to purchase orders.
      by: model
number: 12333
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/12333
kind: pr
base_branch: main
major: "30"
merged_at: "2026-10-13T10:10:46Z"
author: Explorer986
author_type: User
community_contribution: false
labels:
  - "AL: Apps (W1)"
  - "Team: Integrations"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 3
  additions: 371
  deletions: 3
  al: 2
apps:
  - EDocument
objects_touched:
  - key: codeunit/6402
    page: codeunit/6402
    type: codeunit
    id: 6402
    name: E-Doc. Purch. Doc. Helper
    app: EDocument
    status: modified
  - key: table/6101
    page: table/6101
    type: table
    id: 6101
    name: E-Document Purchase Line
    app: EDocument
    status: modified
objects_unjoined: []
obsoletions: []
backports:
  - number: 13067
    base: releases/29.x
    url: https://github.com/microsoft/BCApps/pull/13067
fixes_issues: []
work_items:
  - 650977
systems:
  - integration
quote: Moved both to after the No. and Item Reference validations, through Validate so Qty. per Unit of Measure stays right.
joined_against:
  major: "30"
  commit: f18567dc08e2bd162bf192e1da4d714b57eb099f
---

# #12333 Keep the draft unit of measure and variant code when creating the purchase line

> Unit of measure and variant code on purchase draft lines now persist when creating the final purchase invoice line.

[Pull request](https://github.com/microsoft/BCApps/pull/12333) · merged into `main` (BC30) on 2026-10-13 by Explorer986 · 3 files (+371 -3), 2 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Moved unit of measure and variant code assignment to after No. and Item Reference validation
- Validation now occurs through proper Validate calls to maintain Qty. per Unit of Measure consistency
- Prevents unit of measure from being dropped or reset to item default during finalization
- Invalid unit of measure now triggers e-document error context instead of silent default
- Comprehensive test coverage added for the scenario
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 6402 "E-Doc. Purch. Doc. Helper"](../../objects/codeunit/6402.md), EDocument: modified
- [Table 6101 "E-Document Purchase Line"](../../objects/table/6101.md), EDocument: modified

## Also merged into

- [#13067](https://github.com/microsoft/BCApps/pull/13067) into `releases/29.x` on 2026-10-22

## Context

- Work items: AB#650977
- Labels: AL: Apps (W1), Team: Integrations
- Systems: integration
- From the description: "Moved both to after the No. and Item Reference validations, through Validate so Qty. per Unit of Measure stays right."

## Possibly related

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

- [Match Purchase Invoice Drafts to Purchase Orders](https://learn.microsoft.com/dynamics365/business-central/match-purchase-invoice-drafts-to-orders) — possibly related: E-document purchase line unit of measure handling relates to matching invoices to purchase orders. (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).
