Skip to main content

Label Printing Extensibility

Aptean Mesh provides a built-in label printing pipeline that fires automatically after warehouse receipt posting. You can replace or augment the built-in Aptean Labeling adapter with any third-party or custom solution by implementing the IMobileLabelProvider220FDW interface.

Overview

  • Interface: IMobileLabelProvider220FDW
  • Enum: LabelProviderType220FDW (extensible)
  • Management codeunit: MobileLabelMgt220FDW
  • Namespace: Aptean.Mesh.Services

The framework resolves the active label provider from Mobile Setup."Label Provider" and dispatches print requests to it via a background StartSession() call. This means label printing never blocks the foreground RPC response.

Label Printing Flow
Foreground Session
Mobile App
  • Taps Print
  • or receipt is posted
|v
MobileLabelMgt220FDW
Builds MobileLabelRequest220FDW
Inserts the record
Calls StartSession()
<>
StartSession()
non-blocking — returns immediately
Background Session
MobileLabelMgt220FDW.OnRun()
Reads MobileSetup."Label Provider"
Resolves LabelProviderType220FDW enum
→ IMobileLabelProvider220FDW
|v
Provider.PrintLabel(LabelRequest)
LabelRequest.Delete()

The foreground RPC handler calls MobileLabelMgt220FDW.PrintReceiptLabel() or PrintBinLotLabel(). Each method:

  1. Builds a MobileLabelRequest220FDW temporary record with all the document and item data
  2. Calls StartSession(SessionId, Codeunit::MobileLabelMgt220FDW, CompanyName(), LabelRequest)
  3. The background session runs MobileLabelMgt220FDW.OnRun(), which resolves the provider from Mobile Setup."Label Provider" and calls PrintLabel(LabelRequest)

IMobileLabelProvider220FDW

interface IMobileLabelProvider220FDW
{
procedure PrintLabel(var LabelRequest: Record MobileLabelRequest220FDW);
}

The single method receives a fully populated MobileLabelRequest220FDW temporary record. Your implementation should read the fields it needs and submit a print job to your labeling system.

LabelProviderType220FDW

enum 73167875 LabelProviderType220FDW implements IMobileLabelProvider220FDW
{
Extensible = true;

value(0; "Aptean Labeling")
{
Caption = 'Aptean Labeling';
Implementation = IMobileLabelProvider220FDW = FBLabelingAdapter220FDW;
}
}

Extend this enum to register your custom provider:

enumextension 50100 MyLabelProviderExt extends LabelProviderType220FDW
{
value(1; "My Label System")
{
Caption = 'My Label System';
Implementation = IMobileLabelProvider220FDW = MyLabelAdapter;
}
}

After deploying the extension, select My Label System in Mobile Setup > Label Provider.

MobileLabelRequest220FDW

Table 73167882 -- Temporary table passed to PrintLabel() in the background session.

  • Table Type: Temporary
  • Data Classification: SystemMetadata

Fields

No.NameTypeDescription
1Entry No.IntegerUnique identifier for this label request entry.
2Document TypeIntegerSource document type (e.g., Database::"Purchase Line").
3Document No.Code[20]Source document number (e.g., purchase order number).
4Document Line No.IntegerLine number on the source document.
5Source TypeEnum SourceTypeCustomLabelFDWType of the source party: Vendor, Customer, or None.
6Source No.Code[20]Vendor or customer number from the source document.
7Item No.Code[20]Item number to be labelled.
8DescriptionText[100]Item description, captured from the warehouse receipt line.
9Variant CodeCode[10]Item variant code.
10Location CodeCode[10]Warehouse location where the item is stored.
11Bin CodeCode[20]Bin within the warehouse location.
12Lot No.Code[50]Lot number. When populated, a lot tag label is printed instead of a receiving label.
13Expiration DateDateLot expiration date.
14Quantity (Base)DecimalTotal quantity for the item or lot in the base unit of measure.
15No. of LabelsIntegerNumber of label copies to print.

Keys

NameFieldsProperties
PKEntry No.Clustered

MobileLabelMgt220FDW

