Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Using CL_BCS with specific mail Id

former_member239066
Participant
0 Likes
823

Hi Experts,

I am trying to use CL_BCS to send mails for specific mail ids (maintained in Z table) as receiver and sender.

The issue is that there are methods to set receiver and sender by specifying fields of type SY-UNAME.

Are there any methods I can use to set the specific mail ids as sender and receiver?

Thanks,

Vitish.

Hi Experts,

I am trying to use CL_BCS to send mails for specific mail ids (maintained in Z table) as receiver and sender.

The issue is that there are methods to set receiver and sender by specifying fields of type SY-UNAME.

Are there any methods I can use to set the specific mail ids as sender and receiver?

Thanks,

Vitish.

1 REPLY 1
Read only

srikanthv2
Participant
0 Likes
481

Hi,

* Set Sender Email Address

  IF BCS_EXCEPTION IS INITIAL.

    TRY.

       SENDER ?= CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS(  '[email protected]' ).

      CATCH CX_ADDRESS_BCS INTO BCS_EXCEPTION.

    ENDTRY.

  ENDIF.

  IF BCS_EXCEPTION IS INITIAL.

    TRY.

        CALL METHOD SEND_REQUEST->SET_SENDER

          EXPORTING

            I_SENDER = SENDER.

      CATCH CX_SEND_REQ_BCS INTO BCS_EXCEPTION.

    ENDTRY.

  ENDIF.

* Set Recipient Email Addresses

IF BCS_EXCEPTION IS INITIAL.

TRY.

  RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( '[email protected]' ).

      CATCH CX_ADDRESS_BCS INTO BCS_EXCEPTION.

    ENDTRY.

  ENDIF.

  IF BCS_EXCEPTION IS INITIAL.

    TRY.

        CALL METHOD SEND_REQUEST->ADD_RECIPIENT

          EXPORTING

            I_RECIPIENT = RECIPIENT.

      CATCH CX_SEND_REQ_BCS INTO BCS_EXCEPTION.

    ENDTRY.

  ENDIF.

for sending to more users loop the code of receiver.

Regards

Srikanth