Since ANSI X12 do not support the escape character (EDIFACT
supported), if the EDI content contains any character that the same as the
element separator, component separator or segment terminator, it will cause
some exceptions in both inbound and outbound EDI.
Let’s say an example, see the screen shot below, in this
case, ‘123456-*22’ is the vendor part number, * is part of the part number, not
the element separator, and the ‘#’ is the escape character:
If you drop the file
to process by BizTalk, you will receive the exception as below, BizTalk report
that too many element in this segment, because BizTalk recognize the ‘*’ in the
part number as the element separator.
Also, when you send out any EDI that within *, BizTalk
report that invalid character found in data element.
So how to handle it? Not difficult, just need 2 steps in
either inbound or outbound.
Inbound:
1. Develop
a custom pipeline to replace the in the part number * to other characters in the
decode step, for example, in this case, we replace ‘#*’ to ‘/+’;
So after the custom pipeline processing, the part number
looks like below:
2. Replace
the ‘/+’ back to ‘*’ in the mapping. Here is the final result:
Outbound:
1. Replace
‘*’ to ‘/+’ in the mapping;
Here it the original message;
Here is the message output from the mapping.
2. Replace
‘/+’ to ‘#*’ in the encode step in custom pipeline.
Here is the final result:
Here is part of the code in custom pipeline: