Skip to content

Developer Interface

This page is for AL developers and integrators who create DPD labels without the Create Label Dialog: from their own AL code through the hub, or from an external system through the merchantCENTRAL Integration API. It is not required for normal use of the app.

Both routes take the same path as the dialog: licence check, product resolution, tracking entry and the hub events all apply.

Object Purpose
ALN MC Shipment Mgmt. (hub, codeunit 73334603) Carrier-neutral hub entry point, also used by the REST API
ALN MCDPD MC Integration (codeunit 73334825) Connector logic; receives the service selection and publishes the DPD events
ALN MCDPD Additional Service (enum 73334845) The service codes of the additional services
ALN MCDPD Label Service (table 73334836) Additional services per label, as they are sent to DPD

Label from code

A label without particular services takes two hub procedures, exactly like the Create Label (1-Click) action on the sales order:

var
    ShipmentMgmt: Codeunit "ALN MC Shipment Mgmt.";
    EntryNo: Integer;
begin
    EntryNo := ShipmentMgmt.CreateLabel('DPD', 'SO-2026-01187');
end;

To add services, CreateLabelWithDetails accepts a hub service selection (ALN MC Label Svc. Selection). The Service Code is the name of the enum value in ALN MCDPD Additional Service, spelled exactly like that:

var
    ShipmentMgmt: Codeunit "ALN MC Shipment Mgmt.";
    TempShipToOverrides: Record "ALN MC Shipment Label" temporary;
    TempLabelSvcSelection: Record "ALN MC Label Svc. Selection" temporary;
    EntryNo: Integer;
begin
    AddService(TempLabelSvcSelection, 'Predict', '', '');
    AddService(TempLabelSvcSelection, 'HigherInsurance', Format(2500, 0, 9), 'EUR');

    EntryNo := ShipmentMgmt.CreateLabelWithDetails(
        'DPD', 'SO-2026-01187', 1850, 'CL', TempShipToOverrides, TempLabelSvcSelection);
end;

local procedure AddService(var TempLabelSvcSelection: Record "ALN MC Label Svc. Selection" temporary; ServiceCode: Text[50]; Parameter1: Text[50]; Parameter2: Text[50])
begin
    TempLabelSvcSelection.Init();
    TempLabelSvcSelection."Entry No." := TempLabelSvcSelection.Count() + 1;
    TempLabelSvcSelection."Provider Code" := 'DPD';
    TempLabelSvcSelection."Service Code" := ServiceCode;
    TempLabelSvcSelection."Parameter 1 Value" := Parameter1;
    TempLabelSvcSelection."Parameter 2 Value" := Parameter2;
    TempLabelSvcSelection.Selected := true;
    TempLabelSvcSelection.Insert();
end;

CreateLabelFromShipmentWithDetails works the same way but expects the number of a posted sales shipment.

Return value and errors

  • The return value is the Entry No. of the ALN MC Shipment Label record.
  • A provider or licence problem raises Error(); no label is created.
  • A failed DPD call does not raise an error. The label then has Status = Error and the DPD message is stored in Error Message.
  • A Service Code the enum does not know ends the call with an error.

Service codes

The connector subscribes to the hub event OnApplyLabelServiceSelections and creates one ALN MCDPD Label Service record per selected entry. Parameters are limited to two fields of 50 characters; unused parameters stay empty.

Users book the same services in the Create Label dialog — there with field captions instead of codes: Select DPD Additional Services.

code Service Parameter 1 Parameter 2 Note
Predict Predict notification – – Channel (email, SMS, both) and language come from the DPD setup, address and phone from the ship-to address
PersonalDelivery Personal delivery, no neighbours – –
SaturdayDelivery Saturday delivery – – Product E12 only
HigherInsurance Higher insurance Amount ISO currency Empty = default amount and currency of the DPD setup
HazardousGoods Hazardous goods in limited quantities – –
ParcelShopDelivery Delivery to a Pickup parcel shop Parcel shop ID – ID from the DPD parcel shop finder. An ID that is no longer in the search buffer is refused — DPD requires the address and the ID together
Shop2Shop DPD Shop2Shop, prepaid Parcel shop ID – Like ParcelShopDelivery, plus the Shop2Shop Parcel Class from the setup. Not together with ParcelShopDelivery
IdentCheck Ident check Minimum age – Without the dialog, first and last name are split from the ship-to name; names set through the dialog apply to its own label only
Food DPD Food – – Products CL, E12, E18 only — and only together with Predict
Tyres Tyre shipment – – Product CL only
Swap Swap service – – Single-package shipments only
ExWorksDelivery Ex works delivery, recipient pays – – Only when Allow Ex Works Delivery is on in the setup
DepositPermission Shipper deposit permission – – Without the dialog, the deposit location comes from Default Deposit Permission Text; refused when there is no text
ReturnAddress Alternative return address – – The address comes from the setup, not from the parameters

Sent services replace the default services

If the service selection contains at least one DPD entry, the connector does not apply the default services of the DPD setup (default Predict, personal delivery, Saturday delivery, insurance). Only an empty selection gets them. Whoever adds one service must send the wanted defaults explicitly as well. In the Create Label dialog, by contrast, the selection always applies, an empty one included.

Amount format

The amount of HigherInsurance is read with Evaluate in the number format of the session. In AL, Format(Amount, 0, 9) produces the right format. Through the REST API the session runs under the language of the Microsoft Entra application: create that application in Business Central with language English and send 2500.00. A German session would read 2500.00 as 250000.


Through the Integration API

The hub REST API passes the services in the servicesJson field of a label request. The same codes and rules as above apply:

{
  "salesOrderNo": "SO-2026-01187",
  "providerCode": "DPD",
  "productCode": "CL",
  "weightGrams": 1850,
  "servicesJson": "[{\"code\":\"Predict\"},{\"code\":\"HigherInsurance\",\"parameter1\":\"2500.00\",\"parameter2\":\"EUR\"}]"
}

Endpoints, fields and authentication are described in the API Reference.


Events

Hub (ALN MC Shipment Evt Publisher, codeunit 73334602)

Event When
OnAfterCreateShipmentLabel Label created successfully, tracking entry written
OnCreateShipmentLabelError DPD call failed, label stored with status Error
OnAfterCancelShipment Shipment cancelled
OnAfterDeliveryStatusChanged Delivery status changed by tracking

DPD (ALN MCDPD MC Integration, codeunit 73334825)

Event When
OnBeforeCreateDPDLabel Before request building, IsReturn marks return labels, IsHandled replaces the default route
OnAfterCreateDPDLabel After a successful DPD response

Notes

  • Licence. Both routes check the DPD licence like the dialog does. Without an active licence or demo no label is created.
  • Permissions. The calling user needs execute rights on the codeunits of the connector and the hub, see the permission sets of both apps.