Table of Contents

The TRADACOMS Converter

The TRADACOMS converter in Anvaigo EDI Connect processes TRADACOMS files in Microsoft Dynamics 365 Business Central (BC) and Microsoft Dynamics NAV (NAV). TRADACOMS is primarily used in UK retail; typical documents include orders (ORDHDR), delivery notifications (DELHDR), and invoices (INVFIL). The converter is based on the same codebase as the EDIFACT converter and the X12 converter, but differs in format-specific details. For an introduction to the TRADACOMS standard, its structure, and terminology, see TRADACOMS Basics.

General mapping concepts such as SourceExpr and DestExpr, Reading and Writing Table Data, Conditional Branches, and Commands apply as they do to all converters.

TRADACOMS files have a hierarchical structure: A transmission (STX/END, comparable to an interchange) contains multiple messages (MHD/MTR), each consisting of segments. Segments contain composites (composite data elements) and data elements. One distinctive feature of TRADACOMS is that a complete document consists of several consecutive messages: a header message, one or more detail messages, and a trailer message (e.g., ORDHDR, ORDERS, ORDTLR for an order). The control characters are fixed by the standard and, unlike EDIFACT (UNA segment) and X12 (ISA segment), are not determined from the file.

Wizard

The TRADACOMS converter generates the mapping structure from a sample file. Since no standard data is available for TRADACOMS, the wizard, like the X12 converter wizard, does not automatically detect loops, Mandatory/Conditional designations, data types, or field lengths. However, a line is created for each segment, composite, and data element. Data element names are automatically derived from the parent segment. Missing information such as data types, lengths, and mandatory requirements must be added afterward based on the TRADACOMS specification.

Creating a TRADACOMS Mapping Using the Wizard

  1. Click Search, search for EDI Mapping List, and select it
  2. In the EDI Mapping List Click New on the page's action bar
  3. On the EDI Mapping page Select a project in the Project Code field
  4. Select TRADACOMS in the Format Code field
  5. Enter any code in the Code field (e.g., "ORDHDR_IN")
  6. In the Header Properties FactBox, set the Direction property to Import
  7. On the page's action bar, click New > Run Create and Update Wizard...
  8. Select the TRADACOMS sample file
  9. In the "Choose candidate" dialog The wizard analyzes the file and displays one or more possible interpretations. Since no standard data is available, the notes column contains entries for unknown elements. This is normal for TRADACOMS and does not indicate a problem. Select the desired candidate and confirm with OK

The wizard creates the mapping structure. The control characters do not need to be configured because they are fixed in the TRADACOMS converter. The lines contain the segment tags and positions from the sample file, but no data types, lengths, or Mandatory/Conditional designations. These must be added manually based on the TRADACOMS specification.

The Add EDIFACT/X12 Subelements... line function, which is available on segments and composites in the EDIFACT converter, is not available in the TRADACOMS converter because there is no standard data from which the possible child elements could be determined.

Header Properties

In addition to the general header properties, the following converter-specific properties are available. They apply to the entire mapping and are configured in the property editor at header level. These properties match those of the EDIFACT converter because TRADACOMS uses the same processing foundation.

Property Description
Direction Import or Export. Determines the processing direction and controls which additional properties are displayed at header and line level.
Encoding Character encoding of the TRADACOMS file: Windows-1252 (default), UTF-8, UTF-16, MS Dos, or Default (Dynamics internal encoding).
Sample Search Depth The wizard's search depth. For standards-compliant files, the default value of 1 is sufficient. Higher values produce more candidates, which can sometimes yield better results for noncompliant files, but increase analysis time.
Line Breaks Export only. Inserts a line break after each segment to improve the readability of the generated file. Default: Yes.
Fallback Communication Channel Export only. Communication channel used for sending if no other channel has been set in the business transaction or a previous mapping.
Auto Send Transmission Export only. Automatically sends the generated file through the assigned channel as soon as conversion is complete.
Fallback Receiver Partner Export only. Communication partner used as the recipient if no other partner can be determined.

