Skip to Content

Conversion Agent – Handling EDI termination characters

The objective of this web log is to describe how to extend the EDIFACT templates provided with the SAP Conversion Agent in order to solve issues related to new line characters when used in the context of dynamic delimiters.


It is part of the following series of weblogs related to Conversion Agent:


Part 1: SAP XI supports EDIFACT

Part 2: SAP XI Supports EDI X12

Part 3: Handling EDI termination characters

Part 4: Handling EDI Exceptions with the SAP XI Conversion Agent

Part 5: SAP XI Conversion Agent Frequently Asked Questions


EDIFACT messages contain a UNA segment at the very beginning of the interchange that allows transmitting the delimiters used by the sender. The receiver can interpret this segment and can parse the rest of the message according to these ‘dynamic’ values.




The EDIFACT templates available in the SAP Conversion Agent library were developed to handle both cases whether the UNA segment is provided or not. If the UNA segment is not present in the message the parser will set the default delimiters.




We encounter a limitation if the EDI messages contain any new line characters.

This is probably related to the assumption that EDI messages have been transmitted through a VAN (value added network). It was certainly true some years ago, but today there are more and more companies using simple FTP protocol to transfer EDI messages as simple text files. In this case the new line characters are not removed systematically.


Based on the presence of the UNA segment and based on the presence new line characters in the EDI file we can distinguish different use cases.


The table below shows in which cases the EDI messages will not be parsed correctly by the templates:




With some small changes we can adapt the default templates in order to support all 4 cases :


(1) In order to support CR/LF with UNA segment we can update the template. We can remove the offset search in the UNA overwriting delimiters group for the content $VarSegmentSeparator:






(2) The default template is not parsing the message correctly:




In order to support CR/LF in a message without UNA segment we can add a group that will checks the existence of a CR/LF between the UNB and UNH segment and will set the segment separator dynamically.



1 Comment
You must be Logged on to comment or reply to a post.
  • Hi,

    I am using CA and i noticed a problem which i have not been able to explain. It is when two repeating groups come at the same hierarchy level ie

    repeating group A
    —repeating group B
    repeating group C

    Here in such a case when i start defining repeating group C, the parser fails.

    I could contact you, if you could give me your mail id. It would really be a big favour, since i have been stuck on this part for sometime now.