2011 Mar 28 5:56 PM
Hello Folks,
I have a requirement wherein I need to add a text "[Test Mail]" in the email subject of all outgoing mails from our dev/test systems. This is to ensure that the end users who are the receipients are able to distinguish the emails sent out by the test system from the emails sent out by the actual production system.
Do let me know if anyone out here has developed something similar or can provide some advice/help into this matter.
Thanks in advance,
Abhishek
2011 Mar 28 7:36 PM
You didn't mention how your emails are generated? Are you using standard output processing programs, Z-programs, class CL_BCS, etc.? In my case it's very simple: all of our email handling goes through a custom class with methods that wrap CL_BCS. For non-productive clients, the methods always insert '*** Test ***' as the leading part of the subject.
2011 Mar 28 8:11 PM
You could check the value of SY-SYSID and if it is not your production system, concatenate "TEST' and the normal subject to your subject value. For example,
IF SY-SYSID <> 'PRD'. ( use the name of your Production SAP system here )
Concatenate 'TEST MAIL" wk_subject_line to wk_subject_line separated by space.
ENDIF.
2011 Mar 28 10:15 PM
Names might change, the better way in my opinion is to query table T000 field CCCATEGORY for the role of the current client.
Thomas
2011 Mar 29 12:34 PM
Hi Brad,
We are mainly using CL_BCS as well as FM SO_NEW_DOCUMENT_ATT_SEND_API1 in the system. The problem here is that there is no one fixed/common approach being followed. So I need to understand if there is a way by which I can access all the outgoing mails from the system and change the subject.
One option that I thought was to find out some enhancements or BADIs within CL_BCS and FM SO_NEW_DOCUMENT_ATT_SEND_API1 to manipulate the subject line before the mail is sent out. This would cover most of the cases where mails are sent out from the system, but I am not sure if the mails can be sent out by any other means as well.
abhishek
2011 Mar 29 4:00 PM
Unfortunately, mails can be created using other older functions as well. Most newer functions are going to call CL_BCS. Stating the obvious, it would be far easier in the long run to use a custom wrapper class for all email creations. You aren't going to find explicit enhancement points in CL_BCS or CL_DOCUMENT_BCS for accessing the subject but you could use your own enhancement. Otherwise, you might look at the dispatching functions such as SX_OBJECTS_SEND_ARFC and SX_PERFORM_SMTPSEND. For outputs, you might also look at using a variable in the mail title config to add your text.