Articles in this section

Comply with EDIFACT validation rules

To successfully exchange EDI data with trading partners, you must ensure that the EDI data in your exports and imports complies with standards and the specific guidelines set by each trading partner. Verifying that all mandatory and optional segments/elements are populated correctly to process the EDI data according to the file definition rules is important. Your EDI document must be validated against its EDI standards before it’s sent to the next step in a flow.

Sample EDIFACT file

A typical EDIFACT file consists of mandatory and optional segments based on standards and requirements of your trading partner, for example:

UNB+UNOA:2+123456TEST:01+102096559TEST:16+071121:1334+00000000000100+CONTRL
UNH+00000000000476+CONTRL:D:97A:UN
UCI+00000000000476+102096559TEST:16+123456TEST:01+7
UCM+1+INVOIC:D:97A:UN+7
UCM+2+INVOIC:D:97A:UN+7
UCM+3+INVOIC:D:97A:UN+7
UNT+15+00000000000476
UNZ+1+00000000000100
  • UNB: Interchange Header

  • UNH: Message Header

  • UCI: Interchange Response

  • UCM: Message Response

  • UNT: Message Trailer

  • UNZ: Interchange Trailer

EDIFACT format validation

For EDIFACT format validation, the compliance check must adhere to the UNECE standard. Each trading partner may also have specific requirements for processing the EDI data rules.

While editing an import or export in Flow Builder, after you select the file type as EDIFACT, the file definition rules are present in the File parser/generator helpers.

Important

For EDI document validation for trading partners, if you set the skipEDIValidation field to true, only structural validation is performed. By default, the setting’s value is false, so the input EDI file triggers validation against the EDI standards configured in the file definition rules for the trading partner’s EDI documents.

Note

The supported data types are string and number.

EDIFACT file definition entities

EDI compliance validation includes the following file definition entities:

  • EDI Elements

    • Min/Max element lengths

    • Qualified elements (Codelist lookups)

    • Element type

    • Mandatory/Optional elements

    • Conditional elements (relationships)

  • EDI Loops or Segments

    • Mandatory/Optional segments

    • Max use segments

    • Looping groups

For the EDIFACT file type, it is recommended not to update the field names listed below in the File Definition Rules to avoid errors. These fields are synced to the EDI activity dashboard only if they exist in the EDIFACT file.

Data identifier

Description

UNB020-010

Sender identification

UNB030-010

Recipient identification

UNB050

Interchange control reference

UNH010

Message reference number

UNH020-010

Document type

BGM020

Document/message number

Key components in an EDIFACT file

A file definition is designed to process EDIFACT files based on the following components:

Elements – EDIFACT

An element is an individual item within an EDI document. For example, within many documents, such as the purchase order or invoice, you will find data elements such as city, state, country, item number, quantity, and price. An element is a placeholder between two different special characters. A delimiter character separates each element.

  • Delimiters/Separators: A special character that indicates semantic data's end and/or beginning.  Delimiters are required since some elements are variable in length.

  • Terminators: A special character that marks the end of a segment.

Purpose

EDIFACT – Default char

Tag Delimiter

 + (plus sign)   

Segment Delimiter

'  (apostrophe)     

Element Delimiter

 + (plus sign)  

Sub Element Delimiter / Composite Delimiter

: (colon)

Decimal Separator   

.  (period)

Release Character   

? (question mark)

Segments – EDIFACT

A segment is a group of related data elements and a structural component of any EDI FACT message. A segment starts with a three-character data identifier and ends with a segment terminator. In an EDI file, each line is considered to be a segment.

  • At the segment level, the value of the required object defines if the segment is mandatory. If the value is true, the field is expected to be present. If the value is false, the field is optional.

  • At the element level, the value of the required object defines if the segment is mandatory. If the value is true, the field is expected to be present. If the value is false, the field is optional.

  • The minLength, maxLength, and type (datatype) are elements within each segment element.

    • minLength: The minimum length of an element

    • maxLength: The maximum length of an element

    • Type: The data type of an element. The valid values are String and Number.

EDIFACT specification for a segment
segment-edifact-example.png

Loops – EDIFACT

A loop is a logical group of segments that can have sub-loops with other groups of segments. Loops can have mandatory and optional segments. The first segment listed in the loop is mandatory.

EDIFACT spec for Loop

Each Loop can contain one or more types of segments

loop-edifact-example.png

Relationships – EDIFACT

A relationship exists when two or more linked elements are present in a segment. A relationship consists of one required and conditional element (if one element is present, then other elements must also be present). It includes an array object relationship, which refers to the dependency for an element in the segment.

Types

X12 & EDIFACT Representations

File definition rule representation

Case 1

(One or more)

At least one of the specified elements must be present.

ANSI X12 / EDIFACT: R030405

"Relationship": [        "R,03,04,05"    ]

Case 2

(If first, then all)

If a specified element is present, then all of the specified elements in a dependent element set are present. 

ANSI X12 / EDIFACT: C030405

"Relationship": [        "C,030,040,050"    ]

Case 3

(One or none)

Only one of the specified elements can be present.

ANSI X12 / EDIFACT: E030405

"Relationship": [        "E,03,04,05"    ]

Case 4

(If first, then at least one)

If a specified element is present, at least one of the elements specified in a dependent set of elements also must be present. 

ANSI X12 / EDIFACT: L030405

"Relationship": [        "L,03,04,05"    ]

Case 5

(All or none)

All of the specified elements must be present or absent.

ANSI X12 / EDIFACT: P030405

"Relationship": [        "P,03,04,05"    ]

Case 6

(One and only one)

Only one element must be present.

ANSI X12 / EDIFACT: N/A

"Relationship": [        "O,030,040,050"    ]

Case 7

(If first, then none)

If the first element is present, other elements are not applicable.

ANSI X12 / EDIFACT: N/A

"Relationship": [        "I,030,040,050"    ]

Breakdown of the File definition rule Relationship representation

"Relationship": [ "R,03,04,05" ] 

  • R: The first character in the object that represents the case type (mentioned in the above table).

  • 03,04,05 - The elements in a segment. For X12 / EDIFACT format elements, the length is two characters.

Codelist – EDIFACT

An array of objects holds the possible set of values permitted for a field. The enum field includes the expected set of values to be validated against.

EDIFACT spec for Codelist
codelist-edifiact-example.png