cancel
Showing results for 
Search instead for 
Did you mean: 

Re: FM for sending a mail.

Former Member
0 Kudos

hi experts,

My requirement is that a mail has to be triggered to the employee stating that the data is Freezed from our end. do we have any functional module to acheive to acheive this.

regards,

joy.

Accepted Solutions (1)

Accepted Solutions (1)

former_member761936
Active Participant
0 Kudos

Hi Joy,

You can use 'SO_NEW_DOCUMENT_ATT_SEND_API1' to send a mail.but I did n't understand data frreazing concept.I think when your data is frrezed you need to send a mail, but how you know your data freezed programatically, if you know how to do it programtcally, then at that point you can use above function module

Hope this help you.

Regards,

Narendra.Soma

Former Member
0 Kudos

Sample code

DATA : l_atch_name(50) TYPE c.

CONCATENATE text-022 sy-datum '.xls' INTO l_atch_name.

  • Fill the document data.

DESCRIBE TABLE t_message LINES g_w_cnt.

gd_doc_data-doc_size = ( g_w_cnt - 1 ) * 255 + STRLEN( t_message ).

  • Populate the subject/generic message attributes

gd_doc_data-obj_langu = sy-langu.

gd_doc_data-obj_name = 'CHANGEPOINTERS'.

gd_doc_data-obj_descr = text-016.

gd_doc_data-sensitivty = 'F'.

  • Populate the attachment table

CLEAR t_attachment.

REFRESH t_attachment.

APPEND LINES OF t_attach TO t_attachment.

  • Attachment

CLEAR t_packing_list.

REFRESH t_packing_list.

t_packing_list-transf_bin = space.

t_packing_list-head_start = 1.

t_packing_list-head_num = 0.

t_packing_list-body_start = 1.

DESCRIBE TABLE t_message LINES t_packing_list-body_num.

t_packing_list-doc_type = 'RAW'.

APPEND t_packing_list.

t_packing_list-transf_bin = 'X'.

t_packing_list-head_start = 1.

t_packing_list-head_num = 1.

t_packing_list-body_start = 1.

DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.

t_packing_list-doc_type = 'XLS'.

t_packing_list-obj_descr = l_atch_name.

t_packing_list-obj_name = 'TEST'.

t_packing_list-doc_size = t_packing_list-body_num * 255.

APPEND t_packing_list.

  • Add the recipients email address

CLEAR t_receivers.

REFRESH t_receivers.

LOOP AT s_email.

t_receivers-receiver = s_email-low.

t_receivers-rec_type = 'U'.

t_receivers-com_type = 'INT'.

t_receivers-notif_ndel = 'X'.

APPEND t_receivers.

ENDLOOP.

  • Call the FM to post the message to SAPMAIL

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = gd_doc_data

put_in_outbox = 'X'

commit_work = 'X'

TABLES

packing_list = t_packing_list

contents_txt = t_message

contents_bin = t_attachment

receivers = t_receivers

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

document_type_not_exist = 3

operation_no_authorization = 4

parameter_error = 5

x_error = 6

enqueue_error = 7

OTHERS = 8.

  • Store function module return code

gd_error = sy-subrc.

Answers (1)

Answers (1)

Former Member
0 Kudos

thanxs for the nedful.