> 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/architektur-und-prozessflusse/express-label-und-rateprozess.md).

# Express-Label- und Rateprozess

## Labelprozess

`GenerateLabel` dispatcht bei `API Service = Express` an den MyDHL-Pfad.

1. Konfiguration und Express-Account laden.
2. Empfänger-Snapshot und repräsentativen Auftrag bestimmen. Dabei wird `OnAfterSnapshotFromSalesHeader` vor dem Persistieren ausgelöst.
3. `OnBeforeGenerateLabel` mit `IsExpress = true` auslösen.
4. Box, Produktcode und normalisierte Dimensionen ermitteln.
5. Gewicht und Uploadstatus prüfen.
6. geplantes Versanddatum, Pickup, Account und Ausgabeformat setzen.
7. Shipper- und Receiver-Details aufbauen.
8. Package und Content hinzufügen.
9. Bei internationaler Route Export Declaration ergänzen.
10. Optional Empfängerbenachrichtigung hinzufügen.
11. `OnBeforeSendShipmentRequest` veröffentlichen.
12. JSON serialisieren und den Shipment-Endpunkt aufrufen.
13. Tracking, Package Tracking und Labeldokument aus der Response speichern.
14. Tracking auf Quellaufträge zurückschreiben; je Auftrag folgt `OnAfterUpdateTrackingOnSourceOrder`.
15. Labelbild erzeugen und Paket als hochgeladen markieren.
16. Label committen und optional Kartonbestand buchen.
17. `OnAfterGenerateLabel` mit `Success = true` auslösen. Jeder Fehlerrückgabepfad von `GenerateLabel` löst dasselbe Event mit `Success = false` aus.

## Erweiterungspunkte

`OnBeforeGenerateLabel` erlaubt fachliche Header-Anpassungen, bevor Maße und Request gelesen werden.

`OnBeforeSendShipmentRequest` erhält das vollständig aufgebaute `JsonObject`, Package Header und Sales Header. Es wird nur für Express ausgelöst. Typische Nutzung ist die fachliche Auswahl eines Produktcodes oder zusätzlicher DHL-Services.

Subscriber dürfen keine Authentifizierung verwalten und sollten das Request-JSON wegen personenbezogener Daten nicht protokollieren.

## Express-Produkt

`SOUDHL Express Helper.MapProductCode` übersetzt das erweiterbare Enum `SOUDHL Express Product` in den MyDHL-Code. Ohne passende Zuordnung fällt die Helper-Codeunit auf `P` zurück.

## Export Declaration

Bei unterschiedlichem Absender- und Empfängerland wird `isCustomsDeclarable` gesetzt. Die Exportpositionen werden aus den Package Lines und deren Quell-Verkaufszeilen erzeugt, damit nur tatsächlich gepackte Mengen übertragen werden.

## Response

Verarbeitet werden:

* `shipmentTrackingNumber`
* erstes Package-`trackingNumber`
* Dokumente mit `typeCode = label`
* Encoding- und Formatangaben

Das Package-Tracking wird derzeit im Feld `DHL Routing Code` wiederverwendet.

## Live-Rateprozess

`GetRate` ist ein separater High-Level-Aufruf:

1. `OnBeforeGetRate` für veränderbare fachliche Eingaben,
2. nur Express zulassen,
3. Account und Shipper-Adresse laden,
4. Receiver, Produkt, Versandzeit und Package-Daten aufbauen,
5. Rate-Endpunkt aufrufen,
6. ersten Eintrag aus `products[0].totalPrice[0]` lesen,
7. `OnAfterGetRate` auf jedem Rückgabepfad, einschließlich „nicht Express“.

Die öffentliche `GetRate`-Signatur bleibt unverändert. Die Methode schreibt keine DHL-Tabellen. Preis und Währung werden über `var`-Parameter zurückgegeben.

## Bekannte Grenzen

* geplante Versandzeit ist derzeit `Today + 1` um 10:00 mit festem GMT+01:00-Text,
* Rate nimmt den ersten zurückgegebenen Produktpreis,
* `OnBeforeSendShipmentRequest` gilt nicht für Rates und nicht für Parcel DE,
* Hintergrundprozesse müssen alle Exportdaten vorab vollständig bereitstellen.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.solutioo.de/entwicklerdokumentationen-business-central-dhl-connector/dhl-connector-entwicklerdokumentation/architektur-und-prozessflusse/express-label-und-rateprozess.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
