Learn how to generate email alerts on the display or change of any critical node in the SAP Customizing IMG (transaction code SPRO) using an implicit enhancement option. For example, if any user wants to display or change rule maintenance of Bank Communication Management, which is a very critical part of the configuration, the system should send alerts to managers so that they can take immediate action against the activity if required.
Key Concept
Enhancement options allow you to add your own functionality to SAP standard programs without modifying the original code. They resemble plug-ins that you can add or remove any time as per your requirements. Your functionality remains the same even after an upgrade. There are many enhancement types, but to fulfill the current requirement, the implicit enhancement is the key.
As you know, SPRO is a critical transaction code, but there are some nodes that are the most critical part of the system configuration. There is no functionality available for the system to send email alerts if a user tries to display or change those nodes. I will explain how to identify your critical nodes and let the system send you email alerts if any user tries to display or change these nodes. I cover two scenarios.
In the first scenario the system sends email alerts whenever a user tries to display or change any node under Bank Communication Management (Figure 1). In the code you specify all the nodes for which you need alerts and also the email address or SAP user name of the person who will receive the alerts. In this article I include only the highlighted nodes for alerts, but you can add any other node.

Figure 1
Nodes under Bank Communication Management
In the second scenario the system generates automatic email alerts to a specific user whenever a user tries to display or change nodes under the Purchase Order node (Figure 2).

Figure 2
Nodes under Purchase Order
To fulfill both these scenarios, follow these steps:
Step 1. Create a simple transformation program for email formatting
Step 2. Create a program for sending an email alert
Step 3. Create an enhancement and add the required code
Step 4. Test the enhancement
Step 1. Create a Simple Transformation Program for Email Formatting
To complete this step, execute transaction code SE80. In the screen that opens, right-click the package in which you are going to save the transformation and follow menu path Create > Other (1) > Transformation (Figure 3).

Figure 3
Create a transformation program
In the next screen, populate the Transformation and Short Description fields. In the Transformation Type field, select S Simple Transformation from the drop-down list of options (Figure 4). Then click the green checkmark icon.

Figure 4
Transformation name, description, and type
Copy and paste the code shown in Figure 5 to the SourceCode tab of the transformation (Figure 6).
<?sap.transform simple?>
<tt:transform xmlns:tt="https://www.sap.com/transformation-templates">
<tt:root name="Node" type="STRING"/>
<tt:root name="User" type="STRING"/>
<tt:root name="System" type="STRING"/>
<tt:root name="CName" type="STRING"/>
<tt:root name="IPAdd" type="STRING"/>
<tt:root name="Date" type="STRING"/>
<tt:root name="Time" type="STRING"/>
<tt:template>
<html>
<body>
<td>Dear Sir,</td>
<br/>
<br/>
<td>One of the users has accessed the SAP Configuration. Details about this activity are appended below.</td>
<br/>
<br/>
<table border="2">
<tr>
<td>
<b>Node</b>
</td>
<td>
<b>User ID</b>
</td>
<td>
<b>System</b>
</td>
<td>
<b>Computer Name</b>
</td>
<td>
<b>IP Address</b>
</td>
<td>
<b>Date</b>
</td>
<td>
<b>Time</b>
</td>
</tr>
<tr>
<td>
<tt:value ref="Node"/>
</td>
<td>
<tt:value ref="User"/>
</td>
<td>
<tt:value ref="System"/>
</td>
<td>
<tt:value ref="CName"/>
</td>
<td>
<tt:value ref="IPAdd"/>
</td>
<td>
<tt:value ref="Date"/>
</td>
<td>
<tt:value ref="Time"/>
</td>
</tr>
</table>
<br/>
<td>Thanks and Regards,</td>
<br/>
<td>SAP Auto Generated Mail</td>
<br/>
</body>
</html>
</tt:template>
</tt:transform>
Figure 5
Code for transformation ZFSL_SPRO_DC_ALERT
To activate the transformation follow menu path Transformation > Activate or use the shortcut key (Ctrl+F3). This action displays the screen shown in Figure 6. Select the SourceCde (source code) tab and copy the code shown in Figure 5 into it.

