Separators in ANSI X12 EDI Message
In an ANSI X12 EDI Message, we have Data element separator, Component Element Separator and Segment Terminator in the ISA segment.
D_DATAELEMENTSEPARATOR (Data Element Separator) is at 1st position in the ISA segment which is used to determine the delimiter in between the elements of one segment across the EDI Document. This is an optional element whose default value is ASCII character (*) hexadecimal value ‘2A’.
D_I15 (Component Element Separator) is at 16th position in the ISA segment which is used to determine the end of ISA (interchange start).
D_SEGMENTTERMINATOR (Segment Terminator) is at 17th(last) position in the ISA segment which is used to determine the delimiter in between the segments of across the EDI Document. This is an optional element whose default value is ASCII (LF) Line Feed (\n) hexadecimal value ‘0A’.
Handling these separators:
Issue 1– Failed in component – Module exception (x12 converter exception)
Reasons–
1) If length of any of the separators is more than one (1)
2) If DataElementSeparator or SegmentTerminator is alphanumeric
Analysis–
1) Numbers (0,1,2…), letters (A, B…), combination (A1,1B…) are not accepted
2) Escape sequences /n, /r,… etc. are directly passed (hard-coded in mapping) – this is treated as length (>1) and alphanumeric
3) Only special characters of length = 1 are acceptable eg. |,*,^,\,{,},/…..
ASCII characters–
(printable ASCIIcharacters e.g. 0x85, 0x0A,0x0D,0x5E,0x7B- see attached for list of printable ASCII characters and extended ASCII)
UDF returning the ASCII characters based on hex values can be used to map these separators
0x0a separator (new line) – Segment Terminator is an optional field (default value is 0A (/n)); every segment is separated by a linefeed when this field is not mapped)
Issue 2– String Index out of range (x12 converter exception)
Reason–
If DataElementSeparator or SegmentTerminator have ASCII characters whose hexadecimal values are of length more than 3
Case– Up tack symbol (┴) (hex value -22a5)
Analysis–ASCII characters whose hex values are out of range
Possible values ( ASCII printable chars (..62,63,..), escape chars (..0A, 85, 0E..), Extended ASCII (…128,..136..)
Values such as up tack (┴) with hex value -22a5 are not acceptable as element or segment separator in an EDI file
(see attached ASCII table)
Case– Control characters as segment separator in an inbound EDI file
Some partners generate EDI files with control characters as segment separators (e.g. NAK – Negative Acknowledgement , hex (15))
Ideally, Unicode control characters are not allowed in XML representation
This is taken care at conversion level (X12 converter module takes care of removing Invalid XML character)
And the optional segment terminator is treated internally as default New line (hex 0A)
Summary:
Element |
Description |
Position in ISA |
Occurrence |
Length |
Default Value |
Limitation |
D_DATAELEMENTSEPARATOR |
Data Element Separator |
1 |
Optional |
1 |
* |
Only special(escape) characters whose hex value is in range |
D_I15 |
Component Element Separator |
16 |
Mandatory |
1 |
– |
Any character (length restriction (1)) |
D_SEGMENTTERMINATOR |
Segment Terminator |
17 |
Optional |
1 |
New Line |
Only special(escape) characters whose hex value is in range |
Attachment – ASCII table
Where do I control which character to have in D_DATAELEMENTSEPARATOR?
We need not worry about element separator in an inbound file ( it is taken care at adapter level)
For an outbound we can, configure the separator in TPM based on different partners or have a value mapping (look-up) to retrieve separator values based on partners
Please go through below blog for further details
ISA and GS segment values - Value mapping v/s Predefined TPM UDFs - I
Hi Pooja,
I must appreciate you for the nice post. Could you share your experience with regards to SD functional consultant role in Sap EDI implementation and support projects.
Thanks
chekri
Hi Chekri,
Let me attempt to answer you based on my experience.
SD functional consultant:
Need to able to understand the whole business process flow, corresponding EDI message type to idoc types, the dependency of each idoc and edi message types. Able to understand the meaning of idoc segment, field and qualifier. Need to understand the meaning of message implementation guide by customer and produce message mapping specification. Important is able to advise technical PI consultant how to map certain message type, especially when it is completely new message type. Liaise with business user during UAT and go live.
EDI/PI technical consultant:
Able to understand message mapping specification provided by functional consultant, at the same time understand the message implementation guide by customer too. Develop the mapping based on specification, perform unit testing and provide the test result to functional consultant to perform UAT. Go live standby support.
Regards,
Yee Loon
Thank you Yee Loon for your reply. Makes sense in what you say.
Regards,
Chekri
Hi, thanks for your document.
But how could I adjust the separator of N9-C040-D-128 and N9-C040-D-127? In previous version, the separator is '>' (IA>23292). But after upgraded to new B2B version, it became to '\' (IA\23292)
Hello Pooja,
We are working on outbound scenario ( SOAP to EDI 850 File). We have issue with D_SEGMENTTERMINATOR field. We are setting the value '~' or '|' in value mapping. But when converter module generates file, end seperator is not visible. All lines in file are on seperate line looks default seperator is used.
Could you please help me to fix issue ?
Hello,
My scenario is to receive EDI 810 invoice from VAN. I have inbound EDI 810 document with '<0x85>' as a segment terminator. I am not sure how to handle this as it is getting error out at EDI separator receiver channel.
Is there any way that i can handle this ASCII char segment terminator in PI ?
Thanks !