---
id: object/codeunit/6120
type: object
title: Codeunit 6120 "E-Doc. Purchase Hist. Mapping"
summary: Codeunit 6120 "E-Doc. Purchase Hist. Mapping" in EDocument (Microsoft.eServices.EDocument.Processing.Import.Purchase). 6 public procedures, 2 event subscribers. Introduced in BC29, still in BC30.
tier: official
language: en
tags:
  - codeunit
  - edocument
versions:
  introduced: "29"
  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: ee0145478e0ec5892e8af6ea193042dc32a4e5a84a9d0157c887471c2d53c20b
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/EDocument/app/src/Processing/Import/Purchase/History/EDocPurchaseHistMapping.Codeunit.al
    title: src/Apps/W1/EDocument/app/src/Processing/Import/Purchase/History/EDocPurchaseHistMapping.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: 6120
name: E-Doc. Purchase Hist. Mapping
namespace: Microsoft.eServices.EDocument.Processing.Import.Purchase
app: EDocument
extends: null
first_version: "29"
last_version: "30"
present_in:
  - "29"
  - "30"
changed_in: []
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 11
  events: 0
  subscribers: 2
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 0
  called_by: 0
  implements: 0
---

# Codeunit 6120 "E-Doc. Purchase Hist. Mapping"

> Codeunit 6120 "E-Doc. Purchase Hist. Mapping" in EDocument (Microsoft.eServices.EDocument.Processing.Import.Purchase). 6 public procedures, 2 event subscribers. Introduced in BC29, still in BC30.

EDocument · Microsoft.eServices.EDocument.Processing.Import.Purchase · BC29-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/EDocument/app/src/Processing/Import/Purchase/History/EDocPurchaseHistMapping.Codeunit.al) · facts from BC29

## Properties

| Property | Value |
|---|---|
| Access | Internal |

## Event subscriptions

- OnAfterPurchInvLineInsertUpdateTracking subscribes to Codeunit "Purch.-Post" OnAfterPurchInvLineInsert
- OnAfterPostPurchaseDoc subscribes to Codeunit "Purch.-Post" OnAfterPostPurchaseDoc

## Procedures

- `FindRelatedPurchaseHeaderInHistory(EDocument: Record "E-Document"; var EDocVendorAssignmentHistory: Record "E-Doc. Vendor Assign. History"): Boolean`
- `UpdateMissingHeaderValuesFromHistory(EDocVendorAssignmentHistory: Record "E-Doc. Vendor Assign. History"; var EDocPurchaseHeader: Record "E-Document Purchase Header")`
- `FindRelatedPurchaseLineInHistory(VendorNo: Code[20]; EDocumentPurchaseLine: Record "E-Document Purchase Line"; var EDocPurchaseLineHistory: Record "E-Doc. Purchase Line History"): Boolean`
- `UpdateMissingLineValuesFromHistory(PurchInvLine: Record "Purch. Inv. Line"; var EDocumentPurchaseLine: Record "E-Document Purchase Line"; CustomExplanationTxt: Text[250]; MatchConfidence: Text)`: Takes a draft line EDocumentPurchaseLine and the corresponding historic record found for it PurchInvLine. If the values on the draft line have already been set by other mechanisms we don't assign it to avoid overwriting it.
- `ApplyAdditionalFieldsFromHistoryToPurchaseLine(EDocumentPurchaseLine: Record "E-Document Purchase Line"; var PurchaseLine: Record "Purchase Line")`: Applies the values configured as additional fields in the posted line, if the line had a historic match the values are retrieved from the Purchase Invoice Line.
- `OpenPageWithHistoricMatch(EDocumentPurchaseLine: Record "E-Document Purchase Line"): Boolean`

Plus 3 local procedures.

## Across versions

- Present in: BC29-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). 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: "E-Doc. Purchase Hist. Mapping")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