Unlike the X12 converter, no properties are provided for Element Separator, Subelement Separator, or Segment Terminator. The TRADACOMS control characters (= + : ? ') are fixed by the standard and do not need to be configured or determined from the file.

Data Subtypes

The TRADACOMS converter extends the Data line type with format-specific subtypes. The subtype is selected using the Edifact Type property on each Data line. The general line properties are available for all subtypes. For exports, Conditional Output is available on Segment, Composite, and DataElement lines.

Segment – Identifies a TRADACOMS segment by its tag (e.g., STX, MHD, OLD, MTR).

Property Description
Position Sequence in the standard (multiple of 10)
Tag Segment identifier
Name Segment name. Freely editable, with no effect on processing.
Mandatory Mandatory (required segment) or Conditional (optional)
Agency Responsible organization (TRADACOMS)
Version Version number of the message type (e.g., 9 for ORDHDR)
Message Type Message type (e.g., ORDHDR)
Spec. Max. Repeat Maximum repetitions according to the specification

Composite – Groups related data elements within a segment.

Property Description
Position Sequence within the segment
Tag Composite identifier
Name Composite name. Freely editable, with no effect on processing.
Mandatory Mandatory or Conditional

DataElement – The actual data element with field mapping. Which properties are visible in the property editor depends on the processing direction and other settings: SourceExpr appears only for exports, DestExpr only for imports (controlled by Direction in the header properties).

Property Description
Position Sequence within the composite or segment
Tag Data element identifier
Name Data element name. Freely editable, with no effect on processing.
Mandatory Mandatory (required element) or Conditional (optional)
SourceExpr Export only. Source for the value to output. See SourceExpr and DestExpr.
DestExpr Import only. Destination for the value read. See SourceExpr and DestExpr.
Spec. Data Type Data type according to the TRADACOMS standard: an (alphanumeric), a (alphabetic), n (numeric).
Spec. Length Type Specifies whether the length defined under Length is a maximum length or an exact length: Max. length or Exact length.
Length Field length according to the standard
Incorrect Length Behavior when lengths differ from the specification.
Format Type Data type interpretation or formatting.
Sample Values Sample values from the source file. Captured by the wizard for informational purposes only.

Unlike the X12 converter, which supports the additional data types id, r, dt, tm, and b, the TRADACOMS converter, like the EDIFACT converter, is limited to an, a, and n. The options for Incorrect Length (length handling with Truncate and Pad variants), Format Type (text, date, number), and number formatting during import and export are identical to those of the EDIFACT and X12 converters and are described in detail in The EDIFACT Converter.

Transmission and Message Structure

A TRADACOMS transmission begins with the STX (Start of Transmission) segment and ends with END (End of Transmission). Between them are the messages, each enclosed by MHD (Message Header) and MTR (Message Trailer). Unlike EDIFACT and X12, a complete document does not correspond to a single message, but to a sequence of messages: An order, for example, consists of the ORDHDR, ORDERS, and ORDTLR messages, all within the same transmission.

In the mapping, this structure is represented using loops: A System loop encloses the transmission (STX/END), and a Message loop encloses each message (MHD/MTR). For a complete document, the header, detail, and trailer messages are modeled consecutively as separate Message loops. The MTR segment expects the number of segments in the message; this value is determined automatically using the TRADACOMS.SEGMENTCOUNT converter function.

The control characters are fixed: The equals sign = separates the segment identifier from the data, + separates the data elements, : separates their subelements, ? serves as the escape character, and ' terminates a segment. Control character configuration, as used by the X12 converter (derived from the ISA segment) or the EDIFACT converter (UNA segment), is not required.

Groups and Loops

As with the EDIFACT and X12 converters, groups can be represented as loops in the mapping. The Loop subtypes System (transmission level, STX/END), Message (message level, MHD/MTR), Repeat (segment repetitions), and Group are available. The recommendation to set Min. Repeat to at least 1 also applies here (see Performance Optimization).

Converter-Specific Commands

In addition to the general commands (ERROR, TESTFIELD, WARNING, INFORMATION, DEBUG, EXIT, RUNASYNC), the TRADACOMS converter provides the same specific command as the EDIFACT and X12 converters:

SkipSegments – Skips all TRADACOMS data up to a specified segment tag (e.g., MHD). Useful in preprocessing mappings that use the header message to call the appropriate processing mapping via RUNASYNC and skip segments that have already been processed.

The RUN and ReadUntilSegment commands are available for compatibility reasons, but have been replaced by RUNASYNC and SkipSegments.

Converter Functions

The TRADACOMS converter provides the same functions as the EDIFACT and X12 converters. The segment counter is accessed through the TRADACOMS object:

Object Function Description
TRADACOMS SEGMENTCOUNT Number of segments in the current message. Typically used in the MTR segment.
MESSAGE NUMBER Entry No. of the current EDI message
MESSAGE CREATED Creation timestamp of the current message
MESSAGE TESTFLAG Test flag of the current message
TRANSMISSION NUMBER Entry No. of the current transmission
TRANSMISSION CREATED Creation timestamp of the current transmission
TRANSMISSION TESTFLAG Test flag of the current transmission

Export Considerations

For mandatory data elements during export, output is generated even if the value is empty. This can lead to invalid files if required fields are not populated. Validation using a CHECK mapping is recommended.

If payload data contains a control character (+ : ' or the escape character ? itself), the converter automatically prefixes it with a ? during export. This keeps the generated file valid without having to sanitize the values in the mapping beforehand.

Technical Details

Technical objects mentioned or used in this article:

Object Type Name Number
Codeunit ANV EDIFACT/X12 Validation 5327350
Codeunit ANV EDIFACT/X12 Core 5327351