Figure 6
Activate the transformation
Step 2. Create a Program for Sending an Email Alert
To complete this step execute transaction SE38, add program name ZFSL_SPRO_DC_ALERT in the Program field, and click the Create button. Copy and paste the code shown in Figure 7 to the program. To activate this program, click the match icon shown in the tool bar in Figure 8 or use the shortcut key (Crtl+F3).
REPORT zfsl_spro_dc_alert.
DATA: ref_cl_bcs TYPE REF TO cl_bcs VALUE IS INITIAL.
DATA: ref_cl_document_bcs TYPE REF TO cl_document_bcs VALUE IS INITIAL.
DATA: ref_if_sender_bcs TYPE REF TO if_sender_bcs VALUE IS INITIAL.
DATA: ref_if_recipient_bcs TYPE REF TO if_recipient_bcs VALUE IS INITIAL.
DATA: cdate TYPE char10,
ctime TYPE char8.
DATA: snode TYPE string,
suser TYPE string,
ssystem TYPE string,
scname TYPE string,
sipadd TYPE string,
sdate TYPE string,
stime TYPE string.
DATA: it1_soli_tab TYPE soli_tab.
DATA: uname TYPE sy-uname.
PARAMETERS: p_email TYPE adr6-smtp_addr DEFAULT 'faisalatsap@gmail.com'. " E-Mail ID or SAP User Name
PARAMETERS: p_sub TYPE char50 DEFAULT 'Alert: Display/Change in T-Code SPRO'. " Subject
PARAMETERS: p_tcode TYPE tcode DEFAULT 'SM30'. " T-Code
PARAMETERS: p_objn TYPE ob_object DEFAULT 'V_TBNK_CUST_DFLT'. " View
PARAMETERS: p_send AS CHECKBOX DEFAULT 'X'.
START-OF-SELECTION.
CALL METHOD cl_gui_frontend_services=>get_computer_name
CHANGING
computer_name = scname
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
CALL METHOD cl_gui_frontend_services=>get_ip_address
RECEIVING
ip_address = sipadd
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
ref_cl_bcs = cl_bcs=>create_persistent( ).
IF p_tcode = 'SM30' OR p_tcode = 'SM34'.
CASE p_objn.
WHEN 'V_TBNK_CUST_DFLT'.
snode = 'BCM: Basic Settings for Approval'.
WHEN 'V_BNK_RULE_MAINT'.
snode = 'BCM: Rule Maintenance'.
WHEN 'V_TBNK_GRP_ADDCR'.
snode = 'BCM: Additional Criteria for Payment Grouping'.
WHEN 'V_TBNK_XST_2_IST'.
snode = 'BCM: Map External Status to Internal Status'.
WHEN 'V_BNK_TIMEOUT'.
snode = 'BCM: Timeout for Batch Status Update'.
WHEN 'V_TBNK_AUT_PAYM'.
snode = 'BCM: Mark Rules for Automatic Payments(No Approval)'.
WHEN 'VV_TBCA_REL_RULE_BNK_INI'.
snode = 'BCM: Assign Role to Release Steps'.
WHEN 'VV_TBCA_REL_RULE_BNK_COM'.
snode = 'BCM: Assign Role to Release Steps'.
WHEN 'VV_TBCA_RTW_BNK_COM'.
snode = 'BCM: Assign Workflow Template to Release Procedure'.
WHEN 'V_TC92'.
snode = 'BCM: Specify Signature Method for Approval Using Simple Signature'.
WHEN 'VVC_T161_VF'.
snode = 'PO: Define Document Types'.
WHEN 'VV_169G_PS'.
snode = 'PO: Set Tolerance Limits for Price Variance'.
WHEN 'V_T16FG_2'.
snode = 'PO: Define Release Procedure for Purchase Orders: Release Groups'.
WHEN 'VV_T16FC_2'.
snode = 'PO: Define Release Procedure for Purchase Orders: Release Codes'.
WHEN 'V_T16FB'.
snode = 'PO: Define Release Procedure for Purchase Orders: Release indicator'.
WHEN 'VV_T16FS_2'.
snode = 'PO: Define Release Procedure for Purchase Orders: Release Strategies'.
WHEN 'VV_T16FW_2'.
snode = 'PO: Define Release Procedure for Purchase Orders: Workflow'.
WHEN OTHERS.
snode = ''.
ENDCASE.
ELSE.
CASE p_tcode.
WHEN 'OBPM4'.
snode = 'BCM: Payment Medium:Create/Assign Selection Variants'.
WHEN 'FTE_BSM_CUST'.
snode = 'BCM: Settings for Bank Statement Monitor'.
WHEN 'BNK_BNK_COM_REL01'.
snode = 'BCM: Define Release Procedure'.
WHEN 'SU01'.
snode = 'BCM: Define Basis settings'.
WHEN 'OMH6'.
snode = 'PO: Define Number Ranges'.
WHEN 'OMGQ_CHAR'.
snode = 'PO: Edit Characteristic'.
WHEN 'CL02'.
snode = 'PO: Edit Class'.
WHEN 'OMGSCK'.
snode = 'PO: Check Release Strategies'.
WHEN OTHERS.
snode = ''.
ENDCASE.
ENDIF.
DATA: sysid_name TYPE text15.
CASE sy-sysid.
WHEN 'YSD'. " Change as Per your System ID
sysid_name = 'Development'.
WHEN 'YSQ'. " Change as Per your System ID
sysid_name = 'Quality'.
WHEN 'YSP'. " Change as Per your System ID
sysid_name = 'Production'.
WHEN OTHERS.
ENDCASE.
WRITE: sy-datum TO cdate,
sy-uzeit TO ctime.
snode = snode.
suser = sy-uname.
ssystem = sysid_name.
sdate = cdate.
stime = ctime.
CALL TRANSFORMATION zfsl_spro_dc_alert
SOURCE node = snode
user = suser
system = ssystem
cname = scname
ipadd = sipadd
date = sdate
time = stime
RESULT XML it1_soli_tab
OPTIONS xml_header = 'NO'.
ref_cl_document_bcs = cl_document_bcs=>create_document(
i_type = 'HTM'
i_importance = '5'
i_text = it1_soli_tab
i_subject = p_sub ).
ref_cl_bcs->set_document( ref_cl_document_bcs ).
TRY.
ref_if_sender_bcs = cl_sapuser_bcs=>create( sy-uname ).
ref_cl_bcs->set_sender(
EXPORTING
i_sender = ref_if_sender_bcs ).
FIND '@' IN p_email. " Check it's E-Mail Address or SAP User Name
IF sy-subrc = 0.
ref_if_recipient_bcs = cl_cam_address_bcs=>create_internet_address( p_email ). " Send Alert to any E-Mail Address
ELSE.
uname = p_email.
TRANSLATE uname TO UPPER CASE.
ref_if_recipient_bcs = cl_sapuser_bcs=>create( uname ). " Send Alert to SAP User Name
ENDIF.
ref_cl_bcs->add_recipient(
EXPORTING
i_recipient = ref_if_recipient_bcs
i_express = 'X' ).
CALL METHOD ref_cl_bcs->set_send_immediately
EXPORTING
i_send_immediately = p_send.
ref_cl_bcs->send(
EXPORTING
i_with_error_screen = 'X' ).
COMMIT WORK.
IF sy-subrc = 0.
* WRITE :/ 'Mail sent successfully'.
ENDIF.
ENDTRY.
Figure 7
Code for program ZFSL_SPRO_DC_ALERT

