Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

IDOC_XML_FROM_FILE => white space getting removed

Dear all,

We've a scenario in which we send IDocs from 3rd party system via a broker to SAP. The data is received on the application server and we use EDI_DATA_INCOMING, which in turn will use IDOC_XML_FROM_FILE to create the IDocs.

The problem that we have is that leading and/or trailing spaces in the XLM content is getting removed, while we need it to be retained. When searching SCN and other forums I found solutions to prevent this from happening in XI/PI or other middleware, but not on SAP ECC, which is where the issue occurs. If I look at the XML file on the application server via AL11, I see the spaces, but IDOC_XML_FROM_FILE doesn't retain them when creating the IDoc. In the IDoc contents of the corresponding field, the spaces are gone.

According to the XML standards, normally by default the spaces should be preserved and if not, it should be after adding a xml:space="preserve" tag to the XML element or it's root element. However when testing this it looks that SAP's XML parser isn't taking this into account.

Another option that I tried was adding a XSD that contained the following:

<xs:element  name="ATWRT" minOccurs="0">

       <xs:simpleType >

            <xs:restriction base="xs:string">

                 <xs:whiteSpace value="preserve" />

            </xs:restriction>

       </xs:simpleType>

</xs:element>

Also this doesn't work. I suspect that SAP is using it's own XSD for the standard IDOCs and not the one that I linked via the xsi:schemaLocation, though I'm not handy enough to debug SAP to get this confirmed.

Did anyone ever experienced the same, any suggestions on how to get pasted this?

Thanks in advance,

Erik

replied

What if you wrap your values into CDATA sections? AFAIR, CDATA respects all symbols (at least it's supposed to).

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question