Skip to Content

Change sender email address using BCS_SEND_ADDRESSES


When I am performing a certain action in HR Portal, an email is sent to an intended recipient, but the sender is the person who logged into the HR Portal. I want the sender to be a specific email address.

I found BCS_SEND_ADDRESSES BAdI, which allows me to change the email address of sender/recipient. However, now it seems like all emails sent by class CL_BCS use my BAdI implementation and have their sender email address changed. Is there any way I could restrict when my BAdI implementation changes the email address? This BAdI does not any filters, and the interface of the implementing class, IF_BCS_BADI_SEND_ADDRESSES, does not have any parameters that could allow me to determine which action caused the email to be sent.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Nov 20, 2017 at 09:06 PM

    But if you Implement the BAdI you can add your own Custom Methods, right?

    So what's stopping you from Creating a Method to Check for 'XYZ' (SystemParameters, Tcodes or other Business Logic) and / or filling a Private Attribute, so you can Allow / Disallow the Enhancement to change the E-mail Address ...?

    Maybe I'm over-simplifying here, but if you can Determine when the User is accessing the Right Program / HR-Portal page or whatever, then set an Attribute "CHANGE_EMAIL" to 'X' and depending on that Result you can Allow for a Change in Sender or Recipient ... Again, just conceptualizing here, but that would make sence to me ...

    Add comment
    10|10000 characters needed characters exceeded

    • I ended up finding out what is the WDA-application that is causing the email to be sent using cl_wdr_task=>application_name, and if it is the one that I need, then I would change sender's email address.

      Also, I found out that this BAdI requires both es_sender and es_status_recipient to be changed in order to change email address of the sender.

  • Nov 21, 2017 at 07:19 AM

    I agree with Nic. If the possibilities of extending the caller program are limited (not possible to use the Enhancement Framework and so on), you may also get some information of the context by reading the ABAP call stack (CL_ABAP_GET_CALL_STACK=>FORMAT_CALL_STACK( CL_ABAP_GET_CALL_STACK=>GET_CALL_STACK( ) )), and reading some global variables from other programs (reserved internally to SAP - ASSIGN ('(program)global') ...).

    Add comment
    10|10000 characters needed characters exceeded