日期:2014-05-17  浏览次数:20672 次

ABAP 使用Smartforms发送HTML邮件

 

Send HTML Mail usingSmartforms

发送HTML邮件使用Smartforms

 

Hi everyone, in this blog I will share my twocents worth in sending notification email in SAP.
大家好,在这篇博客,我将分享两份用SAP发送通知邮件示例。

 

Businessscenarios业务场景

In my project, I have to write a customizedWeb Dynpro Application to facilitate a business process for user. Most of theactivities in this business process is     about Approval,with different layers of Approver. After each Approver makes an action(Approve/Reject), notification emails have to be sent to relevant parties.

 在项目中,我们需要写一个自定义的Web Dynpro应用程序,以方便用户的业务流程。此业务流程的活动大多是有关批准,与不同层次的审批者。每个审批人(批准/拒绝)后,通过电子邮件发送到相关人士。

 

The total different emails willhave to be sent is morethan 10. I have to find an effective way to sendout the emails.

完全不同的电子邮件将被发送超过10次。我们必须要找到一个有效的方式来发送电子邮件。

 

Approaches方法

Even though there are more than 10 emailcontents, more or less they have the same structures.

即使有10个以上不同内容的电子邮件,或多或少的它们具有相同的结构。

 

<<Header>><<Body>><<Footer>>

E.g. <<Footer>> isalways like "Thisis a generated computer message. Please do not reply."

例如“信尾”大多都会这样“这是一个计算机自动生成的信息。请不要回复。”

 

This means if I find an effective way togroup the email and write the code, maintenance will be much more easier for meif user requires any changes in the future. I start Google and search for ideason SCN. Some of the solutions I found:

这意味着,如果我们找到一个有效的方式进行分组,电子邮件和编写代码,维护更容易对我们来说,不管用户将来需求如何变化。我开始用Google在SCN搜素我的想法的一些解决方案,我发现:

E.g. - Write email content in the code,make use of Text Elements

      - Use SO10 to write email content

例如 – 用代码写邮件内容必须使用文本元素

-         电子邮件的内容

All of the solutions I found did not meet mycriteria of structuring Email Contents for easy maintenance.

所有的解决方案,我发现不符合我的标准.并不便于维护。

This is when I came to think of usingSmartforms. Smartforms with its Control Flow and Condition will help me