Sending external email from SAP with following requirements...
Hi All,
I need to send external emails from SAP by meeting following requirements.
1) With subject line more than 100 characters.
2) No attachments, only body which has specific format (blueprint/layout) and would be amended often, hence code shouldn't be touched during amendments.
3) Should be able to know the success/failure of mail sending at program level.
Hi,
The code below demonstrates how to send an email to an external email address
*& Report ZSENDEMAIL *
*& Example of sending external email via SAPCONNECT *
REPORT zsendemail .
PARAMETERS: psubject(40) type c default 'Hello',
p_email(40) type c default '[email protected]' .
data: it_packing_list like sopcklsti1 occurs 0 with header line,
it_contents like solisti1 occurs 0 with header line,
it_receivers like somlreci1 occurs 0 with header line,
it_attachment like solisti1 occurs 0 with header line,
gd_cnt type i,
gd_sent_all(1) type c,
gd_doc_data like sodocchgi1,
gd_error type sy-subrc.
data: it_message type standard table of SOLISTI1 initial size 0
with header line.
*START-OF-SELECTION.
START-OF-SELECTION.
Perform populate_message_table.
*Send email message, although is not sent from SAP until mail send
*program has been executed(rsconn01)
PERFORM send_email_message.
*Instructs mail send program for SAPCONNECT to send email(rsconn01)
perform initiate_mail_execute_program.
*& Form POPULATE_MESSAGE_TABLE
Adds text to email text table
form populate_message_table.
Append 'Email line 1' to it_message.
Append 'Email line 2' to it_message.
Append 'Email line 3' to it_message.
Append 'Email line 4' to it_message.
endform. " POPULATE_MESSAGE_TABLE
*& Form SEND_EMAIL_MESSAGE
Send email message
form send_email_message.
Fill the document data.
gd_doc_data-doc_size = 1.
Populate the subject/generic message attributes
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SAPRPT'.
gd_doc_data-obj_descr = psubject.
gd_doc_data-sensitivty = 'F'.
Describe the body of the message
clear it_packing_list.
refresh it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
describe table it_message lines it_packing_list-body_num.
it_packing_list-doc_type = 'RAW'.
append it_packing_list.
Add the recipients email address
clear it_receivers.
refresh it_receivers.
it_receivers-receiver = p_email.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = 'X'.
it_receivers-notif_ndel = 'X'.
append it_receivers.
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'
importing
sent_to_all = gd_sent_all
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.
Store function module return code
gd_error = sy-subrc.
Get it_receivers return code
loop at it_receivers.
endloop.
endform. " SEND_EMAIL_MESSAGE
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
form initiate_mail_execute_program.
wait up to 2 seconds.
if gd_error eq 0.
submit rsconn01 with mode = 'INT'
with output = 'X'
and return.
endif.
endform. " INITIATE_MAIL_EXECUTE_PROGRAM
Hope this helps.
Reward if helpful.
Regards,
Sipra
Similar Messages
-
Cannot send external emails from SAP
Hi,
I am trying to set up emails to external systems, but for some reason it is not working. I have checked the port number for the SMTP server with the administrator and it is the default one, the SMTP server name, and also in SCOT the INT portion has a * in it.
I am able to send emails to internal domain (our work email domain) but when sending it to external domains, it keeps coming back with the error message " recipient unknown".
I have some doubts but am not sure if these should / could be the problem.
1. Is there a job that need to run periodically for sending emails.
2. Should there be a * in SCOT in the INT part ? or should it be @.com or something else.
3. Is there anything else that I am missing?
Platform : ECC 6.0
Thanks,
KunalHi Adam,
Thanks for your reply. Here is what I have set up for the instructions you provided me.
1. I<b>n SCOT, menu 'Settings' --> 'Default Domain'</b> I have my work domain set up.
Assume that I work for ebay.It is set up as ebay.com. I am able to send emails to [email protected] want to be able to send emails to other domains.
Question : Should I be setting up the name of the domain that I want to send emails to ? I dont think that this is feasible. But still I might be wrong.
2. <b>Your SMTP server should have added this SAP server into its auth list.</b>
Yes. I have checked on this with my SMTP administrator. The ip of that SAP server is in the authorization list.
3.<b>A periodic job ( 2 minutes? 5 minutes? etc) should be defined for sending Emails automatically</b>
I have the following jobs running when I go to jobs in SCOT
MAILSERVERSEND INT 5min 14:46:52
SAPCONNECT INT SEND 1 INT 10min 14:55:00
Is there any other job that needs to be running for this?
4.<b>A '*' should be defined in 'SCOT' -->'INT' --> 'Internet' --> 'Address areas'</b>
Yes, There is.
Thanks,
Kunal -
To send external email from ABAP
How to send external email from ABAP Program and what are the settings to be done for the same ?
Please check..
Sending External email through SAP
What is the FM for sending the external email through SAP by attaching layout set to it?
These are the FM for sending external email :-
SO_DOCUMENT_SEND_API1
SAPoffice: Send new document with attachments via RFC
SO_NEW_DOCUMENT_ATT_SEND_API1
(In 4.6C only, You can go to SE37 and click the documentation on how to use it. A sample program is provided there.)
SAPoffice: Send new document with attachments via RFC
Note : If you are using FM SO_NEW_DOCUMENT_ATT_SEND_API1 then Export Parameter DOCUMENT_DATA-OBJ_DESCR contains the Subject.
SO_NEW_DOCUMENT_SEND_API1
SAPoffice: Send new document
How to send a report to an external mail-id?
Try this sample code :-
REPORT ZREPORT_TO_EMAIL NO STANDARD PAGE HEADING LINE-SIZE 200.
DATA : BEGIN OF ITAB OCCURS 0,
PERNR LIKE PA0001-PERNR,
ENAME LIKE PA0001-ENAME,
END OF ITAB.
DATA: message_content LIKE soli OCCURS 10 WITH HEADER LINE,
receiver_list LIKE soos1 OCCURS 5 WITH HEADER LINE,
packing_list LIKE soxpl OCCURS 2 WITH HEADER LINE,
listobject LIKE abaplist OCCURS 10,
compressed_attachment LIKE soli OCCURS 100 WITH HEADER LINE,
w_object_hd_change LIKE sood1,
compressed_size LIKE sy-index.
START-OF-SELECTION.
SELECT PERNR ENAME
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM PA0001
WHERE PERNR < 50.
LOOP AT ITAB.
WRITE :/02 SY-VLINE , ITAB-PERNR, 15 SY-VLINE , ITAB-ENAME, 50
SY-VLINE.
ENDLOOP.
Receivers
receiver_list-recextnam = '[email protected]'. "-->
EMAIL ADDRESS
RECEIVER_list-RECESC = 'E'. "<-
RECEIVER_list-SNDART = 'INT'."<-
RECEIVER_list-SNDPRI = '1'."<-
APPEND receiver_list.
General data
w_object_hd_change-objla = sy-langu.
w_object_hd_change-objnam = 'Object name'.
w_object_hd_change-objsns = 'P'.
Mail subject
w_object_hd_change-objdes = 'Message subject'.
Mail body
APPEND 'Message content' TO message_content.
Attachment
CALL FUNCTION 'SAVE_LIST'
EXPORTING
list_index = '0'
TABLES
listobject = listobject.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
compressed_size = compressed_size
TABLES
in = listobject
out = compressed_attachment.
DESCRIBE TABLE compressed_attachment.
CLEAR packing_list.
packing_list-transf_bin = 'X'.
packing_list-head_start = 0.
packing_list-head_num = 0.
packing_list-body_start = 1.
packing_list-body_num = sy-tfill.
packing_list-objtp = 'ALI'.
packing_list-objnam = 'Object name'.
packing_list-objdes = 'Attachment description'.
packing_list-objlen = compressed_size.
APPEND packing_list.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = w_object_hd_change
object_type = 'RAW'
owner = sy-uname
TABLES
objcont = message_content
receivers = receiver_list
packing_list = packing_list
att_cont = compressed_attachment. -
I want to send outbond email from SAP ERP to Gmail useing SBWP transaction , for that i want standered BADI or BAPI or RFC to send an outbond mail.i want to send a email from sbwp t-code in that t-code we have title text box and body text box and receipent and receipent type,after entering alll those values i want trigger my badi /bapi/rfc and also that mail goes to receipent Gmail indox and also sap user outbox in sbwp t-code
Moderator message: Welcome to SCN!
Moderator message: this is considered "spec dumping", please work yourself first on your requirement.
[Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
[Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]
Edited by: Thomas Zloch on Jul 13, 2011 9:25 AMCheck note 455140 - Configuration of e-mail, fax, paging or SMS using SMTP
Markus -
Send email from SAP with more than one attachment
Hi all,
How can i send email with more than one attachment and different types of document(doc,pdf,etc.) from SAP to external?
Besr regards,
MunurHi,
I use :
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
the main problem with different attachemts is to genereate the packing_list.
the packing list is a kind of description of the data table... where ist the start of an image, end, size...
"Creation of the entry for the compressed attachment
objpack-transf_bin = 'X'. " it could be an image
objpack-head_num = lv_head_num_count . " inital 1 each att add 1
objpack-head_start = 1. " fix
objpack-body_start = gv_startnum. " table with attachments 1. line one
objpack-body_num = tab_lines. " how many lines are in the table of attachment
objpack-doc_size = tab_lines * 255. " size of the attachment...
objpack-doc_type = lv_typ . " 'JPG'.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = lv_stripped_name " name of the JPG
APPEND objpack.
APPEND LINES OF lt_goscontent TO gt_maildata. " data Table...
bestreg
robert -
Securing your Email from SAP with security signatures from exchange server
Hello
I have been exploring a solution for the following requirement:
Important Emails such as HR payslips which are being generated from SAP need to be encrypted using security signatures stored at an exchange server.
I have looked at Secure email proxy but I believe that is a more standard functionality, the payslips are being generated, being converted into pdfs and are being sent as an attachment in emails,all custom coding.
Is there a way to utilize the secure email proxy feature using custom code?
Are there other ways to use the existing signatures at the exchange server. Help.sap.com also mentions a badi - SX_secure_email - would this suffice for my needs?
Thank youGenerating the request with a particular user who has the parameter set to on gets the trick done.
-
Sending external email from forms
Hello.
I want to send an email using a form and a report. The report is the attachment of the email. I run the report from form using this command
v_rep := RUN_REPORT_OBJECT(repid);
If i send the mail to an internal address, works properly. If i want to send the email to an external address i have this error:
FRM-41214
Error when running report ORA - 0000: normal, successful completion
I made a check with telnet on my computer and i managed to send an mail to an external address.
Anyone has any idea?
Thanks.I looked at the logs on the SMTP server, the extern mail doesn't even reach the SMTP server queue.
I enabled the trace for the report server and I get this error:
[2008/6/6 0:52:18:703] Exception 50152 (): Error while sending mail - Sending failed;
nested exception is:
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
javax.mail.SendFailedException: 550 5.7.1 Unable to relay for [email protected]
oracle.reports.RWException: IDL:oracle/reports/RWException:1.0
at oracle.reports.utility.Utility.newRWException(Utility.java:756)
at oracle.reports.server.MailService.send(MailService.java:492)
at oracle.reports.server.DesMail.sendFile(DesMail.java:186)
at oracle.reports.server.Destination.send(Destination.java:489)
at oracle.reports.server.JobObject.distribute(JobObject.java:1582)
at oracle.reports.server.JobManager.updateJobStatus(JobManager.java:2231)
at oracle.reports.server.EngineCommImpl.updateEngineJobStatus(EngineCommImpl.java:134)
at oracle.reports.server._EngineCommImplBase._invoke(_EngineCommImplBase.java:94)
at com.sun.corba.se.internal.corba.ServerDelegate.dispatch(ServerDelegate.java:353)
at com.sun.corba.se.internal.iiop.ORB.process(ORB.java:280)
at com.sun.corba.se.internal.iiop.RequestProcessor.process(RequestProcessor.java:81)
at com.sun.corba.se.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.java:106)
Thanks -
Sending the Email from SAP B One through SDK
hello guys,
i have an issue that,
i have desinged the RFQ Screen through SDK, when i entered the data into the controls,when the user clicks on the Email button,
the system has to send the email to the Specified person in the screen.
so please me regarding this issue.
thanks in advance.
thanks & regards
shiva shanker.
[email protected]Couldnt you use the DI API Message service ?
-
Auto Send an Email from SAP BPC 10.0
Hi Experts,
My requirement is : There is an EPM report for which i have to take a snapshot and save those snaps of all sheets in a PPT file.
I am able to create a file with the help of Macro(VB) and got it saved on desktop.
But I want that to save on Server and would like to have a feature of mailing file from that server to an email id.
Is this scenario achievable in BPC.
I have tried creating process chain for Email but didn't get any breakthrough.Is it possible from Web Admin( BPF ) ? Which I don't think so.Sumit,
Would a pdf file be sufficient? If yes, the distribution feature can e-mail pdf files. The distribution function can also be scheduled.
Akos -
Sending an email from notes with especific email account
Hi! I have three different email accounts, and I want to send from the " notes" an email but from a specific account !
How can I choose the email account? TksOnce the email opens, tap From: and selet the account you want.
-
Hi all,
I have one ALV-report which has 64 columns.
Now i want to send this report to external mail.
I have already created a program for this but the problem is that my report contains 64 columns but only 30 columns is sending to external mail remaining data is not generating in excel sheet.first check o/p in spool t.code sp02
o/p is having 64 columns or 30. -
Send SMTP-Mail from SAP with URL to the Workplace Inbox
Does anybody knows how I can create an URL adress within an E-Mail (which is generated in a step in workflow) to provide the receiver an direct access to his SAP-Inbox.
Logon-data must not be included.
thanks to everybodyHi,
What is the nature of the URL you wish to include in the e-mail ?
Is it fixed or dynamic ?
Cheers
Colin. -
hiii
<b>Is it possible to send mail from SAP to External user??????if possible does BASIS people had to do something???</b>
I want to send the email from sap to external user([email protected]).My mail will consist of some changes made in production order(CO03). for which i had created the BADI. That part is over now i want to send the mail.
<b>I got many sample programs in sdn but when i enter the email address it execute but mail is not sent.....I want to know by just executing Zprogram mail will be sent or there is some role for BASIS also..............</b>
Thanking you.
Regards.There is a transaction called SCOT that needs to be configured
http://www.sap-basis-abap.com/sapbs035.htm
http://www.sap-img.com/basis/basis-faq.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/2b/d925bf4b8a11d1894c0000e8323c4f/frameset.htm -
Cannot Send Email from SAP Business One
Hi Experts
I have configured SAP Email Services from the Mailer Service and Customer can send emails all the while,
Now I have an Issue for One User,
Iam using the Same Machine, Same Database with Manager Login, I can send Email from SAP with Attachments
But When I use another Super user the system is not delivering the Email and it Goes to the Sent box (but not delivered)
Have anyone encountered the Issue before
Please hep to solve this issue permanently
Thanks and Regards
Vinodh Kumar MohanHi Vinodh Kumar Mohan,
If the email can be found in Sent box, it must be delivered already.
The problem could be on the email recipient side. It may go to the junk mail.
Thanks,
Gordon -
Hi Experts,
I am facing some issues while sending an email from SAP GUI 720 to the external email destination.
This problem is reported by one of our customers.
Customer is trying to generate a email from SAP. As apart of body of mail he is generating the contents which
contains single/double quotes by typing it from MS word.If that content having quotes is passed as body of mail ,the email
generated from SAP is successful but the content was replaced with "#" instead of single /double quotes.
NOTE:If we use the contents that was typed from vi editor or textpad, and passing it as body of mail. Single quote
and double quotes works fine and can also view the entire body of mail .
I would like to know the following points to analyze this problem:
1. Is it the known issue? Is anyone has faced the same problem?
2.As per my understanding, when we send email for SAP UI ,the request gets queued up and then sent to the SAP gateway.
SAP gateway then sends it to the external email destination.
Is there any way to check the what is the data sent to SAP gateway?
I tried to check the Gateway traces but it does not log any data related to the email body message.
3. Whether the data will get logged in SAP log files?If yes, what is the location?
4. Whether we need to explicitely enable the SAP logs?
Looking for some inputs from experts.
Thanks,
AaratiFound it
I can see I can usr Fm SO_DOCUMENT_SEND_API1 for this
Regards
Morten Nielsen
Maybe you are looking for
-
Data recovery from external Lacie DD after cut-copy with windows 7
Hello, I use a Lacie 1342909234906KLLC3U2 as external back-up. I 've cut-copy'd from this Lacie a map with Picture's to my laptop using windows 7. Now my Laptop has been stolen. Is it possible to recover this data? I didn't use the Lacie ever since
-
USB Skype Phone Adapter - How to use it?
Hello everyone, I would like to ask regarding USB Skype Phone Adapter, as I am planning to buy it. But, before I buy it I would like to know if I can still use skype to call locally using the land phone line (since it's by contract, and local calls a
-
Hi All, Am getting an error when running my interface from SPROXY (its an outbound interface). The error says " Runtime (Serialize) 866 (execute) (serialize)". This error is coming after the complete execution of the interface. I am passing the val
-
Check average CPU utilization in AIX 5.3
Hi All, could anyone please share knowledge on the following: How to check average CPU utilization in AIX 5.3.What command is used in AIX to check this output? Would appreciate an early reply! Thanks for your time! Regards,
-
Printing is a bitch ! My eyes mat be 72 years old but I'm not blind but I seem about ready to go that way. I don't know why Firefox 4 beta affects whatever I try to print but it sure does ! every letter is about four spaces from the next letter. You