lumnik. / scenarios All scenarios · Français

An EDIFACT ORDERS message read again order line by order line

Goal Read an EDIFACT order segment by segment, then line by line, with no EDI tool.

The buyer sends an ORDERS message on a single line. Segments end with an apostrophe. An apostrophe in a label is written ?'.

ORDERS_PO-7001.edi
UNA:+.? 'UNB+UNOC:3+3012345000004:14+3098765000002:14+261020:0930+42'UNH+1+ORDERS:D:96A:UN'BGM+220+PO-7001+9'DTM+137:20261020:102'NAD+BY+3012345000004::9'LIN+1++3012345000110:EN'IMD+F++:::Bâche d?'hiver 10x5'QTY+21:12'LIN+2++3012345000127:EN'QTY+21:6'UNS+S'UNT+10+1'UNZ+1+42'
manifests/20-segment.yaml
kind: Entityname: edifact_segment_blabel: Segment EDIFACTdescription: "One segment of an ORDERS message, in message order: its tag, its elements, and the order and article it belongs to."match: [seg_no]scopes: [purchasing-b]columns:  seg_no: { label: "N°" }  tag: { label: "Segment" }  elements: { label: "Éléments" }  order_no: { label: "Commande" }  ean: { label: "EAN" }  quantity: { label: "Quantité" }sources:  - table: t_scenario_edifact_b    map: { seg_no: seg_no, tag: tag, elements: elements, order_no: order_no, ean: ean, quantity: quantity }
$ lm entity get edifact_segment_b --filter tag=QTY
SEG_NO  TAG  ELEMENTS  ORDER_NO  EAN            QUANTITY  _CONFLICTS
9       QTY  21:12     PO-7001   3012345000110  12        {}
11      QTY  21:6      PO-7001   3012345000127  6         {}

Limits

  • The order lines are a filtered reading of the segments (--filter tag=QTY): nothing filters after the cell tier.
  • The UNA segment, which declares the separators, goes through the same escape: it reads ":+.".
  • One message per file; fictitious GLN and EAN numbers.

Purchasing · EDIFACT

Orders arrive as EDIFACT.

One message on a single line.

ORDERS, one message, two lines

The problem

Everything fits on one line.

  • An apostrophe ends a segment.
  • The order is up front, the article further on.

What is not changed

The message stays as it is.

  • No EDI translator.
  • No conversion first.

The trap

An apostrophe in a label.

  • « Bâche d'hiver » is written Bâche d?'hiver.
  • Misread, it cuts the segment in two.

What had to be written

split-row: { sep: "'", escape: "?" }

One line.

  • One segment per row, in order.
  • ?' stays an apostrophe.
  • A 43-line scenario, two manifests.

The result

PO-7001: 12 and 6.

  • Each quantity carries its order.
  • And its article's EAN.

The limit

One message per file.

  • The lines are a filtered read of the segments.

Try it

The scenario replays locally.

Every step is published with its output.

This scenario runs on lumnik Open, free and open source.

Try lumnik Open →