Column Mapping
The module generates DATEV CSV/EXTF exports from a JSON mapping:
- JSON keys = DATEV column headers (as they appear in the export file)
- JSON values = expressions evaluated against the current invoice / credit memo
Overview
If you need to format values (dates, conditionals, functions), see: Mapping Language.
Configuration Location
Navigate to Stores >Configuration > MageB2B > DATEV Export Pro > Column Mapping Configuration
Screenshot placeholder: Column Mapping Configuration (Invoice / Credit Memo).
JSON Structure (CSV / EXTF)
{ "DATEV Column Header": "expression" }Example: Minimal Invoice Mapping
{ "Umsatz (ohne Soll/Haben-Kz)": "invoice.grand_total", "Soll/Haben-Kennzeichen": "'S'", "Konto": "invoice.order.customer.customer_debitor", "Gegenkonto (ohne BU-Schlüssel)": "function:getRevenueAccount", "Belegdatum": "invoice.created_at", "Belegfeld 1": "invoice.increment_id", "Buchungstext": "invoice.order.customer_firstname + ' ' + invoice.order.customer_lastname" }Common Expression Patterns
- Variable paths:
invoice.increment_id,invoice.order.billing_address.postcode - String literals:
'','EUR','S' - Concatenation:
invoice.order.customer_firstname + ' ' + invoice.order.customer_lastname - Templates:
{{invoice.increment_id}}orInvoice {{invoice.increment_id}} - Function calls:
function:getRevenueAccount,function:getTaxRate - Conditionals:
invoice.grand_total >0 ? 'S' : 'H' - Built-ins:
upper(...),trim(...),replace(...),number_format(...), etc.
Validation
Validate Mapping
Use Validate Mapping in the config UI:
- Checks JSON format
- Verifies that referenced
function:*calls exist
If validation fails, exports will fail with a mapping error.
Default Values For Missing Data
Configure defaults in:
- Variable Default Values → Default Values for NULL Variables (CSV)
{ "invoice.order.customer_firstname": "Guest", "invoice.order.customer_lastname": "Customer", "invoice.order.billing_address.postcode": "00000" }Important CSV Formatting Rules
The generator applies special formatting to keep exports DATEV-compatible:
- Amounts are formatted with decimal comma (e.g.
1234,56). - Dates are normalized when the column header contains
Datum. - Two columns are handled explicitly:
Umsatz (ohne Soll/Haben-Kz)is always taken from the document grand total and formatted as amount.Belegdatumis formatted from the document creation date.
Separate Mappings
Invoice Mapping
Configure mapping for invoices in Invoice Column Mapping field.
Credit Memo Mapping
Configure mapping for credit memos in Credit Memo Column Mapping field.
Why separate? Credit memos often require different mappings (e.g., negative amounts, different account numbers).
Best Practices
- Export a small date range first and validate the output in DATEV
- Keep mappings in version control (copy the JSON into your project docs)
- Prefer
function:*calls for logic that depends on country / VAT rules
Troubleshooting
Export Fails with Mapping Error
Check:
- JSON syntax is valid
- All required DATEV columns are present for your DATEV import workflow
function:*calls exist (use Validate Mapping)
Missing Data in Export
Check:
- Variable path exists for the current document
- Default values are configured
- Mapping includes the field
Wrong Data Format
Check:
- Date columns contain valid date strings (the exporter formats them automatically)
- Amount columns are numeric (the exporter formats them automatically)
Related Features
- Manual Export - Perform exports with your mappings
- Automated Exports - Schedule automatic exports
- Mapping Language - Full reference (functions, conditionals, built-ins)
- XML Export - XML mapping configuration