Figure 8
Activate program ZFSL_SPRO_DC_ALERT
Step 3. Create an Enhancement and Add the Required Code
To complete this step execute transaction code SE38 add include the name LS_CUS_ACTIVITYF01 in the program field. Click the display icon. Then click the enhance icon in Figure 9 or press Shift+F4.

Figure 9
Display include LS_CUS_ACTIVITYF01
Now you can see the include in enhancement mode. The left side of the code turns white (Figure 10).

Figure 10
The include in enhancement mode
Follow menu path Edit > Enhancement Operations > Show Implicit Enhancement Options. Go to FORM start_selected_transaction. At the start of the form, you can see the implicit enhancement point (Figure 11). The start_selected_transaction is the form that is used to do any action against the selection of a node in transaction code SPRO. This form provides you with information about the selected node. You pass these properties of the node to the program you created in step 1 for sending email alerts.

Figure 11
The implicit enhancement point at the start of form start_selected_transaction
Right-click the enhancement point line and select Enhancement Operations > Create Implementation from the context menu. In the pop-up message box that appears, click the Code button (Figure 12).

Figure 12
Select an enhancement type
In the next screen, enter the Enhancement Implementation name and Short Text (Figure 13). Click the green checkmark icon to go to Figure 14.

Figure 13
Enter the Enhancement Implementation name and Short Text
Click the new request icon highlighted in Figure 14 to create a new transport request. The transport request is like a bucket in which you place all your changed or newly created objects. Later, after testing, you transport this bucket to the quality system. After your changes are applied to the quality system and tested, you transport the request to the production system.

Figure 14
Create a new transport request
In the next screen enter a Short Description and click the save icon (Figure 15).

