Wednesday, 4 September 2024

EDIFACT - Document Structure

The UN/EDIFACT (United Nations/Electronic Data Interchange for Administration, Commerce, and Transport) standard is an international EDI standard that facilitates the exchange of business information between different organizations. The structure of an EDIFACT document is hierarchical, similar to ANSI ASC X12, but with different terminology and format. Here’s a detailed overview of the EDIFACT document structure:

1. Interchange Envelope

The interchange envelope wraps around the entire EDIFACT message and consists of UNA (optional), UNB, and UNZ segments.

a. UNA Segment (Service String Advice)

  • Purpose: Defines the separators used in the message. This segment is optional and, when present, must appear at the beginning of the interchange.
  • Components:
    • Component Data Element Separator: Typically +
    • Data Element Separator: Typically :
    • Decimal Mark: Typically .
    • Release Character: Typically ?
    • Reserved (space): Typically
    • Segment Terminator: Typically '

Example:

UNA:+.? '

b. UNB Segment (Interchange Header)

  • Purpose: Identifies the sender, receiver, date, time, and control information for the interchange.
  • Key Data Elements:
    • Syntax Identifier (UNB01)
    • Syntax Version Number (UNB02)
    • Sender Identification (UNB03)
    • Recipient Identification (UNB06)
    • Date (UNB08)
    • Time (UNB09)
    • Interchange Control Reference (UNB10)
    • Application Reference (UNB11)
    • Processing Priority Code (UNB12)
    • Acknowledgment Request (UNB13)
    • Test Indicator (UNB14)

Example:

UNB+UNOA:1+SENDERID+RECEIVERID+240814:1530+000000001'

c. UNZ Segment (Interchange Trailer)

  • Purpose: Marks the end of the interchange and provides control totals.
  • Key Data Elements:
    • Interchange Control Count (UNZ01)
    • Interchange Control Reference (UNZ02): Matches the control reference in the UNB segment.

Example:

UNZ+1+000000001'

2. Functional Group (Optional)

The functional group groups related messages, though this is not always used in EDIFACT.

a. UNG Segment (Functional Group Header)

  • Purpose: Groups related messages together.
  • Key Data Elements:
    • Functional Group Identifier (UNG01)
    • Application Sender's Identification (UNG02)
    • Application Receiver's Identification (UNG03)
    • Date (UNG04)
    • Time (UNG05)
    • Group Reference Number (UNG06)
    • Application Password (UNG07)
    • Application Level (UNG08)

Example:

UNG+ORDERS+SENDERID+RECEIVERID+240814:1530+1'

b. UNE Segment (Functional Group Trailer)

  • Purpose: Marks the end of a functional group and provides control totals.
  • Key Data Elements:
    • Number of Messages (UNE01)
    • Group Reference Number (UNE02): Matches the reference number in the UNG segment.

Example:

UNE+1+1'

3. Message

Each functional group (if used) contains one or more messages, each representing a specific business transaction, such as an order or invoice. The message starts with the UNH segment and ends with the UNT segment.

a. UNH Segment (Message Header)

  • Purpose: Identifies the beginning of the message.
  • Key Data Elements:
    • Message Reference Number (UNH01)
    • Message Type Identifier (UNH02): Identifies the type of message (e.g., ORDERS for Purchase Order).
    • Message Type Version Number (UNH03)
    • Message Type Release Number (UNH04)
    • Controlling Agency (UNH05)
    • Association Assigned Code (UNH06)
    • Common Access Reference (UNH07)

Example:

UNH+0001+ORDERS:D:96A:UN'

b. UNT Segment (Message Trailer)

  • Purpose: Marks the end of the message and provides control totals.
  • Key Data Elements:
    • Number of Segments (UNT01)
    • Message Reference Number (UNT02): Matches the reference number in the UNH segment.

Example:

UNT+15+0001'

4. Segments

Segments are the building blocks of the message, each containing related data elements. Segments begin with a three-character identifier and end with a segment terminator (').

a. Example Segments in an ORDERS Message:

  1. BGM Segment (Beginning of Message)

    • Purpose: Indicates the start of the purchase order message.
    • Key Data Elements:
      • Document/Message Name (BGM01)
      • Document/Message Number (BGM02)
      • Message Function Code (BGM03)

    Example:

    BGM+220+123456789+9'
  2. DTM Segment (Date/Time/Period)

    • Purpose: Specifies dates relevant to the message.
    • Key Data Elements:
      • Date/Time/Period Qualifier (DTM01)
      • Date (DTM02)
      • Date/Time/Period Format Qualifier (DTM03)

    Example:

    DTM+137:20240814:102'
  3. NAD Segment (Name and Address)

    • Purpose: Identifies the parties involved in the transaction, such as the buyer and seller.
    • Key Data Elements:
      • Party Qualifier (NAD01)
      • Party Identification (NAD02)
      • Party Name (NAD04)

    Example:

    NAD+BY+12345::16++BUYER NAME+123 BUYER STREET+BUYER CITY++ZIP'
  4. LIN Segment (Line Item)

    • Purpose: Specifies details about individual items being ordered.
    • Key Data Elements:
      • Line Item Number (LIN01)
      • Item Number Type (LIN02)
      • Item Number (LIN03)

    Example:

    LIN+1++1001:BP'
  5. QTY Segment (Quantity)

    • Purpose: Specifies the quantity of items ordered.
    • Key Data Elements:
      • Quantity Qualifier (QTY01)
      • Quantity (QTY02)

    Example:

    QTY+21:10'

5. Data Elements

Data elements are the smallest units of information in an EDIFACT document. Each data element is defined by its data element number and can contain alphanumeric, numeric, or date values.

a. Types of Data Elements:

  • Simple Data Element: Contains a single piece of data.
  • Composite Data Element: Contains multiple components, which are further broken down into simple data elements.

6. Delimiters

Delimiters are special characters used to separate different parts of the document:

  • Component Data Element Separator: Typically a colon (:).
  • Data Element Separator: Typically a plus sign (+).
  • Decimal Mark: Typically a period (.).
  • Release Character: Typically a question mark (?).
  • Segment Terminator: Typically an apostrophe (').

Example: Full Structure

Here’s a summarized view of a simple EDIFACT ORDERS Purchase Order document:

UNA:+.? '
UNB+UNOA:1+SENDERID+RECEIVERID+240814:1530+000000001' UNH+0001+ORDERS:D:96A:UN' BGM+220+123456789+9' DTM+137:20240814:102' NAD+BY+12345::16++BUYER NAME+123 BUYER STREET+BUYER CITY++ZIP' LIN+1++1001:BP' QTY+21:10' UNT+15+0001' UNZ+1+000000001'

No comments:

Post a Comment

Comparison Between EDI and API

Comparison between  EDI (Electronic Data Interchange) and API (Application Programming Interface) in the context of B2B data exchange: ...