---
id: object/codeunit/13917-de
type: object
title: Codeunit 13917 "Export ZUGFeRD Document" (DE)
summary: Codeunit 13917 "Export ZUGFeRD Document" (DE) in the DE country layer (Microsoft.eServices.EDocument.Formats). 23 public procedures, 20 events. Introduced in BC29, still in BC30.
tier: official
language: en
tags:
  - codeunit
  - de layer
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: 19cf2494dd5f0d1019c451b1144a1547e9964010a9e74ada1ddcb6b329a80aba
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/DE/EDocumentDE/app/src/ZUGFeRD/ExportZUGFeRDDocument.Codeunit.al
    title: src/Apps/DE/EDocumentDE/app/src/ZUGFeRD/ExportZUGFeRDDocument.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations:
    - localization/de
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/9347
    - change/bcapps/8429
    - change/bcapps/9642
    - change/bcapps/9860
    - change/bcapps/10631
    - change/bcapps/10349
    - change/bcapps/10342
    - change/bcapps/10048
    - change/bcapps/9878
object_type: codeunit
object_id: 13917
name: Export ZUGFeRD Document
namespace: Microsoft.eServices.EDocument.Formats
app: EDocumentDE
extends: null
first_version: "29"
last_version: "30"
present_in:
  - "29"
  - "30"
changed_in: []
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
country: DE
counts:
  fields: 0
  procedures: 127
  events: 20
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
---

# Codeunit 13917 "Export ZUGFeRD Document" (DE)

> Codeunit 13917 "Export ZUGFeRD Document" (DE) in the DE country layer (Microsoft.eServices.EDocument.Formats). 23 public procedures, 20 events. Introduced in BC29, still in BC30.

DE country layer · Microsoft.eServices.EDocument.Formats · BC29-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/DE/EDocumentDE/app/src/ZUGFeRD/ExportZUGFeRDDocument.Codeunit.al) · facts from BC29

An object of the [DE localization](../../localizations/de.md), not part of W1.

## Properties

| Property | Value |
|---|---|
| TableNo | Record Export Buffer |

## Events published

- `OnIsZUGFeRDPrintProcess(var Result: Boolean)` (internal)
- `OnAfterFindEDocumentService(var EDocumentService: Record "E-Document Service")` (integration)
- `OnAfterInsertSalesInvHeaderData(var XMLCurrNode: XmlElement; SalesInvoiceHeader: Record "Sales Invoice Header")` (integration)
- `OnCreateXMLOnBeforeSalesInvXmlDocumentWriteToFile(var XMLDoc: XmlDocument; SalesInvoiceHeader: Record "Sales Invoice Header")` (integration)
- `OnDocumentLinesExistOnAfterFilterSalesInvLine(var SalesInvoiceHeader: Record "Sales Invoice Header"; var SalesInvLine: Record "Sales Invoice Line")` (integration)
- `OnAfterInsertSalesCrMemoHeaderData(var XMLCurrNode: XmlElement; SalesCrMemoHeader: Record "Sales Cr.Memo Header")` (integration)
- `OnCreateXMLOnBeforeSalesCrMemoXmlDocumentWriteToFile(var XMLDoc: XmlDocument; SalesCrMemoHeader: Record "Sales Cr.Memo Header")` (integration)
- `OnDocumentLinesExistOnAfterFilterSalesCrMemoLine(var SalesCrMemoHeader: Record "Sales Cr.Memo Header"; var SalesCrMemoLine: Record "Sales Cr.Memo Line")` (integration)
- `OnAfterCalculateInvoiceLineAmounts(var SalesInvoiceHeader: Record "Sales Invoice Header"; var SalesInvLine: Record "Sales Invoice Line"; Currency: Record Currency; var LineAmounts: Dictionary of [Text, Decimal])` (integration)
- `OnAfterCalculateCrMemoLineAmounts(var SalesCrMemoHeader: Record "Sales Cr.Memo Header"; var SalesCrMemoLine: Record "Sales Cr.Memo Line"; Currency: Record Currency; var LineAmounts: Dictionary of [Text, Decimal])` (integration)
- `OnBeforeGenerateSalesInvoicePDFAttachment(SalesInvoiceHeader: Record "Sales Invoice Header"; var TempBlob: Codeunit "Temp Blob"; var IsHandled: Boolean)` (integration)
- `OnBeforeGenerateSalesCrMemoPDFAttachment(SalesCrMemoHeader: Record "Sales Cr.Memo Header"; var TempBlob: Codeunit "Temp Blob"; var IsHandled: Boolean)` (integration)
- `OnBeforeGenerateServiceInvoicePDFAttachment(ServiceInvoiceHeader: Record "Service Invoice Header"; var TempBlob: Codeunit "Temp Blob"; var IsHandled: Boolean)` (integration)
- `OnBeforeGenerateServiceCrMemoPDFAttachment(ServiceCrMemoHeader: Record "Service Cr.Memo Header"; var TempBlob: Codeunit "Temp Blob"; var IsHandled: Boolean)` (integration)
- `OnAfterGetSetups(var CompanyInformation: Record "Company Information"; var GeneralLedgerSetup: Record "General Ledger Setup")` (integration)
- `OnBeforeInsertInvoiceLine(var SupplyChainTradeTransactionElement: XmlElement; var SalesInvoiceLine: Record "Sales Invoice Line"; Currency: Record Currency; CurrencyCode: Code[10]; PricesIncVAT: Boolean; var IsHandled: Boolean)` (integration)
- `OnBeforeAddInvoiceLineElement(var InvoiceLineElement: XmlElement; var SalesInvoiceLine: Record "Sales Invoice Line"; Currency: Record Currency; CurrencyCode: Code[10]; PricesIncVAT: Boolean)` (integration)
- `OnBeforeInsertCrMemoLine(var SupplyChainTradeTransactionElement: XmlElement; var SalesCrMemoLine: Record "Sales Cr.Memo Line"; Currency: Record Currency; CurrencyCode: Code[10]; PricesIncVAT: Boolean; var IsHandled: Boolean)` (integration)
- `OnBeforeAddCrMemoLineElement(var CrMemoLineElement: XmlElement; var SalesCrMemoLine: Record "Sales Cr.Memo Line"; Currency: Record Currency; CurrencyCode: Code[10]; PricesIncVAT: Boolean)` (integration)
- `OnAfterInsertApplicableHeaderTradeAgreement(var HeaderTradeAgreementElement: XmlElement; HeaderRecordRef: RecordRef)` (integration)

