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

Passing the parameter in the Function module MESSAGE_SEND_AS_MAIL

Former Member
0 Likes
862

Hi all,

I have to send the same message to five different mail ID's using the Function module MESSAGE_SEND_AS_MAIL

How to pass this five mail ID's in the Parameter Reciever of the Function module

Regards

Ajay

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
696

see if this helps

&----


REPORT Z_MESSAGE.

data receiv type standard table of SOMLRECI1 initial size 0.

data wa type SOMLRECI1.

wa-receiver = 'email address in caps'.

wa-REC_TYPE = 'U'.

append wa to receiv.

wa-receiver = 'email address in caps'.

wa-REC_TYPE = 'U'.

append wa to receiv.

  • do so more more three

CALL FUNCTION 'MESSAGE_SEND_AS_MAIL'

EXPORTING

msgid = 'Z_ZZZ_CA_MESSAGES'

msgno = '000'

MSGV1 = 'material'

MSGV2 = 'MAT'

MSGV3 = 'MM'

MSGV4 = 'MMM'

tables

receivers = receiv[]

.

COMMIT WORK AND WAIT.

then u can go to SOST transaction and see that the mail has been or is yet to be sent. It worked for me. The message comes in an PDF form to the mail box.

Edited by: Biswadeep Ghosh on Jun 25, 2008 2:28 PM

Edited by: Biswadeep Ghosh on Jun 25, 2008 2:30 PM

4 REPLIES 4
Read only

peter_ruiz2
Active Contributor
0 Likes
696

hi,

create an internal table with structure SOMLRECI1.

fill your internal table and use it as parameter for the FM

call function MESSAGE_SEND_AS_MAIL

importing

msgid = sy-msgid

msgno = sy-msgno

msgv1 = sy-msgv1

tables

receivers = itab.

regards,

Peter

Read only

Former Member
0 Likes
696

Hi,

Recievers is a tables parameter you can have as many recievers as u want try like this..


  data it_recievers like table of SOMLRECI1 with header line.
  it_recievers-RECEIVER = 'Name of the reciever'
  it_recievers-REC_TYPE = 'o'. for sap mail(U for internet address)
it_recievers-REC_ID = 'email'
append it_recievers.

and pass this to the fm.

Regards,

Himanshu Verma

Read only

Former Member
0 Likes
696

Fill the RECEIVER and REC_TYPE fields and append it to a internal table table type SOMLRECI1. RECEIVER contains the mail address and REC_TYPE contains the Adress type.Refer the domain so_ESCAPE for types. Pass the internal table to the Function module.

Regards,

Kiran Bobbal

Read only

Former Member
0 Likes
697

see if this helps

&----


REPORT Z_MESSAGE.

data receiv type standard table of SOMLRECI1 initial size 0.

data wa type SOMLRECI1.

wa-receiver = 'email address in caps'.

wa-REC_TYPE = 'U'.

append wa to receiv.

wa-receiver = 'email address in caps'.

wa-REC_TYPE = 'U'.

append wa to receiv.

  • do so more more three

CALL FUNCTION 'MESSAGE_SEND_AS_MAIL'

EXPORTING

msgid = 'Z_ZZZ_CA_MESSAGES'

msgno = '000'

MSGV1 = 'material'

MSGV2 = 'MAT'

MSGV3 = 'MM'

MSGV4 = 'MMM'

tables

receivers = receiv[]

.

COMMIT WORK AND WAIT.

then u can go to SOST transaction and see that the mail has been or is yet to be sent. It worked for me. The message comes in an PDF form to the mail box.

Edited by: Biswadeep Ghosh on Jun 25, 2008 2:28 PM

Edited by: Biswadeep Ghosh on Jun 25, 2008 2:30 PM