Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SAP R/3 removes trailing spaces from IDoc XML files

I have a Java application that uses SAP JCo 3 libraries. One of the use cases consists of receiving a IDoc file from the SAP instance (R/3, ERP 6.0 EhP 7) and convert it to XML. The problem is that, during the conversion (executed by the IDoc library), the right spaces at the end of the fields get trimmed. Apparently, to reduce the message size. So far, I haven't found any configuration that can be done from the Java side.

Searching the net, I found the following suggestions from the SAP side:

  • setting whiteSpace=preserve from the XSD Editor
  • setting xml.fieldContentFormatting=nothing in the Sender File/FTP Adapter

However, I haven't been able to find those tools nor configure them accordingly.

I would appreciate any insights on these two approaches or any other solution.

like image 284
CountD Avatar asked Oct 05 '15 17:10

CountD


1 Answers

The SAP Java IDoc Class Library does not offer an option to preserve trailing SPACES in the IDoc fields.

Trailing SPACE characters in IDoc fields do not serve any purpose as long as the IDoc will be sent to another SAP system in the end again. In this case they really would only enlarge the XML message size without adding any value.

I currently cannot imagine for what reason you would like to keep those trailing SPACES? SPACE characters are the default initial value for ABAP CHAR type fields, so you also cannot know if some of these characters would have been set by intention or not.

like image 139
Trixx Avatar answered Sep 19 '22 14:09

Trixx