## Procedures

- `IsZUGFeRDPrintProcess(): Boolean`: Use this procedure to check if the current report print is for the ZUGFeRD export.
- `CreateAndAddXMLAttachmentToRenderingPayload(var SalesInvoiceHeader: Record "Sales Invoice Header"; var RenderingPayload: JsonObject)`: Creates a ZUGFeRD XML document from the sales invoice and adds it as an attachment to the rendering payload.
- `CreateAndAddXMLAttachmentToRenderingPayload(var SalesCrMemoHeader: Record "Sales Cr.Memo Header"; var RenderingPayload: JsonObject)`: Creates a ZUGFeRD XML document from the sales credit memo and adds it as an attachment to the rendering payload.
- `CreateAndAddXMLAttachmentToRenderingPayload(var ServiceInvoiceHeader: Record "Service Invoice Header"; var RenderingPayload: JsonObject)`: Creates a ZUGFeRD XML document from the service invoice and adds it as an attachment to the rendering payload.
- `CreateAndAddXMLAttachmentToRenderingPayload(var ServiceCrMemoHeader: Record "Service Cr.Memo Header"; var RenderingPayload: JsonObject)`: Creates a ZUGFeRD XML document from the service credit memo and adds it as an attachment to the rendering payload.
- `ExportSalesDocument(var RecordExportBuffer: Record "Record Export Buffer")`
- `GenerateSalesInvoicePDFAttachment(SalesInvoiceHeader: Record "Sales Invoice Header"; var TempBlob: Codeunit "Temp Blob"): Boolean`
- `GenerateSalesCrMemoPDFAttachment(SalesCrMemoHeader: Record "Sales Cr.Memo Header"; var TempBlob: Codeunit "Temp Blob"): Boolean`
- `GenerateServiceInvoicePDFAttachment(ServiceInvoiceHeader: Record "Service Invoice Header"; var TempBlob: Codeunit "Temp Blob"): Boolean`
- `GenerateServiceCrMemoPDFAttachment(ServiceCrMemoHeader: Record "Service Cr.Memo Header"; var TempBlob: Codeunit "Temp Blob"): Boolean`
- `CreateXML(SalesInvoiceHeader: Record "Sales Invoice Header"; var FileOutstream: Outstream)`
- `CreateXML(SalesCrMemoHeader: Record "Sales Cr.Memo Header"; var FileOutstream: Outstream)`
- `CreateXML(ServiceInvoiceHeader: Record "Service Invoice Header"; var FileOutstream: Outstream)`
- `CreateXML(ServiceCrMemoHeader: Record "Service Cr.Memo Header"; var FileOutstream: Outstream)`
- `InsertSupplyChainTradeTransaction(var RootXMLNode: XmlElement; SalesInvoiceHeader: Record "Sales Invoice Header"; var SalesInvoiceLine: Record "Sales Invoice Line"; CurrencyCode: Code[10]; Currency: Record Currency; var LineAmount: Dictionary of [Decimal, Decimal]; var LineVATAmount: Dictionary of [Decimal, Decimal]; var LineAmounts: Dictionary of [Text, Decimal]; var LineDiscAmount: Dictionary of [Decimal, Decimal])`
- `InsertSupplyChainTradeTransaction(var RootXMLNode: XmlElement; SalesCrMemoHeader: Record "Sales Cr.Memo Header"; var SalesCrMemoLine: Record "Sales Cr.Memo Line"; CurrencyCode: Code[10]; Currency: Record Currency; var LineAmount: Dictionary of [Decimal, Decimal]; var LineVATAmount: Dictionary of [Decimal, Decimal]; var LineAmounts: Dictionary of [Text, Decimal]; var LineDiscAmount: Dictionary of [Decimal, Decimal])`
- `FormatDate(VarDate: Date): Text[20]`
- `FormatDecimal(VarDecimal: Decimal): Text`
- `FormatDecimalUnlimited(VarDecimal: Decimal): Text`
- `FormatFourDecimal(VarDecimal: Decimal): Text` (obsolete 29.0: FormatFourDecimal is no longer used internally. Quantity and unit price fields are now exported with unlimited precision per EN 16931. For VAT percentages, use FormatFiveDecimal. For quantity and unit price, use FormatDecimalUnlimited.)
- `FormatFiveDecimal(VarDecimal: Decimal): Text`
- `GetUoMCode(UoMCode: Code[10]): Text`
- `GetVATRegistrationNo(VATRegistrationNo: Text[20]; CountryRegionCode: Code[10]): Text[30]`