The internal management codeunit. Call its methods from your RPC handlers to trigger label printing. Do not call OnRun() directly -- it runs in the background session.

PrintReceiptLabel

internal procedure PrintReceiptLabel(
ScanEntry: Record "Mobile Scan Entry 220FDW";
WhseReceiptLine: Record "Warehouse Receipt Line";
NoOfLabels: Integer)

Builds a label request from a scan entry and warehouse receipt line, then dispatches to the background session. The method resolves the vendor/customer number from the source purchase or sales header and populates Source Type and Source No. automatically.

ParameterDescription
ScanEntryThe completed scan entry containing Lot No., Expiration Date, and Quantity (Base).
WhseReceiptLineThe posted warehouse receipt line providing document and item context.
NoOfLabelsNumber of copies. Pass 0 to use the value already set in the request (or the default).

PrintBinLotLabel

internal procedure PrintBinLotLabel(
ItemNo: Code[20];
VariantCode: Code[10];
LocationCode: Code[10];
BinCode: Code[20];
LotNo: Code[50];
NoOfLabels: Integer)

Builds a lot tag label request from warehouse location data. Looks up the lot's current inventory and expiration date automatically. Raises an error if the lot does not exist in Lot No. Information.

GetNoOfLabelsKey

internal procedure GetNoOfLabelsKey(): Text

Returns the workflow state key 'noOfLabels' used to store the user-entered label count. Use this key when reading from State.GetWorkflowText() in your step handler:

NoOfLabels := State.GetWorkflowInteger(LabelMgt.GetNoOfLabelsKey(), false);

Mobile Setup Configuration

Label printing is configured on the Mobile Setup page:

FieldTypeDescription
Auto-Print LabelsBooleanWhen enabled, PrintReceiptLabel() is called automatically after posting a warehouse receipt.
Label ProviderEnum LabelProviderType220FDWThe active label provider. Only visible when Auto-Print Labels is enabled.

Auto-Print Flow

When Auto-Print Labels is enabled, the receipt posting logic calls MobileLabelMgt220FDW.PrintReceiptLabel() for each posted line. No code changes are needed -- the built-in receipt service handles this automatically.

On-Demand Print (RPC)

To allow users to re-print labels from an RPC action:

local procedure HandlePrintLabel(var State: Codeunit MobileRPCState220FDW)
var
LabelMgt: Codeunit MobileLabelMgt220FDW;
ScanEntry: Record "Mobile Scan Entry 220FDW";
WhseReceiptLine: Record "Warehouse Receipt Line";
NoOfLabels: Integer;
begin
// Read the quantity from workflow state (user entered it in a prior step)
NoOfLabels := State.GetWorkflowInteger(LabelMgt.GetNoOfLabelsKey(), false);
if NoOfLabels <= 0 then
NoOfLabels := 1;

// Load the source records
ScanEntry.Get(State.GetWorkflowInteger('scanEntryNo', true));
WhseReceiptLine.Get(
State.GetWorkflowText('receiptNo', true),
State.GetWorkflowInteger('receiptLineNo', true));

LabelMgt.PrintReceiptLabel(ScanEntry, WhseReceiptLine, NoOfLabels);

State.Command()
.VibrateSuccess()
.Alert(LabelMgt.GetPrintLabelTitle(),
LabelMgt.GetLabelsPrintedMessage(NoOfLabels));
end;

Implementing a Custom Provider

codeunit 50101 MyLabelAdapter implements IMobileLabelProvider220FDW
{
procedure PrintLabel(var LabelRequest: Record MobileLabelRequest220FDW)
var
MyPrintClient: Codeunit MyPrintSystemClient;
begin
// Map MobileLabelRequest fields to your print system's API
MyPrintClient.Submit(
LabelRequest."Item No.",
LabelRequest."Lot No.",
LabelRequest."Location Code",
LabelRequest."Bin Code",
LabelRequest."No. of Labels"
);
end;
}

The codeunit runs inside a background StartSession() -- it has no access to the calling session's state. Errors raised inside PrintLabel() are logged to the BC event log but do not surface to the mobile user. Implement your own error notification (e.g., a notification or log entry) if you need visibility into failures.

See Also