Application Development 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: 

Send mail to multiple user's at a time

Former Member
0 Kudos

HI.... MY requirement is send mail multiple user's at a time in oops-alv ,but i can  send mail to sigle user and i tried to send mail to multiple user at a time but that was failed i.e i colud not  send mail to multiple users at a time. please could any one know how to solve this problem in oops-alv.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Try the following code.

If t_recip has the email id's of all the recipients.

LOOP AT t_recip INTO lw_recip.

CLEAR: lv_sender.

lv_sender lw_recip-email_id.

*           --------- add recipient (e-mail address) -----------------------

recipient = cl_cam_address_bcs=>create_internet_address(

                                               lv_sender ).

*           add recipient with its respective attributes to send request

   CALL METHOD send_request->add_recipient

        EXPORTING

                 i_recipient = recipient

                 i_express   = 'X'.

ENDLOOP.

*         ---------- send document ---------------------------------------

    CALL METHOD send_request->send(

         EXPORTING

              i_with_error_screen = 'X'

         RECEIVING

               result              = sent_to_all ).

This should work fine.

Regards,

Susmitha Pritam

13 REPLIES 13

gururaj_srinivasa
Participant
0 Kudos

Hi Karthik,

Try to send it to distribution list containing multiple user email IDs. You can create distribution list in your exchange server, your IT folks can help you.

Guru

0 Kudos

HI... can u explain clearly please about how to do this?

gururaj_srinivasa
Participant
0 Kudos

Karthik,

Check this link http://support.microsoft.com/kb/821904

I am not an expert in exchange server, please check with your IT team they should be able to help you out.

Guru

Former Member
0 Kudos

Try the following code.

If t_recip has the email id's of all the recipients.

LOOP AT t_recip INTO lw_recip.

CLEAR: lv_sender.

lv_sender lw_recip-email_id.

*           --------- add recipient (e-mail address) -----------------------

recipient = cl_cam_address_bcs=>create_internet_address(

                                               lv_sender ).

*           add recipient with its respective attributes to send request

   CALL METHOD send_request->add_recipient

        EXPORTING

                 i_recipient = recipient

                 i_express   = 'X'.

ENDLOOP.

*         ---------- send document ---------------------------------------

    CALL METHOD send_request->send(

         EXPORTING

              i_with_error_screen = 'X'

         RECEIVING

               result              = sent_to_all ).

This should work fine.

Regards,

Susmitha Pritam

0 Kudos

Hi... thanks for ur answer.. that is working fine according to ur logic. now iam facing one more issue. now end user want to display data with correspind fileds & their values in table format in mail body section. how to solve this issue please give me solution..

0 Kudos

Hi,

     Try using this method

document = cl_document_bcs=>create_document(

                                                i_type    = 'RAW'

                                                i_text    = text

                                                i_subject = lv_subj_msg ).

Subject and type are mandatory. Text is a table of line type Soli (255 characters). So you can append you display data line by line to TEXT table and use the above method to create the body with contents.

Note: Soli is only 255 characters in length.

Thanks & Regards,

Susmitha Pritam

0 Kudos

I suggest you create a form and attach it to the email rather than displaying the content in the body of the email.

0 Kudos

Hi...  as per ur answer i created smartform. then i called function module in driver module & then i called one more FM convert_to_otf ( to convert data in to pdf). then in that FM i used one parameter lines . that parameter value i passed in add_ attachment method . but it is showing error .  because in add_attachment method the parameter  type & in FM parameter type is diffrent.  how to solve this problem? how to use smartform output data in oops-alv while sending data through email .  please explain procedure in detail.

0 Kudos

Hi...  as per ur answer i created smartform. then i called function module in driver module & then i called one more FM convert_to_otf ( to convert data in to pdf). then in that FM i used one parameter lines . that parameter value i passed in add_ attachment method . but it is showing error .  because in add_attachment method the parameter  type & in FM parameter type is diffrent.  how to solve this problem? how to use smartform output data in oops while sending data through email .  for display data in table fomat ? please explain procedure in detail.

0 Kudos

Convert_to_otf? i dont see nay FM with this name. Can you please be more specific?

0 Kudos

hi. sorry ....  that is convert_otf this Fm convert smartform data into pdf.  CALL FUNCTION 'CONVERT_OTF'   EXPORTING     format                = 'PDF'     max_linewidth         = 132   IMPORTING     bin_filesize          = bin_filesize   TABLES     otf                   = tab_otf_final     lines                 = pdf_tab   EXCEPTIONS     err_max_linewidth     = 1     err_format            = 2     err_conv_not_possible = 3     err_bad_otf           = 4     OTHERS                = 5. IF sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF

0 Kudos

HI..  Sorry that is convert_otf  CALL FUNCTION 'CONVERT_OTF'   EXPORTING     format                = 'PDF'     max_linewidth         = 132   IMPORTING     bin_filesize          = bin_filesize   TABLES     otf                   = tab_otf_final     lines                 = pdf_tab   EXCEPTIONS     err_max_linewidth     = 1     err_format            = 2     err_conv_not_possible = 3     err_bad_otf           = 4     OTHERS                = 5. IF sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF

0 Kudos

Hi.. iam facing one problem 'user wants attachment name more than 50 chars but in add_attachmnet method the parameter i_attachment_subject is limited to 50 chars. how to solve this pbm? can any one provide solution for this? regards Karthik