Sending email to a SAP inbox and an ordinary email inbox
11,314
Solution 1
Here you have a nice example of how to do it wiki.sdn.sap.com
Solution 2
I don't know why people keep on digging up that old function module. I'd always recommend using the Business Communication Services API - it's well documented and much easier to use. The docs also contain an example on how to send to an external mail address.
Comments
-
Eva Dias almost 2 years
I needed a function to send an email to an ordinary email address and to send on too to an SAP Inbox. I found this function:
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1' EXPORTING document_data = gd_doc_data put_in_outbox = 'X' commit_work = 'X' TABLES packing_list = it_packing_list contents_txt = it_message receivers = it_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.
The it_receivers it's filled like this:
FREE wa_it_receivers. wa_it_receivers-receiver = sy-uname. "&----- Assign SAP User Id wa_it_receivers-rec_type = 'B'. "&-- Send to SAP Inbox wa_it_receivers-com_type = 'INT'. wa_it_receivers-notif_del = 'X'. wa_it_receivers-notif_ndel = 'X'. APPEND wa_it_receivers TO it_receivers .
This only send's the email to the SAP inbox. I went to the domain of the rec_type field to see which letter is so it can send the email to an ordinary email account. I believe it is 'A' but, as it only says external address. Is that the one? Thank you.
-
Eva Dias over 11 yearsThanks. Looks interesting. I'm going to check it out.
-
Eva Dias over 11 yearsI'm sorry but I found it on the web. Looke easy to follow and seamed to do exactly what I need. Has I said, I'm learning about ABAP and SAP just for a bit now, so I'm not familiar with things that are old or not. That's why I post my doubts here. Thanks.
-
vwegert over 11 yearsNo need to be sorry about it :-)
-
Eva Dias over 11 yearsI've seen the code in that link and it worked! Just needed to alter somethings in regard the external email like making a loop to get all the email from a table, but it was very simple. Thanks a lot!!
-
Eva Dias over 11 yearsBy the way, any thougths on how tho change the name of the sender? Thanks
-
Jagger over 11 years@EvaDias The function module
SO_NEW_DOCUMENT_ATT_SEND_API1
calls directly other function module which isSO_DOCUMENT_SEND_API1
. In the second one you have an option to pass sender address in parametersSENDER_ADDRESS
andSENDER_ADDRESS_TYPE
. -
Mtok almost 10 years@vwegert any idea how to change sender as email adress in oo ?
-
vwegert almost 10 years@Mtok ...with the appropriate method? ;-)
-
Mtok almost 10 yearsok I made it thanks. I'm not sure if what I made is appropriate because you always discredit what I did, rightfully :) Thanks.
-
vwegert almost 10 years@Mtok You show no signs of having researched anything, you don't tell the world what you'Ve already tried - so please tell me why I should bother spending time to investigate YOUR problem in depth?
-
Mtok almost 10 yearsHi @vwegert! I think you misunderstood me or I mistold myself because of my English which is not that good sometimes. I'm telling you that you accustomed me to think whether the methods I use are obsolete or right method and up to date. I think 'discredit' word in my last comment was wrong. It should be 'criticise'. Anyways, thanks again.