Program to send email concerning table in SE16
Hi Everyone,
I think I have a pretty simple question to ask. I'm looking to do a Number of Entries against a table in SE16, and I basically want to be able to send that number in an email to myself.
Does anyone know if there's a program that already exists to do this, or if there's any other way???
<removed_by_moderator>
Thanks,
John
Edited by: Julius Bussche on Sep 8, 2008 1:31 PM
Hi,
Write a small program..
data : v_tfill type sy-tfill.
SELECT COUNT(*) FROM <dbtable> into v_tfill.
v_tfill will give you number of lines...
for sending mail please refer the below link..
http://www.sapdev.co.uk/reporting/email/email_mbody.htm
Regards,
nagaraj
Similar Messages
-
ABAP program for sending emails
Hello SAP developers,
I need ABAP program for sending emails to my internet adress in background - just some simple header with no body and no attachement. Recipient should be specified due the parameter etc... Does program like this exist or i have to create it? I am not familiar with ABAP. I am basis admin so I am little bit lost in this. I have tried program code from this page ->
http://www.sapdevelopment.co.uk/reporting/email/email_mbody.htm
But anyway it does not work - there is an exception "no message send". SCOT is configured, mails are working fine from transaction SBWP.
Thanks in advace
JMI have already solved my issue through CCMS agents and RZ20 central autoreaction (sms) in Solution Manager.
Regards
JM -
Program To Send Email with attachemnts in PDF / Excel with Subject
Hi All,
I have been given an Object to Develop a report to Send Email with attachemnts in PDF / Excel with Subject.
Please provide the way to go about.
Regards,
MohsinREPORT 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 = 'type your email address here'. "-->
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.
Hope it helps,
regards,
kushagra -
Java program to send email from lotus notes
Hello,
Please anyone suggest me how to send email from lotus notes using java.
Thanks.I don't understand the question. Are you asking:
1. How do I send e-mail from Lotus notes manually? Press the Send button.
2. How do I send e-mail from Java? Look into the Java Mail API. Doesn't require Lotus Notes (or any other e-mail client, for that matter).
3. How do I send e-mail to a Lotus Notes address? Just send e-mail to the address (see # 2 above). Nothing special required just because the recipient uses Lotus Notes. FYI: I use Lotus Notes (though I hate it) because it's our company's standard & have written Java apps that send e-mails to Notes. The only time I've had to be aware the recipient was a Notes client was when I was sending HTML formatted messages; then I had to pay attention to the limitations of Notes' brain dead HTML parser. -
Following program to send email to gmail accounts not working..help me.
after deployment the following program leads to this error
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. 39sm1006913yxd.27
<%@ page import="javax.mail.internet.*" %>
<%@ page import="javax.mail.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<html>
<body>
<%
String name=request.getParameter("name");
String from=request.getParameter("mail");
String message1=request.getParameter("msg");
try{
String toAddress="[email protected]";
String fromAddress=from;
String fromName=name;
String messageSubject="feedback";
String messageBody1=message1;
Properties props=new Properties();
props.put("mail.smtp.host","smtp.gmail.com");
Session session1=Session.getDefaultInstance(props,null);
Message message=new MimeMessage(session1);
message.setFrom(new InternetAddress( fromAddress, fromName));
message.setRecipient(Message.RecipientType.TO,new InternetAddress( toAddress));
message.setSubject( messageSubject);
message.setText( messageBody1);
message.setSentDate(new Date());
Transport.send(message);
catch(Exception e)
{out.println(e);
%>
</body>
</html>When I run the code
<html>
<%@ page import="javax.mail.internet.*" %>
<%@ page import="javax.mail.*" %>
<%@ page import="javax.mail.Transport.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="com.sun.mail.smtp.*" %>
<body>
<%
try{
String to="[email protected]";
String from="[email protected]";
String subject="feedback";
String message="Hello";
Properties props = new Properties();
props.put("mail.smtp.host","smtp.gmail.com");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
Session session1 = Session.getDefaultInstance(props);
session1.setDebug(false);
// create a message
MimeMessage msg = new MimeMessage(session1);
if ( from == null ) from = "[email protected]";
InternetAddress fromAddress = new InternetAddress(from);
msg.setFrom(fromAddress);
InternetAddress[] toAddresses = InternetAddress.parse(to);
msg.setRecipients(Message.RecipientType.TO, toAddresses);
msg.setSubject(subject);
msg.setHeader("X-Mailer", "smtpsend");
msg.setSentDate(new java.util.Date());
msg.setText(message);
SMTPTransport t = (SMTPTransport)session1.getTransport("smtps");
try {
t.connect("smtp.gmail.com", "[email protected]", "password");
t.sendMessage(msg, msg.getAllRecipients());
finally {
out.println("Response: " + t.getLastServerResponse());
t.close();
catch(Exception e)
{out.println(e);
%>
</body>
</html>I got the following exception
Response: javax.mail.MessagingException: Exception reading response; nested exception is: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -
Outlook 2010 address book prompt out hen trusted program try to send email through Outlook 2010
Dear all,
My program will send email through Outlook 2010(in cache mode). Sometime it may prompt the address book out and pend here, and we need to manually click "OK" to let the program run again. Although we re-write the program in
Java and send by JavaMail now, but we are interested why the address book will prompt out.
There are no pattern that we can guess the reason. Different recipient, different subject/content/have attachment or not can casue the address book prompt. But same email with same content/everythings may not cause prompt before and/or after.
We try to change to offline address book and need manual sync, problem still occur.
Just for interest~
Cyrus
[Sorry that MSDN not allow me to upload the cap screen :( ]Firstly, there is no such thing as a "trusted program" to Outlook. It only trusts COM addins, all other applications will cause a security prompt unless you have an up-to-date anti-virus app installed (if you can control the client environment).
See http://www.outlookcode.com/article.aspx?id=52 for the list of your options. Essentially it is either installing an antivirus product or using a library such as
Redemption (accessible from Java) or a utility such as
ExpressClickYes.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/redemption
Redemption - what the Outlook
Object Model should have been
Version 5.5 is now available! -
Send email (to MS Outlook) after substitution in UWL
Hi
We are using UWL on Portal for our workflows. We are using EP 7.0 (2004s) and ECC 6.0.
Our requirement is:
We should be sending an email to MS Outlook of the new user (substitute/delegate) when a substitution rule is created.
Can anyone help us with this requirement?
Regards,
AdityaHi,
Once the substitution done you will get the entry in the Table HRUS_D2. I think in the UWL you can configure to send email once you got entry in the table (not sure), check with EP Consultant.
If That is not working write a custom program, to send email to the substituted person based on the "From Date" entry in the HRUS_D2. Then schedule that program in background, once in a day if there is entry for today that program has to pick the user id and get the email id and send to the respective person via your custom mail sending program.
Regard,
Surjith -
Error when sending email from a web application that runs on GlassFish
Hello all, I hope some can give me some hints on how to fix this problem.
I have a web application built in Java that runs on GlassFish v3.
The application uses a mail plugin that makes use of mail.jar
Whenever I try to use the plugin to send an email out I get an error.
The application is programmed to send emails from a gmail account, and I believe there is a problem with the SSL version that Googlemail is expecting.
By the way, everything works fine if I run the web app on other servers like Jetty or Apache.
The stacktrace I get from the log when the error occurs is as follows:
INFO: 2009-05-08 19:48:57,500 [httpWorkerThread-8080-0] ERROR errors.GrailsExceptionResolver - org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
nested exception is:
java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
org.codehaus.groovy.runtime.InvokerInvocationException: org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
nested exception is:
java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:431)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:337)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:218)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:218)
at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:883)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:732)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:554)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:485)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:377)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:218)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:218)
at org.jsecurity.web.servlet.JSecurityFilter.doFilterInternal(JSecurityFilter.java:382)
at org.jsecurity.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:180)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:218)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:218)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:218)
at org.apache.catalina.core.StandardWrapperValve.preInvoke(StandardWrapperValve.java:460)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:139)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:186)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:96)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:187)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:651)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1030)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:142)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:651)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1030)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:242)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:180)
at com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:633)
at com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:570)
at com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:827)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:152)
at com.sun.enterprise.v3.services.impl.GlassfishProtocolChain.executeProtocolFilter(GlassfishProtocolChain.java:71)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56)
at com.sun.grizzly.util.WorkerThreadImpl.processTask(WorkerThreadImpl.java:325)
at com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:184)
Any help would be really appreciated... honestly I'm pretty stuck.
AlexHi Alex,
Since I had a Gmail test servlet kicking around, I ran it on the latest V3 nightly build.
On the first run, I encountered the following nested exceptions:
javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465
--> java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
--> java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
--> java.security.UnrecoverableKeyException: Password must not be nullThe UnrecoverableKeyException is a manifestation of [https://glassfish.dev.java.net/issues/show_bug.cgi?id=6938|https://glassfish.dev.java.net/issues/show_bug.cgi?id=6938]
I worked around this by adding the following JVM config options to domain.xml
<jvm-options>-Djavax.net.ssl.keyStorePassword=changeit</jvm-options>
<jvm-options>-Djavax.net.ssl.trustStorePassword=changeit</jvm-options> (Note: the default master password is "changeit")
These lines are placed in /domain/configs/config/java-config of domain.xml for the particular server config you're using. There's only one server config in the default domain.xml shipped with V3. Then restart the server.
I retested the code on both port 465 and 587, with and without the above config changes. Without the change, they both fail the same way, and with the change, they both work. Let me know if this helps.
-Peter -
Problem in sending email ??
Hi Guys
we are facing a strange problem. We have a lot os programs which sends emails from SAP. Since this week the system is not sending any emails. Once the program is executed the program generates the emails which we can see in the SOST transaction. It is NOT in ERROR but still it is not sent to the inbox( internet).
All the messages are staying in the queue with the message 711. When i check the long text of this message it says
<i>Message transferred by node to communication system
Message no. XS711
Diagnosis
The node has passed the message to its communication system.
System Response
Processing was ended normally.
Additional information on the node used (in the system language of the node):
Procedure
No action is necessary. The message will shortly reach the recipient.
</i>
But we have waited for one complete day and the emails are still in the queue. Any idea what is missing. I also tried to select the unsent emails and Force send it but it still did not work. I then executed the RSCONNECT program to send all the emails still it did not work.
Any idea????????
~SureshHi Suresh,
As you are saying that the mail functionality was working fine last week and not working during this week that means there must be something changed. May be you have not applied support pack but basis may have changed system parameters, or check with the batch jobs if they are working fine.
Regards,
Atish -
SCOT - Send email in ECC 6.0
Hi,
We were using a program to send emails to external vendors in 4.6C. This is done using the function module SO_NEW_DOCUMENT_SEND_API1. We changed the SCOT config in ECC 6.0 to use mailhost/port instead of RFC fn.module.
Now we are not able to send email using the program.
Please let me know how to solve this issue.
Thanks
KumarFunction module SO_NEW_DOCUMENT_ATT_SEND_API1 has a parameter CONTENTS_BIN = OBJBIN which was assigned data type as SOLIX. This was not compatible with the data type SOLISTI1 used for Function Module SO_CONVERT_CONTENTS_BIN that is called inside this FM. So the data type was changed from SOLIX to SOLISTI1.
We had the same problem and this was the possible remediation we have done.
Please check if this can help you. -
A utility program to send the content of a spool OR an internal table in
Hello Guys,help me.
A utility program to send the content of a spool / an internal table in various formats like HTML, PDF, TXT etc.
can u explain wht is this completely
Thank you
Santhosh.Please check below links for better understanding of sending data from SAP to various formats...
internal table to an XML file
http://www.erpgenie.com/abap/code/abap27.htm
Report Output to a PDF File
http://www.erpgenie.com/abap/code/abap51.htm
HTML EMail from ABAP
http://www.erpgenie.com/abap/code/abap20.htm
Spool from SAP to Acrobat format
http://www.erpgenie.com/abap/pdf_creation.htm -
Generic program to SEND an email
Hello
Can you help with an ABAP program to sends an email AFTER the Process chain completes. I would like to informational email from process chain as soon as it completes.
Can you post an generic ABAP program that sends an email and please let me know the parameters that needs to be maintained..
Also, suggest me, if there is a GOOD another way to accomplish this task.
Thanks a lot for your help..Hi,
Genarally, you can create a message, by right click and create message then give email ids in Maintain Recipent list (Recipt type = via internet) and then give message that you want to send in Edit Document.
Check whether the email address is maintained in SU01 in address tab.
Configure SMTP server is set up properly ( SCOT). Ask basis team to do it.
There is also other option to send the mail through program, for this you need to trigger any event or you can insert this program at teh end of the process chain.
*& Report ZTEST_FM_MAIL
REPORT ztest_fm_mail.
DATA : is_doc_chng TYPE sodocchgi1,
it_objtxt TYPE STANDARD TABLE OF solisti1,
is_objtxt TYPE solisti1,
it_objpack TYPE STANDARD TABLE OF sopcklsti1,
is_objpack TYPE sopcklsti1,
it_objbin TYPE STANDARD TABLE OF solisti1,
is_objbin TYPE solisti1,
it_reclist TYPE STANDARD TABLE OF somlreci1,
is_reclist TYPE somlreci1,
w_lines_tx TYPE i.
Create Message Body
Title and Description
*is_doc_chng-obj_name = 'MAIL'.
is_doc_chng-obj_descr = 'Auto genareted Mail'.
main text
is_objtxt-line = 'This is an automatically generated mail. Please do not reply to it.'(028).
APPEND is_objtxt TO it_objtxt.
is_objtxt-line = space.
APPEND is_objtxt TO it_objtxt.
write packing list (main)
DESCRIBE TABLE it_objtxt LINES w_lines_tx.
READ TABLE it_objtxt INTO is_objtxt INDEX w_lines_tx.
is_doc_chng-doc_size = ( w_lines_tx - 1 ) * 255 + STRLEN( is_objtxt ).
CLEAR is_objpack-transf_bin.
is_objpack-head_start = 1.
is_objpack-head_num = 0.
is_objpack-body_start = 1.
is_objpack-body_num = w_lines_tx.
is_objpack-doc_type = 'RAW'.
APPEND is_objpack TO it_objpack.
is_reclist-receiver = 'your email id'.
is_reclist-rec_type = 'U'.
APPEND is_reclist TO it_reclist.
CLEAR is_reclist.
*This is for SAP system mail box
*is_reclist-receiver = 'your system login ID'.
*is_reclist-rec_type = 'B'.
*APPEND is_reclist TO it_reclist.
*CLEAR is_reclist.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = is_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_objpack
contents_txt = it_objtxt
receivers = it_reclist
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.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Thanks
Reddy -
I installed iOS8 on my iPad. Now iCloud does not send emails to my apple mail program on my MacBook Pro.
Hello agniman,
After reviewing your post, I have located an article that can help in this situation. It contains a number of troubleshooting steps and helpful advice concerning iCloud mail issues:
iCloud: Troubleshooting iCloud Mail
Thank you for contributing to Apple Support Communities.
Cheers,
BobbyD -
Sending emails from ABAP program
Hi,
I need to send error emails from ABAP program.
I have to pass error internal table as text (not as attachment) in the email.
Can anybody supply any sample code?
Thanks in advance.
Regards,
Arun MohanHI,
See if this code helps:
***Sending mail to the receipients
if not it_final[] is initial.
Populate table with detaisl to be entered into .xls file
PERFORM BUILD_XLS_DATA_TABLE.
PERFORM POPULATE_EMAIL_MESSAGE_BODY.
Send file by email as .xls speadsheet
PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
TABLES IT_MESSAGE
IT_ATTACH
USING P_EMAIL
'Sales Register Report - Set Top Box / Accessories'
'XLS'
'SSTB'
CHANGING GD_ERROR
GD_RECIEVER.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
endif.
*& Form BUILD_XLS_DATA_TABLE
text
--> p1 text
<-- p2 text
FORM BUILD_XLS_DATA_TABLE .
data: wa_itab like it_final.
CONSTANTS:
CON_TAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
CON_CRET TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.
CONCATENATE 'Business Place' 'Region Code' 'Region' 'Branch Code'
'Branch' 'Material Desc' 'Area off Code'
'Area Name' 'Zone code' 'Zone Name' 'Cust No' 'Cust Name'
'Bill Doc No' 'Bill Date' 'Base Val' 'Total Val' 'Quantity'
INTO IT_ATTACH SEPARATED BY CON_TAB.
CONCATENATE CON_CRET IT_ATTACH INTO IT_ATTACH.
APPEND IT_ATTACH.
LOOP AT IT_FINAL INTO WA_ITAB.
CONCATENATE WA_ITAB-BUSINESS_PLACE
WA_ITAB-KVGR1
WA_ITAB-REGION
WA_ITAB-VKBUR
WA_ITAB-SALES_OFF
WA_ITAB-ARKTX
WA_ITAB-vkgrp
WA_ITAB-sales_grp
WA_ITAB-bzirk
WA_ITAB-zone
WA_ITAB-kunnr
WA_ITAB-name
WA_ITAB-vbeln
WA_ITAB-fkdat
WA_ITAB-base_value
WA_ITAB-total_value
WA_ITAB-fkimg
INTO IT_ATTACH SEPARATED BY CON_TAB.
CONCATENATE CON_CRET IT_ATTACH INTO IT_ATTACH.
APPEND IT_ATTACH.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form POPULATE_EMAIL_MESSAGE_BODY
text
--> p1 text
<-- p2 text
FORM POPULATE_EMAIL_MESSAGE_BODY .
REFRESH IT_MESSAGE.
CONCATENATE SY-DATUM6(2) '/' SY-DATUM4(2) '/' SY-DATUM+0(4) INTO G_DATE.
IT_MESSAGE = 'Please find attached excel sheet.'.
APPEND IT_MESSAGE.
IT_MESSAGE = 'Sales Register Report - Set Top Box / Accessories'.
APPEND IT_MESSAGE.
Concatenate 'Report generated date' ':' G_Date '.' into IT_MESSAGE.
APPEND IT_MESSAGE.
clear it_message.
append it_message.
IT_MESSAGE = 'This is an autogenerated mail, please do not reply'.
APPEND IT_MESSAGE.
ENDFORM. " POPULATE_EMAIL_MESSAGE_BODY
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES PIT_MESSAGE
PIT_ATTACH
USING P_EMAIL
P_MTITLE
P_FORMAT
P_FILENAME
P_ATTDESCRIPTION
P_SENDER_ADDRESS
P_SENDER_ADDRES_TYPE
CHANGING P_ERROR
P_RECIEVER.
DATA: LD_ERROR TYPE SY-SUBRC,
LD_RECIEVER TYPE SY-SUBRC,
LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
LD_EMAIL LIKE SOMLRECI1-RECEIVER,
LD_FORMAT TYPE SO_OBJ_TP ,
LD_ATTDESCRIPTION TYPE SO_OBJ_NAM ,
LD_ATTFILENAME TYPE SO_OBJ_DES ,
LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,
LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,
LD_RECEIVER LIKE SY-SUBRC.
LD_EMAIL = P_EMAIL.
LD_MTITLE = P_MTITLE.
LD_FORMAT = P_FORMAT.
LD_ATTDESCRIPTION = P_ATTDESCRIPTION.
LD_ATTFILENAME = P_FILENAME.
LD_SENDER_ADDRESS = P_SENDER_ADDRESS.
LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
Fill the document data.
W_DOC_DATA-DOC_SIZE = 1.
Populate the subject/generic message attributes
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
W_DOC_DATA-SENSITIVTY = 'F'.
Fill the document data and get size of attachment
CLEAR W_DOC_DATA.
READ TABLE IT_ATTACH INDEX W_CNT.
W_DOC_DATA-DOC_SIZE =
( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACH ).
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE.
W_DOC_DATA-SENSITIVTY = 'F'.
CLEAR T_ATTACHMENT.
REFRESH T_ATTACHMENT.
T_ATTACHMENT[] = PIT_ATTACH[].
Describe the body of the message
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.
T_PACKING_LIST-OBJ_NAME = 'stb'.
DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = 'RAW'.
APPEND T_PACKING_LIST.
Create attachment notification
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 = LD_FORMAT.
T_PACKING_LIST-DOC_TYPE = 'XLS'.
T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.
T_PACKING_LIST-OBJ_DESCR = 'Sales_STB'.
T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
T_PACKING_LIST-OBJ_NAME = 'stb'.
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 IT_RECV.
T_RECEIVERS-RECEIVER = IT_RECV-EMAIL.
T_RECEIVERS-REC_TYPE = 'U'.
T_RECEIVERS-COM_TYPE = 'INT'.
T_RECEIVERS-COPY = 'X'.
T_RECEIVERS-NOTIF_DEL = 'X'.
T_RECEIVERS-NOTIF_NDEL = 'X'.
APPEND T_RECEIVERS.
ENDLOOP.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_DATA
PUT_IN_OUTBOX = 'X'
SENDER_ADDRESS = LD_SENDER_ADDRESS
SENDER_ADDRESS_TYPE = LD_SENDER_ADDRESS_TYPE
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL = W_SENT_ALL
TABLES
PACKING_LIST = T_PACKING_LIST
CONTENTS_BIN = T_ATTACHMENT
CONTENTS_TXT = IT_MESSAGE
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.
Populate zerror return code
LD_ERROR = SY-SUBRC.
Populate zreceiver return code
LOOP AT T_RECEIVERS.
LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
ENDLOOP.
ENDFORM. "SEND_FILE_AS_EMAIL_ATTACHMENT
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
text
--> p1 text
<-- p2 text
FORM INITIATE_MAIL_EXECUTE_PROGRAM .
WAIT UP TO 2 SECONDS.
SUBMIT RSCONN01 WITH MODE = 'INT'
WITH OUTPUT = ''
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
Regards
Subramanian -
Sending email after deleting the records in a table
Hi
I am deleting the records in a table. After deleting the records,
i want to send an email to another person. I am planning to follow this steps.
1. Create a trigger on the table(AFTER DELETE ON table FOR EACH ROW)
to copy the deleted records to temporary table.
2. Read the temporary table and send an email.
Is there any other way we can do with out creating temporary table ?.
GovindI don't know what you plan to use to send the mail but here's a solution that would work.
-- Create a send mail procedure
create or replace procedure send_mail (
sender IN VARCHAR2,
recipient IN VARCHAR2,
message IN VARCHAR2)
IS
mailhost VARCHAR2(30) := 'localhost';
mail_conn utl_smtp.connection;
BEGIN
mail_conn := utl_smtp.open_connection(mailhost, 25);
utl_smtp.helo(mail_conn, mailhost);
utl_smtp.mail(mail_conn, sender);
utl_smtp.rcpt(mail_conn, recipient);
utl_smtp.data(mail_conn, message);
utl_smtp.quit(mail_conn);
END;
/-- Create the trigger to email deleted rows
create or replace trigger email_del_rows
after delete on <table>
for each row
declare
msg varchar2(2000);
begin
msg := 'COL1 COL2 COMPANY NAME DATE'||chr(10);
msg := msg||:old.col1||' '||:old.col2||' '||:old.company_name||' '||:old_date|| chr(10);
msg := msg||'END OF FILE';
send_mail('SENDER','[email protected]',msg);
end;
/You can make it look pretty but you get the basic idea.
Maybe you are looking for
-
Is using the MBOX as an audio interface for garage band possible?
I have an MBOX that I used with protools on my PC and it may be awhile before I finally get protools on my mac. Is it possible to use the MBOX with garageband?? and if so...are there any specs I should know about before using it? Message was edited b
-
IDOC not to be converted to XML-IDOC
Hi there is a setting you can make in XI so that IDOCS sent to XI from R/3 are not converted to XML-IDOC. That parameter is XML_CONVERSION. I found out from SAP today that this will only work if you are sending from R/3 to R/3 via XI. But I want thi
-
Oracle application Navigator menu Sample
Hi guys We are moving from client/server to Weblogic+Forms, Reports 11g. We are already using Oracle EBS R12 and our users are familiar with the Navigator menu and we would like provide the same style menu with our legacy applications, deployed throu
-
we have used the 2LIS_02_ITM datasource in Production for sometime. Now I have added a new field to the 2LIS_02_ITM. How can I transport this 2LIS_02_ITM into Procdution? What should I do before/after? Please help, thanks.
-
I have currently purchased Adobe Creative Suite 3 Web Standard and I am having problems understanding the PROPER way to design a website. For example: Can I design the website in Illustrator? Then where do I take the page in order to create buttons a