Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP to XML Simple Transformations. "Comments"

Former Member
0 Kudos

Hi Gurus,

I have an ST program that needs to output an XML file. I'm able to generate the file but the problem is the "Comment" lines are being removed.

<!-- This is a comment  -->

How do I make the comment above appear in the downloaded XML file? I've placed the comments in the ST program but it's ignoring it as I assume it is taking it as a "Comment."

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You can use text + character data like this:

<tt:text><![CDATA[<!-- This is a comment  -->]]></tt:text>

6 REPLIES 6

Former Member
0 Kudos

You can use text + character data like this:

<tt:text><![CDATA[<!-- This is a comment  -->]]></tt:text>

0 Kudos

Hi, Thanks for the help. It does display.

Is there another way to do this? In a normal XML programming, the comments are shaded gray but when I downloaded my XML they are in BOLD texts. And I also could not put comments right after the <tt:template> part. The program creates Runtime error.

0 Kudos

You're right: actually there's no way to escape the < > characters in simple transformations, so you should try using XSLT.

0 Kudos

No way? That's unfortunate. I can't use XSLT since the ST is already in place and I just need the comments. I guess I'll live with what you suggested for the meantime. Thanks!

0 Kudos

I have the same challange, I would like to pass a value from ABAP variable into the XML file as a comment value. - I don't get it, how should it work? With

<tt:text><![CDATA[<!-- This is a comment -->]]></tt:text>
it is not working for me - inside the template I get an exception, outside it does not show up in the exported file.

AlexGourdet
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello alexander.kutz,

Consider starting a new question thread as you'll not get any response commenting on an inactive thread from 2014.

Regards,

Alex