Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
56 views4 pages

SAP ABAP Default Sender Approaches

The document outlines various approaches to set a default sender in SAP ABAP ECC 7.0 using different classes and methods, including CL_SAPUSER_BCS for SAP users, CL_CAM_ADDRESS_BCS for internet email addresses, and dynamic sender options. Each approach has its pros and cons, such as auditability, flexibility, and the need for code changes. Additionally, it provides a summary table comparing flexibility, code requirements, and typical use cases for each method.

Uploaded by

sahuojaswi1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views4 pages

SAP ABAP Default Sender Approaches

The document outlines various approaches to set a default sender in SAP ABAP ECC 7.0 using different classes and methods, including CL_SAPUSER_BCS for SAP users, CL_CAM_ADDRESS_BCS for internet email addresses, and dynamic sender options. Each approach has its pros and cons, such as auditability, flexibility, and the need for code changes. Additionally, it provides a summary table comparing flexibility, code requirements, and typical use cases for each method.

Uploaded by

sahuojaswi1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Approaches to Set Default Sender in

SAP ABAP ECC 7.0 (CL_BCS)


1. Using CL_SAPUSER_BCS (SAP User as Sender)
Code Example:

DATA(lo_sender_user) = cl_sapuser_bcs=>create( 'TECHUSER' ).


lo_bcs->set_sender( lo_sender_user ).

 Pros:

 Sender is tied to an SAP user.


 Good for auditability and traceability.

 Cons:

 Requires that the SAP user has an email address maintained in SU01.

2. Using CL_CAM_ADDRESS_BCS (Internet Email Address as Sender)


Code Example:

DATA(lo_sender_email) =
cl_cam_address_bcs=>create_internet_address( '[email protected]' ).
lo_bcs->set_sender( lo_sender_email ).

 Pros:

 No need for a real SAP user.


 Useful for generic senders (e.g., 'no-reply').

 Cons:

 Email domain must be allowed by SAPconnect (SCOT).

3. Use SY-UNAME (Dynamic Sender Based on Logged-In User)


Code Example:
DATA(lo_sender_user) = cl_sapuser_bcs=>create( sy-uname ).
lo_bcs->set_sender( lo_sender_user ).

 Pros:

 Dynamic and user-specific.


 Good for interactive scenarios.

 Cons:

 May not work well in background jobs if background user has no email.

4. System Default via SO16 (No Code Required)


Code Example:

SO16 → Communication Method → Set default sender address

 Pros:

 No code change required.


 Applies to all BCS emails without an explicitly set sender.

 Cons:

 Not program-specific.
 Harder to control or audit at the program level.

5. Custom Sender Configuration Table


Code Example:

SELECT SINGLE sender_email INTO @DATA(lv_sender)


FROM zmail_sender_config
WHERE progname = sy-repid.

IF sy-subrc = 0.
DATA(lo_sender_email) = cl_cam_address_bcs=>create_internet_address( lv_sender ).
lo_bcs->set_sender( lo_sender_email ).
ENDIF.

 Pros:

 Flexible and configurable.


 Easy to maintain without code changes.
 Cons:

 Requires custom development and maintenance of the Z-table.

6. BAdI or Enhancement Spot (Advanced)


Code Example:

Implement BAdIs like SXS_INTERFACEMAIL or enhancement spot CL_BCS

 Pros:

 Centralized email control.


 Reusable across programs.

 Cons:

 Complex setup.
 Requires careful design to avoid side effects.
Summary Table
Approach Flexibility Requires Code? Typical Use Case

1. CL_SAPUSER_BCS Medium Yes Technical user


sending email

2. High Yes Shared mailbox or


CL_CAM_ADDRESS_ generic sender
BCS

3. SY-UNAME Medium Yes User-driven


processes

4. SO16 Default Low No System-wide default


sender

5. Custom Z-Table High Yes Configurable sender


per program

6. Very High Yes Enterprise-level


BAdI/Enhancement control

You might also like