---
id: object/codeunit/6401
type: object
title: Codeunit 6401 "E-Document PEPPOL Utility"
summary: Codeunit 6401 "E-Document PEPPOL Utility" in EDocument (Microsoft.eServices.EDocument.Processing.Import). 14 public procedures. 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: 3500899dae1922d1ab6ea48fe83689cfded66c45b49d9019763b1c2be08ee0ce
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/EDocument/app/src/Processing/Import/StructureReceivedEDocument/EDocumentPEPPOLUtility.Codeunit.al
    title: src/Apps/W1/EDocument/app/src/Processing/Import/StructureReceivedEDocument/EDocumentPEPPOLUtility.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/9426
object_type: codeunit
object_id: 6401
name: E-Document PEPPOL Utility
namespace: Microsoft.eServices.EDocument.Processing.Import
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: 16
  events: 0
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 0
  called_by: 0
  implements: 0
---

# Codeunit 6401 "E-Document PEPPOL Utility"

> Codeunit 6401 "E-Document PEPPOL Utility" in EDocument (Microsoft.eServices.EDocument.Processing.Import). 14 public procedures. Introduced in BC29, still in BC30.

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

## Properties

| Property | Value |
|---|---|
| Access | Public |

## Procedures

- `InitializePEPPOL3Namespaces(var XmlNamespaces: XmlNamespaceManager)`: Registers the standard PEPPOL BIS 3.0 UBL namespace prefixes on the namespace manager so that subsequent XPath lookups can resolve cac, cbc, and document-type namespaces.
- `TryGetStringValue(XMLDocument: XmlDocument; XMLNamespaces: XmlNamespaceManager; Path: Text; var Value: Text): Boolean`: Reads the value at the specified XPath, resolving either an element's inner text or an attribute value.
- `SetStringValueInField(XMLDocument: XmlDocument; XMLNamespaces: XmlNamespaceManager; Path: Text; MaxLength: Integer; var Field: Text)`: Reads the value at the specified XPath and copies it into the destination field, truncated to the target length.
- `SetNumberValueInField(XMLDocument: XmlDocument; XMLNamespaces: XmlNamespaceManager; Path: Text; var DecimalValue: Decimal)`: Reads the value at the specified XPath and evaluates it into the destination decimal field when present.
- `SetDateValueInField(XMLDocument: XmlDocument; XMLNamespaces: XmlNamespaceManager; Path: Text; var DateValue: Date)`: Reads the value at the specified XPath and evaluates it into the destination date field when present.
- `SetCurrencyValueInField(XMLDocument: XmlDocument; XMLNamespaces: XmlNamespaceManager; Path: Text; MaxLength: Integer; var CurrencyCode: Code[10])`: Reads the currency code at the specified XPath and copies it into the destination field when it differs from the local currency.
- `GetNodeValue(XMLDocument: XmlDocument; XMLNamespaces: XmlNamespaceManager; Path: Text): Text`: Returns the value of the node or attribute at the specified XPath, or an empty string when the node is missing.
- `PopulateSupplierInfo(PeppolXML: XmlDocument; XmlNamespaces: XmlNamespaceManager; RootPath: Text; var Header: Record "E-Document Purchase Header")` (internal): Extracts AccountingSupplierParty and PayeeParty fields from a UBL document. Per PEPPOL BIS 3.0: PartyName is optional; RegistrationName is mandatory fallback. PayeeParty, when present, overrides vendor name and VAT ID. SchemeID 0088 on EndpointID = GLN.
- `PopulateCustomerInfo(PeppolXML: XmlDocument; XmlNamespaces: XmlNamespaceManager; RootPath: Text; var Header: Record "E-Document Purchase Header")` (internal): Extracts AccountingCustomerParty fields from a UBL document. Per PEPPOL BIS 3.0: PartyName is optional; RegistrationName is mandatory fallback. SchemeID 0088 on EndpointID = GLN. Customer Company Id stores schemeID:value.
- `PopulateAmountsAndDates(PeppolXML: XmlDocument; XmlNamespaces: XmlNamespaceManager; RootPath: Text; DueDatePath: Text; var Header: Record "E-Document Purchase Header")` (internal): Extracts LegalMonetaryTotal amounts, IssueDate, and DueDate from a UBL document. DueDatePath is parameterized because Invoice uses /cbc:DueDate while CreditNote uses /cac:PaymentMeans/cbc:PaymentDueDate.
- `PopulateCurrency(PeppolXML: XmlDocument; XmlNamespaces: XmlNamespaceManager; RootPath: Text; var Header: Record "E-Document Purchase Header")` (internal): Extracts DocumentCurrencyCode and applies the BC LCY-blank convention.
- `PopulatePurchaseLine(LineXML: XmlDocument; XmlNamespaces: XmlNamespaceManager; var Line: Record "E-Document Purchase Line"; LineElementName: Text; QuantityElementName: Text)` (internal): Populates a staging line record from a UBL InvoiceLine or CreditNoteLine element. LineElementName and QuantityElementName are parameterized to handle both document types.
- `ExtractAttachment(EDocument: Record "E-Document"; AttachmentXML: XmlDocument; XmlNamespaces: XmlNamespaceManager)` (internal): Extracts a single embedded base64 attachment from an AdditionalDocumentReference element. Skips external URI references and bare references without embedded content. Per PEPPOL BIS 3.0: @filename and @mimeCode are mandatory on EmbeddedDocumentBinaryObject.
- `SetCurrencyIfForeign(CurrencyFromXml: Text; var CurrencyCode: Code[10])`: BC convention: blank Currency Code means LCY. Sets the field to the currency code only if it differs from LCY. Explicitly blanks the field when it matches LCY.

Plus 2 local procedures.

## Recent changes

- 2026-07-23 [#9426 [E-Document Formats] Migrate NAV PRs 247170 and 247176 into BCApps](../../changes/bcapps/9426.md) (main, BC30, feature)

## 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-Document PEPPOL Utility")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
