---
id: object/codeunit/7021
type: object
title: Codeunit 7021 "Purchase Line - Price"
summary: Codeunit 7021 "Purchase Line - Price" in Base Application (Microsoft.Purchases.Pricing). 18 public procedures, 12 events. Present since at least BC23, still in BC30.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: null
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: 9cd99f7e62c56d642a8b9a3e3673e87e57cde9100815a92cad1843e27f850a31
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Purchases/Pricing/PurchaseLinePrice.Codeunit.al
    title: src/Layers/W1/BaseApp/Purchases/Pricing/PurchaseLinePrice.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
object_type: codeunit
object_id: 7021
name: Purchase Line - Price
namespace: Microsoft.Purchases.Pricing
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in: []
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 35
  events: 12
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 2
  called_by: 0
  implements: 1
---

# Codeunit 7021 "Purchase Line - Price"

> Codeunit 7021 "Purchase Line - Price" in Base Application (Microsoft.Purchases.Pricing). 18 public procedures, 12 events. Present since at least BC23, still in BC30.

Base Application · Microsoft.Purchases.Pricing · BC23-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Purchases/Pricing/PurchaseLinePrice.Codeunit.al) · facts from BC29

## Events published

- `OnAfterAddSources(PurchaseHeader: Record "Purchase Header"; PurchaseLine: Record "Purchase Line"; PriceType: Enum "Price Type"; var PriceSourceList: Codeunit "Price Source List")` (integration)
- `OnAfterFillBuffer(var PriceCalculationBuffer: Record "Price Calculation Buffer"; PurchaseHeader: Record "Purchase Header"; PurchaseLine: Record "Purchase Line")` (integration)
- `OnAfterIsDiscountAllowed(PurchaseLine: Record "Purchase Line"; PriceCalculated: Boolean; var Result: Boolean)` (integration)
- `OnAfterGetAssetType(PurchaseLine: Record "Purchase Line"; var AssetType: Enum "Price Asset Type")` (integration)
- `OnAfterGetDocumentDate(var DocumentDate: Date; PurchaseHeader: Record "Purchase Header"; PurchaseLine: Record "Purchase Line")` (integration)
- `OnAfterIsPriceUpdateNeeded(AmountType: Enum "Price Amount Type"; FoundPrice: Boolean; CalledByFieldNo: Integer; PurchaseLine: Record "Purchase Line"; var Result: Boolean; IsSKU: Boolean)` (integration)
- `OnAfterSetPrice(var PurchaseLine: Record "Purchase Line"; PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type"; CurrPriceType: Enum "Price Type"; var PurchaseHeader: Record "Purchase Header")` (integration)
- `OnAfterUpdate(var PurchaseLine: Record "Purchase Line"; CurrPriceType: Enum "Price Type"; AmountType: Enum "Price Amount Type"; var PurchaseHeader: Record "Purchase Header")` (integration)
- `OnAfterValidatePrice(var PurchaseLine: Record "Purchase Line"; CurrPriceType: Enum "Price Type"; AmountType: Enum "Price Amount Type"; var PurchaseHeader: Record "Purchase Header")` (integration)
- `OnBeforeVerify(PurchaseHeader: Record "Purchase Header"; PurchaseLine: Record "Purchase Line"; var IsHandled: Boolean)` (integration)
- `OnBeforeSetPrice(var PurchaseLine: Record "Purchase Line"; PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type"; var IsHandled: Boolean; CurrPriceType: Enum "Price Type"; var PurchaseHeader: Record "Purchase Header")` (integration)
- `OnBeforeCopyToBuffer(var PurchaseHeader: Record "Purchase Header"; var PurchaseLine: Record "Purchase Line")` (integration)

## Procedures

- `GetTableNo(): Integer`
- `SetLine(PriceType: Enum "Price Type"; Line: Variant)`
- `SetLine(PriceType: Enum "Price Type"; Header: Variant; Line: Variant)`
- `SetSources(var NewPriceSourceList: codeunit "Price Source List")`
- `SetPurchaseQtyInvoice(ErrorInfo: ErrorInfo)`
- `SetPurchaseReceiveQty(ErrorInfo: ErrorInfo)`
- `GetLine(var Line: Variant)`
- `GetLine(var Header: Variant; var Line: Variant)`
- `GetPriceType(): Enum "Price Type"`
- `IsPriceUpdateNeeded(AmountType: Enum "Price Amount Type"; FoundPrice: Boolean; CalledByFieldNo: Integer): Boolean`
- `IsDiscountAllowed(): Boolean`
- `Verify()`
- `SetAssetSourceForSetup(var DtldPriceCalculationSetup: Record "Dtld. Price Calculation Setup"): Boolean`
- `GetAssetType(): Enum "Price Asset Type"`
- `CopyToBuffer(var PriceCalculationBufferMgt: Codeunit "Price Calculation Buffer Mgt."): Boolean`
- `SetPrice(AmountType: enum "Price Amount Type"; PriceListLine: Record "Price List Line")`
- `ValidatePrice(AmountType: enum "Price Amount Type")`
- `Update(AmountType: enum "Price Amount Type")`

Plus 5 local procedures.

## Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Codeunit 7011 "Price Source List"](../codeunit/7011.md) (5 calls: `AddSources → AddJobAsSources`, `AddSources → Init`, `AddVendorSources → Add`, …)
- [Codeunit 7008 "Price Calculation Buffer Mgt."](../codeunit/7008.md) (1 call: `CopyToBuffer → Set`)

## Implements

- [Interface "Line With Price"](../interface/line-with-price.md)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: none

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "Purchase Line - Price")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
