> For the complete documentation index, see [llms.txt](https://docs.solutioo.de/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.solutioo.de/entwicklerdokumentationen-business-central-dhl-connector/dhl-connector-entwicklerdokumentation/codeunit-referenz/72242969-soudhl-tariff-import-mgt.md).

# 72242969 SOUDHL Tariff Import Mgt

## Verantwortung

Importiert DHL-Vertragstarife aus einem festen Excel-Schema in Staging-Tabellen, validiert jede Zelle und aktiviert eine konsistente Tarifversion.

## Öffentliche Procedures

### `ImportWorkbook(): Integer`

Öffnet den XLSX-Upload, legt einen Import Batch an, liest alle kanonischen Sheets in Import Lines und ruft `ValidateBatch` auf. Rückgabe ist die Batch No.; Abbruch liefert 0.

### `CreateEmptyTemplate()`

Erzeugt und lädt eine leere Vorlage mit den sieben Sheets und allen erwarteten Spalten herunter.

### `ValidateBatch(BatchNo: Integer)`

Setzt alte Fehler zurück und prüft:

* Pflicht-Sheets und Spalten,
* mindestens eine relevante Datenzeile,
* Pflichtwerte je Zeile,
* Datum, Decimal, Boolean und Enum-Formate,
* Länder, Währungen, Produkte und Zonenreferenzen,
* genau eine Tarif-/Versionskombination.

Status wird `Validated` oder `Error`; `Error Count` wird aktualisiert.

### `ActivateBatch(BatchNo: Integer)`

Validiert erneut, verwirft eine vorhandene nichtaktive identische Version, importiert alle sieben Datenbereiche und ruft `SOUDHL Tariff Validation Mgt.ActivateTariff` auf. Aktive identische Versionen werden nicht ersetzt.

### Normalisierung und Referenzprüfung

* `NormalizeCountryCode(CountryCode: Text): Code[10]` – Trim, Uppercase, EL → GR.
* `IsValidCurrencyCode(CurrencyCode: Code[10]): Boolean` – Currency-Stamm oder LCY.
* `IsValidCountryCode(CountryCode: Code[10]): Boolean` – ISO-2 plus Country-Stamm oder Installation-Lookup.

## Interne Methodengruppen

### Upload und Staging

`CreateBatch`, `ReadSheet`, `NormalizeHeader`, `NormalizeCellValue`, `AddBatchError`.

### Struktur- und Zeilenvalidierung

`CheckRequiredValue`, `ValidateRequiredColumns`, `CheckRequiredColumns`, `SheetHasHeader`, `ColumnExists`, `ValidateRequiredRows`, `CheckRequiredRows`, `RowHasData`.

### Formate und Referenzen

`ValidateCellFormats`, `ValidateReferences`, `SetReferenceError`, `StagedValueExists`.

### Aktivierung

`DeleteImportedVersion`, `DeleteVersionData`, `ImportPriceLists`, `ImportProducts`, `ImportZones`, `ImportDestinations`, `ImportRates`, `ImportCharges`, `ImportIndexValues`.

### Parser und Template

`SetProductKeys`, `GetValue`, `GetMaxRow`, `EvaluateDate`, `EvaluateDecimal`, `EvaluateInteger`, `EvaluateBoolean`, `EvaluateOptionalEnum`, `EvaluateOptionalExpressEnum`, `GetSheetNames`, `AddTemplateSheet`, `AddColumns`.

## Fehlercodes

`MISSING_SHEET`, `MISSING_COLUMN`, `REQUIRED_VALUE`, `INVALID_FORMAT`, `UNKNOWN_REFERENCE`.

## Datenwirkung

Persistente Import Batches/Lines und Tarifstammdaten. Aktivierung kann ältere überlappende Versionen archivieren.

## Externe Verwendung

Administration über Import Wizard bevorzugen. Automatisierungen dürfen die vier High-Level-Methoden verwenden, müssen aber Batchstatus und Fehlerzeilen auswerten.


---

# 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.solutioo.de/entwicklerdokumentationen-business-central-dhl-connector/dhl-connector-entwicklerdokumentation/codeunit-referenz/72242969-soudhl-tariff-import-mgt.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.
