Enterprise class E-Mails from ABAP , using Rich Text Editor
Alert : Duplicate content / Idea

What is this blog all about?

Is it easy to draft and send enterprise class e-mails from ABAP ? Yes I would say

. This blog is all about what I did to send a good looking( to my eyes ) sales summary report via email.

Challenges in drafting HTML Body for E-Mails .

  • Only inline CSS are supported in the HTML tags
  • no external css files are allowed in the document
  • All CSS features are not supported by outlook
  • Its difficult to string manipulate and generate the HTML document from ABAP

What we did 

First Step – Using MS Word ( thanks ) to design

Open Microsoft word and draft the e-mail structure the way you want . Better we center align all the content so that it will look better in mobile / tablet as well. We can use images , text arts , and possibly all the basic features to style your document.

Second Step –  Place variables in the document 

Now , our design is ready. Change all the dynamic part of it using variable name. I used $$VARIABLENAME$$ format. You can choose the way you like.  Like the below.

Third Step – get HTML corresponding to the Word document 

Its simple. User a RichTextEditor from SAPUI5 library / or use the editor from SCN . Or may be any free Rich Text Editor.

Copy paste the word content to the rich editor and get the HTML correspondingly .

Step 4 : store this HTML content in SAP and dynamically replace the variables from a program . 

I developed a module pool application to capture this HTML content and store the document in a string field of a table. From the program, I fetch the data and replace the HTML variables dynamically with program variables.

and you get replaced variables in the HTML that can be used as mail body.

Enjoy Innovating..