Skip to Content
0

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

Oct 31, 2016 at 11:46 AM

95

avatar image

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...

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Raymond Giuseppi
Oct 31, 2016 at 12:38 PM
1

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

Show 3 Share
10 |10000 characters needed characters left characters exceeded

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

0

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

1

It is useful for me as a junior :)

Thank you very much!

0