Figure 15
Enter a short description of a transport request
Add the enhancement implementation object to the request by clicking the green checkmark icon (Figure 16). This is the enhancement implementation that you are entering in the standard code for adding the custom functionality.

Figure 16
Add the object to this request
Add the code in Figure 17 inside the enhancement and activate it (Figures 18 to 20).
Note
If you want to add additional nodes in the mail alert you have to put
BREAK-POINT on the start of this code to find out the properties of that
node. You add this to the enhancement code and also in program
ZFSL_SPRO_DC_ALERT.
Figure 17 Figure 17Figure 18
DATA: zz_email TYPE adr6-smtp_addr VALUE 'faisalatsap@gmail.com',
Figure 17
Replace the address
IF sy-tcode = 'SPRO'.
DATA: zz_email TYPE adr6-smtp_addr VALUE 'faisalatsap@gmail.com', " Change Mail ID or SAP User Name Here who will received alert
zz_subject TYPE text50 VALUE 'Alert: Display/Change in T-Code SPRO'.
CASE objectname.
WHEN 'V_TBNK_CUST_DFLT'
OR 'V_BNK_RULE_MAINT'
OR 'V_TBNK_GRP_ADDCR'
OR 'V_TBNK_XST_2_IST'
OR 'V_BNK_TIMEOUT'
OR 'V_TBNK_AUT_PAYM'
OR 'VV_TBCA_REL_RULE_BNK_INI'
OR 'VV_TBCA_REL_RULE_BNK_COM'
OR 'VV_TBCA_RTW_BNK_COM'
OR 'V_TC92'
OR 'VVC_T161_VF'
OR 'VV_169G_PS'
OR 'V_T16FG_2'
OR 'VV_T16FC_2'
OR 'V_T16FB'
OR 'VV_T16FS_2'
OR 'VV_T16FW_2'.
SUBMIT zfsl_spro_dc_alert USING SELECTION-SCREEN '1000'
WITH p_email = zz_email
WITH p_sub = zz_subject
WITH p_tcode = p_tcode
WITH p_objn = objectname
AND RETURN.
WHEN OTHERS.
ENDCASE.
CASE p_tcode.
WHEN 'OBPM4'
OR 'FTE_BSM_CUST'
OR 'BNK_BNK_COM_REL01'
OR 'SU01'
OR 'OMH6'
OR 'OMGQ_CHAR'
OR 'CL02'
OR 'OMGSCK'.
SUBMIT zfsl_spro_dc_alert USING SELECTION-SCREEN '1000'
WITH p_email = zz_email
WITH p_sub = zz_subject
WITH p_tcode = p_tcode
WITH p_objn = objectname
AND RETURN.
WHEN OTHERS.
ENDCASE.
ENDIF.
Figure 18
Code for enhancement Z_CBC_DB_SE16_SE11
After adding code in the enhancement, you need to activate it by clicking the Enhancements button in Figure 19 or by using the shortcut key (Ctrl+F3).

Figure 19
Activate the enhanced code
You then see the enhancement object selected in the next window (Figure 20). Click the green checkmark icon to activate it.

Figure 20
Activate the enhancement object
You can see that the enhancement is activated (Figure 21).

Figure 21
Enhancement activated
Step 4. Test the Enhancement
Now you are ready to test the enhancement. Execute transaction code SPRO and select the Define Release Procedure node under Bank Communication Management (Figure 22).

Figure 22
Select Define Release Procedure
As soon as a user selects the node Define Release Procedure, an email alert is sent to the selected reviewer (Figure 23).

Figure 23
Email alert for display of the Bank Communication Management node
Execute transaction code SPRO again to test the Purchase Order nodes. Select Define Release Procedure for Purchase Orders (Figure 24).

Figure 24
Select Define Release Procedure for Purchase Order
From the pop-up window you can select any of the given options. In this test I double-click Release Strategies (Figure 25).

Figure 25
Double-click Release Strategies
The reviewer gets an immediate email alert after selecting Release Strategies (Figure 26). After testing you remove the test email ID of the tester and add the actual email.

Figure 26
Email alert for the display of the Purchase Order node
Faisal Altaf
Faisal Altaf is a certified development consultant. He has more than seven years of experience and currently is working with Al Yamamah Steel Industries Co., Saudi Arabia, as the SAP technical division head. He completed his MS in software engineering and intends to complete his Ph.D. in the field of SAP.
You may contact the author at faisalatsap@gmail.com.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.