> For the complete documentation index, see [llms.txt](https://docs.younium.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.younium.com/erp-and-accounting-integrations/datev.md).

# DATEV

## Overview

The DATEV integration exports Younium data into DATEV-compatible formats for import into DATEV accounting software. It does not post invoices to an external ERP API on `InvoicePosted`. Export covers customer/debtor master data, accounting journal booking stacks, and recurring booking lines derived from Younium journals and transactions.

DATEV settings are saved and deleted from the integration settings screen; the export itself is produced when you request it.

***

## Authentication

There is no connection to DATEV Online, and no credentials to configure. The export is generated from your Younium data and returned as a file to download.

***

## Activation and setup

There is nothing to activate. The export is available as soon as the integration settings exist for the tenant, and the only choice to make is how account numbers are formatted.

| Setting                             | Description                                                             |
| ----------------------------------- | ----------------------------------------------------------------------- |
| `AppendTrailingZeroToAccountNumber` | When true, formats account numbers with a trailing zero per DATEV rules |

***

## Export workflows

### Customer / debtor export (`GetDatev()`)

Produces `DatevData<DatevCustomerEntry>` with DATEV debtors/creditors header from `DatevHeaderHelper.CreateDebtorsCreditorsHeader` (GL account length from repository).

| Younium field                                | DATEV export field            |
| -------------------------------------------- | ----------------------------- |
| `Account.AccountNumber` (formatted)          | `Konto`                       |
| `Account.Name` (max 50)                      | `NameAdressattypUnternehmen`  |
| VAT country from `TaxRegistrationNumber`     | `EULand`, `EUUStID`           |
| `DefaultInvoiceAddress.Street`               | `Strasse`                     |
| `DefaultInvoiceAddress.Zip`                  | `Postleitzahl`                |
| `DefaultInvoiceAddress.City`                 | `Ort`                         |
| `DefaultInvoiceAddress.Country.TwoAlphaCode` | `Land`                        |
| —                                            | `Adressatentyp` = 2 (company) |

Per-account errors are collected in `errorResult` without stopping the whole export.

### Journal export (`GetDatev(journalId)`)

Loads journal via `GetJournalForDatevAsync`. Behaviour depends on `JournalType`:

* **Invoice journal:** `BuildInvoiceDatevLines` from invoice postings.
* **Other journals:** `BuildDatevLines` from transactions (split postings, aggregate by key).

The header identifies the file as a DATEV booking stack. Validation reports an error when the export would contain no rows (GEN-007).

### Journal line (non-invoice transactions) — core mapping

| Younium source                 | DATEV field                                                         |
| ------------------------------ | ------------------------------------------------------------------- |
| Posting financial account code | `Konto`, `Gegenkonto`                                               |
| Debit/credit amounts           | `Umsatz`, `BasisUmsatz`, `WKZUmsatz`, `WKZBasicUmsatz`              |
| Credit flag                    | `SollOrHabenKennzeichen`                                            |
| Invoice date or effective date | `Belegdatum` (`ddMM` style per `DatevConstants.DateFormatDayMonth`) |
| Invoice number or description  | `Belegfeld1`, `Buchungstext`                                        |

Entries with `Konto == Gegenkonto` or `Umsatz <= 0` generate validation errors RB-005 / RB-006. Duplicate keys merge amounts.

### Invoice journal lines

Invoice totals and account numbers are mapped into journal lines, with amounts and debit or credit indicators adjusted for credit documents.

***

## Post invoice workflow

**Not applicable.** DATEV is not registered in `IntegrationStartup` for `InvoicePosted`. Invoice-related DATEV output is produced when exporting an **invoice journal** by id, not when posting a customer invoice in Younium.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.younium.com/erp-and-accounting-integrations/datev.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
