Wiki source code of Create your EDI system message

Last modified by Martijn Woudstra on 2022/10/05 16:01

Hide last authors
Martijn Woudstra 5.1 1 {{container}}{{container layoutStyle="columns"}}(((
2 This micro-learning will focus the tranformation from EDI to an XML message. EDI (Electronic Data Interchange) is a very specific format of a message that can be interpreted by some systems. Rather than providing XML tags or curly JSON brackets, you will find a flat file that is very well organized but used lots or abbreviations or tags to identify entities and attributes in the message. This microlearning will explain more around these structures and how to create such EDI messages when you have an XML prepared.
3
4 Should you have any questions, please get in touch with [[academy@emagiz.com>>mailto:academy@emagiz.com]].
5
6 == 1. Prerequisites ==
7
8 * Intermediate knowledge of the eMagiz platform
9 * Good working experience in the Create phase and transformations.
10
11 == 2. Key concepts ==
12
13 An example of an EDI message is listed below. Each line starts with a tag that indicates the meaning of the line, and each message starts with fixed starting tags (UNA) and fixed ending tags (UNZ).
14
15 [[image:Main.Images.Microlearning.WebHome@advanced-create-your-transformations-xml-2-edi-1.png]]
16
17 There are a lot of different versions of EDI each indicated with version id. A commonly used version is D96A, while versions D01B, D95A, D01A, etc exists. It's important to understand upfront what the version used is from the client, allthough the EDI message itself contains that information. The example above is a D01B version - see 3rd line. Within each version of EDI there is a specific type of data exchanged. Such as orders, invoices, confirmations, etc. In the example above this is an ORDERS message. Each of the version and data type combination has a specific message definition that is required to obtain in order to create the System Message.
18
19 == 3. Setting up the system messages for EDI ==
20
21 === 3.1 Scenario incoming EDI with example ===
22
23 In the scenario where you want to define the System Message that is incoming, and you have the example EDI message that needs to be modeled, it is adviced to use a Flow Test in Create to learn what the XML structure is for that particular message. You would get only the required XML elements that correspond to the example messages. It is adviced to have several examples messages so that the optimal set can be determined. It would mean that you need to transfer the integration to Create before completing the Design phase.
24
25 === 3.2 Scenario incoming EDI without example ===
26
27 In this case, you can't predict the exact XML structure of the EDI message. You could rely on an XSD that is provided by the client or the XSDs that eMagiz provides in the eMagiz Store. Please note that you can download this structure but it contains a full model. Which effectively means that all possible attributes are included and in most cases 80% or more is not used by the EDI messages actually exchanged. Please take moment to create a subset of the full XSD before importing that XSD as System Message.
28
29 === 3.3 Scenario outcoming EDI with example ===
30
31 In the scenario where you want to define the System Message that is oucoming, and you have the example EDI message that needs to be modeled, it is adviced to use a Flow Test in Create to learn what the XML structure is for that particular message. You would get only the required XML elements that correspond to the example messages. It is adviced to have several examples messages so that the optimal set can be determined.
32
33 It would mean that you need to transfer the integration to Create before completing the Design phase. And it means that you need to use the EDI to XML component as described in an earlier microlearing.
34
35 === 3.4 Transformations ===
36
37 Once the system definitions are ready, you can use the regular transformation tooling of eMagiz to map definitions from data models to system definitions. In some cases you need multiple namespaces that need to be created for EDI messages - please refer to the microlearning in this same module.
38
39 == 4. Assignment ==
40
41 Try to observe an EDI message like below. Put the contents below into a file, and move an integration into the Create phase. Add the required compontent to transform it to XML and see the actual result.
42
43 {{code language="xml"}}
44 UNB+UNOB:1+SENDER1:1+RECEIVER1:1+071101:1701+131++INVOIC++1++1'
45 UNH+ME000001+DESADV:D:01B:UN:EAN007'
46 BGM+351+DES587441+9'
47 DTM+137:20020401:102'
48 DTM+11:20020403:102'
49 DTM+358:20020403:102'
50 RFF+ON:12332'
51 DTM+171:20020325:102'
52 NAD+SU+5411234512309::9'
53 RFF+VA:6558774'
54 NAD+BY+5412345000013::9'
55 RFF+VA:7002474'
56 NAD+DP+5412345123453::9'
57 RFF+VA:800800'
58 NAD+SH+5412345000105::9'
59 CPS+1'
60 PAC+2++201::9'
61 CPS+2+1'
62 PAC+1++201::9'
63 MEA+PD+AAB+KGM:263.2'
64 MEA+PD+WD+MMT:800'
65 MEA+PD+LN+MMT:1200'
66 PCI+33E'
67 GIN+BJ+354107380000001051'
68 PAC+20++CT'
69 LIN+1++5410738000152:SRV'
70 QTY+12:20'
71 CPS+3+1'
72 PAC+1++201::9'
73 MEA+PD+AAB+KGM:305.1'
74 PCI+33E'
75 GIN+BJ+354107380000001068'
76 PAC+20++CT'
77 LIN+2++5410738000169:SRV'
78 QTY+12:5'
79 LIN+3++5410738000176:SRV'
80 QTY+12:3'
81 LIN+4++5410738000183:SRV'
82 QTY+12:12'
83 CNT+2:4'
84 UNT+40+ME000001'
85 UNZ+2+131'
86
87 {{/code}}
88
89 [[image:Main.Images.Microlearning.WebHome@advanced-create-your-transformations-xml-2-edi-4.png]]
90
91 == 5. Key takeaways ==
92
93 eMagiz is able to transform messages from XML to EDI
94
95 * Use the proper components to transform the message to the right EDI format
96 * Leverage Flow Testing to see the actual outcome of an EDI message to help create the right System Message
97 * Validate the XML structure before it's transformed to an EDI message (outgoing)
98 * Transform the EDI message to XML before it's validated basedon the XML structure (incoming)
99
100 == 6. Suggested Additional Readings ==
101
102 If you are interested in this topic and want more information on it, please read the help text provided by eMagiz and read more information on the following link:
103
104 * https://www.w3schools.com/xml/xpath_intro.asp
105
106 == 7. Silent demonstration video ==
107
108 There is no demonstration video of this functionality.)))((({{toc/}}))){{/container}}{{/container}}