cancel
Showing results for 
Search instead for 
Did you mean: 

CL_BCS - How to send e-mail to several recipients, based on VKORG?

Former Member
0 Kudos

Hello,

I am using CL_BCS to send an e-mail with an Excel attachment, BUT I don't know how to implement that the e-mail is sent to a distribution list based on the VKORG.

I have a table ZRECIPIENTS with fields VKORG and AD_SMTPADR. The recipients should be added to the e-mail from this ZRECIPIENTS table.

Please give me an example on how to do that...

Accepted Solutions (1)

Accepted Solutions (1)

raymond_giuseppi
Active Contributor

Fill an internal table with a simple SELECT statement, then loop in the internal table and build/add receiver with methods

lo_recipient = cl_cam_address_bcs=>create_internet_address( i_address_string = lv_smtpadr ).
lo_bcs->add_recipient( i_recipient = lo_recipient ).

Regards,
Raymond

Former Member
0 Kudos

Thank you, Raymond.

Could you please show me how could I build/add receiver with methods? That is the upsetting part for me.

Regards,

Mădălina

raymond_giuseppi
Active Contributor

Well I could add (but not useful IMHO)

SELECT smtpadr INTO TABLE lt_smtpadr
  FROM zrecipients WHERE vkorg = vbak-vkorg.
LOOP AT lt_smtpadr ASSIGNING <address>.
  lo_recipient = cl_cam_address_bcs=>create_internet_address( i_address_string = <address> ).
  lo_bcs->add_recipient( lo_recipient ).
ENDLOOP.

So what part exactly upset you?
Regards,
Raymond

Former Member
0 Kudos

It is useful for me as a junior 🙂

Thank you very much!

Answers (0)