cancel
Showing results for 
Search instead for 
Did you mean: 

Losing identation in XML generated by SAP XI/PI.

Former Member
0 Kudos

Hi all,

Can anybody help me to handle this problem? For exemple I need to receive a XML like that:

<?xml version="1.0" encoding="UTF-8" ?>

<YMMIANLA>

<IDOC BEGIN="1">

<YPIT_DESTINO SEGMENT="TEST">

<GSBER>TEST</GSBER>

<URL>http://10.10.10.10:8080/</URL>

<TABIX>TEST</TABIX>

</YPIT_DESTINO>

</IDOC>

</YMMIANLA>

But I'm receiving like that:

<?xml version="1.0" encoding="UTF-8" ?>

<YMMIANLA><IDOC BEGIN="1"><YPIT_DESTINO SEGMENT="TEST"><GSBER>TEST</GSBER><URL>http://10.160.16.198:5556/</URL><TABIX>TEST</TABIX></YPIT_DESTINO></IDOC></YMMIANLA>

My legacy system is very poor and just process XML with "correct" identation.My SAP XI is istalled on IBM AIX.

Thanks in advance,

Daniel Torres

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

What is the XI adapter you are using for sending the XML data to IBM system?

You can check the content conversation properties to insert indentation for your XML file

Satish

Former Member
0 Kudos

I'm using HTTP adapter to send information from XI to thirdy-party system.

The scenario is:

IDOC -> XI - (HTTP) -> Thirdy-party system

I though in a adapter module to handle XML(inserting breakline after each tag) before send to thirdy-party system.

Former Member
0 Kudos

There is just one problem: the HTTP adapter does not have a module chain as it is based on ABAP. So you will need to do the transformation in a Java, XSLT or ABAP mapping you execute after the Message Mapping.

Former Member
0 Kudos

Hi Stefan, thanks for your information it's very helpfull. I'll try in IR.

stefan_grube
Active Contributor
0 Kudos

You can use an XSLT like this:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
  <xsl:template match="/">
    <xsl:copy-of select="*" />
  </xsl:template>
</xsl:stylesheet>

Put the XSLT as second mapping step.

Regards

Stefan

Former Member
0 Kudos

Hi Stefan, problem solved!

Thanks again!

Answers (2)

Answers (2)

Former Member
0 Kudos

How does your backend system pick up the message? If it is from a file/ftp port, you may also

  • copy the file into a temporary directory or give it a temporary name

  • call a shell script which puts a newline after each closing bracket (sed does that quite well f.ex.) and afterwards moves the file to its intended destination

Cheers!

Stefan

Former Member
0 Kudos

Hi Stefan, I'm using HTTP adapter to send to backend system.

I don't see any other method to handle XML, just adapter module, but I don't have any experience with that.

stefan_grube
Active Contributor
0 Kudos

The graphical mapping tool and the content conversions of the file adapter do not support identation.

You have to use XSLT or Java mapping.

Regards

Stefan