I find it quite often that my team and I are asked to insert different kinds of email notifications/reminders into our programs. Sometimes the requirements for these kind of emails is simple (plain text), in other cases however, the users want texts with different fonts, colors and sizes, hyperlinks, attached files, or even embedded images.
Usually, I’ve seen developers insert their HTML coding between ABAP lines. Even though this is a working solution, it’s not really optimum as the overall flexibility (openness to changes) and maintainability is close to none.
Yet, being lazy as I am, I wanted to build a more generic solution, something easy to modify (hopefully, not by myself). I called it Email Rendering Framework, in short ERF. I figured a relatively cool name will make this even more successful.
Also, the SMTP-based mail server (mlunxsnd) must be configured.
As a short description of the solution (so that you can decide whether or not to continue reading):
The system administrator or process expert creates the body of the email using Microsoft Word. Inserts place holders for dynamic values, hyperlinks and embedded images. Saves this file as a Web Page, Filtered (.html) and uploads it into SAP using DMS. Except for a small configuration database table, everything else is taken care of by the ERF class.
In the second part, I’ll describe the logic behind this framework and how to build the rendering class.