lumnik. / scenarios All scenarios · Français

Every line of a SAP ORDERS05 IDoc gets its customer order back

Goal Read a SAP customer's order IDocs, one row per order line, with no middleware.

A customer's SAP writes its orders as ORDERS05 IDocs, in a flat file. The order sits at the top of the IDoc, the article further down.

ORDERS05_20261022.txt
EDI_DC40  1000000000004711001740 3022  ORDERS05                                                    ORDERS                                                                                                                                                                                                                                                                                                                                                                                                                                   
E2EDK01                       100000000000471100100000100000002    EUREUR                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
E2EDK02                       1000000000004711001000002000000020014500012345                               20261022                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
E2EDK02                       100000000000471100100000300000002002SO-77120                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
E2EDP01                       100000000000471100100000400000002000010     120.000        PCE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
E2EDP19                       100000000000471100100000500000403001CX-889-BLUE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
E2EDP19                       100000000000471100100000600000403002ART-10442                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
E2EDP01                       100000000000471100100000700000002000020     48.500         KGM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
E2EDP19                       100000000000471100100000800000703002ART-20017                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
E2EDS01                       1000000000004711001000009000000020023                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
EDI_DC40  1000000000004711002740 3022  ORDERS05                                                    ORDERS                                                                                                                                                                                                                                                                                                                                                                                                                                   
E2EDK01                       100000000000471100200000100000002    EUREUR                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
E2EDK02                       100000000000471100200000200000002002SO-77121                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
E2EDP01                       100000000000471100200000300000002000010     6.000          PCE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
E2EDP19                       100000000000471100200000400000303002ART-10442                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
E2EDS01                       1000000000004711002000005000000020023                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
manifests/20-idoc-record.yaml
kind: Entityname: idoc_record_blabel: Enregistrement IDocdescription: "One record of an ORDERS05 IDoc, in file order: its segment, and the purchase order and item it belongs to."match: [docnum, segnum]scopes: [order-desk-b]columns:  docnum: { label: "IDoc" }  segnum: { label: "N°" }  segment: { label: "Segment" }  po_number: { label: "Commande client" }  item: { label: "Poste" }  qualifier: { label: "Qualifiant" }  material: { label: "Article" }  quantity: { label: "Quantité" }  unit: { label: "Unité" }sources:  - table: t_scenario_idoc_b    map: { docnum: docnum, segnum: segnum, segment: segment, po_number: po_number, item: item, qualifier: qualifier, material: material, quantity: quantity, unit: unit }
$ lm entity get idoc_record_b --filter segment=E2EDP19 --filter qualifier=002
DOCNUM            SEGNUM  SEGMENT  PO_NUMBER   ITEM    QUALIFIER  MATERIAL   QUANTITY  UNIT  _CONFLICTS
0000000004711001  000006  E2EDP19  4500012345  000010  002        ART-10442  120       PCE   {}
0000000004711001  000008  E2EDP19  4500012345  000020  002        ART-20017  48.5      KGM   {}
0000000004711002  000004  E2EDP19              000010  002        ART-10442  6         PCE   {}

Limits

  • A second regex-extract writing the same column writes null where it does not match: DOCNUM is read by one pattern.
  • The lines are a filtered reading of the records: an item with no E2EDP19 002 has no line.
  • Synthetic file, simplified layout, fictitious orders and articles.

Sales · SAP

The customer sends orders as IDocs.

A flat file, fixed width.

Two ORDERS05 IDocs

The problem

The order is far from the article.

  • The number in E2EDK02.
  • The article in E2EDP19, further down.

What is not changed

The customer's SAP stays as it is.

  • Its file, its format.
  • No middleware.

The trap

An IDoc with no order number.

  • It must not take the one before.
  • Or the line lands on the wrong order.

What had to be written

reset-when: { in: [EDI_DC40] }

One line.

  • The number restarts at each IDoc.
  • Each line keeps its order.
  • A 50-line scenario, two manifests.

The result

Three order lines.

  • ART-10442 × 120 PCE, ART-20017 × 48.5 KGM.
  • The second IDoc stays with no number.

The limit

An item with no article has no line.

  • The lines are a filtered read of the records.

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 →