Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
khusal810
Active Participant
4,217
Hello Peers,

Recently, we had a requirement in which we wanted statistical information on the number of messages processed in PI and Mail to be sent to the stakeholders.

In this blog, I will focus on how to convert the XML data of payload to table contents for a Mail Adapter.

The challenge was with the Mail Adapter configuration as a Receiver. Mail Adapter Receiver does not allow directly send payload as a body and also all Mail Clients require the body in HTML format.

This got me thinking, I need to things first to bring the payload in HTML Format and secondly, the payload should be passed as body and not as an attachment.

The second requirement can be easily tackled. The following blog from engswee.yeoh

Stop using Mail Package! © – Simplify your mail receiver adapter scenarios


provides a fair idea of how to transform Mail attachment to Mail Body.

Please go through the above blog before moving forward.

I have followed the same steps as mentioned in the above blog except for one change

Instead of using Content-Type as text/plain, I changed it to text/html as we need to create a HTML page for the Mail client to display as a table.

















Parameter Value
Transform.ContentType text/html; charset=”UTF-8″
Transform.ContentDisposition inline

Now as we have dealt with the payload as Mail Body. Let us now focus on how to convert the xml payload to a dynamic HTML page using <table> Tags.

The simplest way to achieve this is by using XSLT Mapping to create HTML page using <xsl:for-each> as well as <xsl:value-of>.

Remember you can also use CSS also, in order to beautify your table.

https://www.w3schools.com/xml/xsl_transformation.asp

The above link provides a fair idea of how to transform the XML Data to HTML Table.

Note: XML with Prefix will not work. You will need to remove the prefix from each XML Tag. For this, we can use another XSLT Mapping. This blog will help you achieve the same.

After following all the steps I was able to achieve the result in a Table format as below



Here Service, Channel Name, Adapter Type, Direction, Channel Status are a part of XML Data Type.

Please do let me know your feedback. 🙂
Labels in this area