Plus 84 local procedures.

## Triggers

OnRun

## Recent changes

- 2026-10-06 [#9347 Fix IssueDate in E-Documents for Germany](../../changes/bcapps/9347.md) (main, BC30, fix)
- 2026-10-02 [#8429 E-Document DE: map Payment Method to PEPPOL payment means codes, add SEPA Direct Debit export support](../../changes/bcapps/8429.md) (main, BC30, feature)
- 2026-09-29 [#9642 [Bug]: E-Documents for Germany - FindEDocumentService always selects last matching service, ignoring which service triggered the export](../../changes/bcapps/9642.md) (main, BC30, fix)
- 2026-09-05 [#9860 [Bug]: [DE] XRechnung/ZUGFeRD - Item Charge lines exported without a valid unit of measure code (BR-CL-23 / BR-23 on BT-130)](../../changes/bcapps/9860.md) (main, BC30, fix)
- 2026-08-26 [#10631 Integration/main to releases 29.x 31a860b5](../../changes/bcapps/10631.md) (releases/29.x, BC29, feature)
- 2026-08-24 [#10349 [DE] Support registration numbers in E-Documents](../../changes/bcapps/10349.md) (main, BC30, feature)
- 2026-08-20 [#10342 Add GLN information to XRechnung and ZUGFeRD exports](../../changes/bcapps/10342.md) (main, BC30, feature)
- 2026-08-12 [#10048 Add GTIN to XRechnung and ZUGFeRD exports](../../changes/bcapps/10048.md) (main, BC30, feature)
- 2026-08-12 [#9878 Add buyer order reference to ZUGFeRD export](../../changes/bcapps/9878.md) (main, BC30, feature)

## Across versions

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

## Deprecations

- procedure FormatFourDecimal: Pending 29.0 (#if not CLEAN29), "FormatFourDecimal is no longer used internally. Quantity and unit price fields are now exported with unlimited precision per EN 16931. For VAT percentages, use FormatFiveDecimal. For quantity and unit price, use FormatDecimalUnlimited."

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: "Export ZUGFeRD Document")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.

A DE country object, not part of W1: the default corpus does not have it; `bcatlas_list_countries` shows which countries the atlas has.
