cancel
Showing results for 
Search instead for 
Did you mean: 

xslt mapping

Former Member
0 Kudos

Hi Gurus,

The scenario is proxy to mail sceario.

SAP ECC -> PI -> mail box

I created teh XSLT mapping to convert xml message coming from SAP ECC system to html message. This message should be sent to mail adapter which sends the message to mailbox.

The xslt mapping is tested successfully in XSLT_tool and I'm getting teh message displayed in HTML format.

But when I excuted teh scenario I m getting the XML message as attchement in the mail.

I want the message to be displayed in html format in the mail body and not as an attachment.

Can you please advise how this can be achieved.

The output message type I specified is

Mt_mail

From 0..1

To 0..1

Subject 0..1

Message 0...unbounded

and teh input message type is

mt_test

test 1 string

The mail attrbutes specified are below

URL smtp://mailserverhost

Authentication Method Plain

Uncheck Mail package

From : from mail id

To : to mail id

Subject: new message

encoding : base 64

Uncheck Keep Attachments

Thanks,

Jay.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

follow this blog from Michal

Use messagetransformbean to set the content type to HTML.

Do the configurations in mail receiver adapter. I tried it when i was working on similar scenario and it works perfect

Thanks,

Anand

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

In the tag content, you can put CDATA section.

Like this:


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><!-- Response --> 
<xim:Mail xmlns:xim='http://sap.com/xi/XI/Mail/30'><Subject>Nota Fiscal Paulistana - NFS-e No.xxxxxxxx emitida
</Subject>
<From>"xxxxxxxxxxxxxxx"</From>
<To>"xxxxxxxxxxxx"</To>
<Reply_To>"xxxxxxxxxxxxxxxxx"</Reply_To>
<Content_Type>text/plain; charset=iso-8859-1</Content_Type>
<Date>2011-12-12T19:58:44Z</Date>
<Message_ID><I197S117IVOxYiAyjrg000932b1defri197s117i.rede.sp></Message_ID>
<Content><![CDATA[ <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
<raiz>
<campo1>1111</campo1>
<campo2>2222</campo2>
</raiz>
]]>

Will be displayed like body of mail.

att.

Former Member
0 Kudos

Hi Carlos,

Thanks for the reply.

How can I transform input mesaage to the ouput message format

mt_mail

From 0..1

To 0..1

Subject 0..1

Message 0..unbounded

to the xml format you mentioned.

Mail 1..1

encoding optional

Subject 1..1

From 1..1

To 1..1

Content 1..1

like the payload you gave me

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><!-- Response -->

<xim:Mail xmlns:xim='http://sap.com/xi/XI/Mail/30'><Subject>Nota Fiscal Paulistana - NFS-e No.xxxxxxxx emitida

</Subject>

<From>"xxxxxxxxxxxxxxx"</From>

<To>"xxxxxxxxxxxx"</To>

<Reply_To>"xxxxxxxxxxxxxxxxx"</Reply_To>

<Content_Type>text/plain; charset=iso-8859-1</Content_Type>

<Date>2011-12-12T19:58:44Z</Date>

<Message_ID><I197S117IVOxYiAyjrg000932b1defri197s117i.rede.sp></Message_ID>

<Content><![CDATA[ <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<raiz>

<campo1>1111</campo1>

<campo2>2222</campo2>

</raiz>]]></Content></xim:Mail>

The objective is to get teh body of email like this

1111

2222

I used the below xslt mapping.

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

<xsl:transform version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

>

<xsl:template match="/">

<Subject>

<xsl:value-of select = "//Subject"/>

</Subject>

<From>

<xsl:value-of select = "//From"/>

</From>

<To>

<xsl:value-of select = "//To"/>

</To>

<Content>

<![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<xsl:value-of select = "//Message"/>

]]>

</Content>

</xsl:template>

</xsl:transform>

but when I used this xslt mapping in PI it is throwing erro like XML now well formed.

Please siuggest any solution.

Thanks,

Usha.

Former Member
0 Kudos

Usha,

For which payload did you tried?

If you are trying with different payload, can you share it

regards

Ramesh

Former Member
0 Kudos

Hi,

The correct xslt is:



<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:xim="http://sap.com/xi/XI/Mail/30">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no" cdata-section-elements="Content"/> 

<xsl:template match="/">
<xim:Mail xmlns:xim="http://sap.com/xi/XI/Mail/30">

<Subject>
<xsl:value-of select = "xim:Mail/Subject"/>
</Subject>
<From>
<xsl:value-of select = "xim:Mail/From"/>
</From>
<To>
<xsl:value-of select = "xim:Mail/To"/>
</To>
<Content>
<xsl:value-of select = "xim:Mail/Content"/>
</Content>
</xim:Mail>
</xsl:template>

</xsl:transform>

att.

Former Member
0 Kudos

>>I want the message to be displayed in html format in the mail body and not as an attachment

i think u have to use "Transform.ContentDisposition = inline" parameter of MessageTransformBean (not sure..but please check)

http://help.sap.com/saphelp_nw04/helpdata/en/57/0b2c4142aef623e10000000a155106/content.htm