Sending Email using cl_bcs from a badi implementation
Hi,
I have written my code to send Email, inside AFTER_SAVE method of BADI Implementation of DOCUMENT_MAIN01.
Now this method of cl_bcs requires COMMIT WORK for the mail to be sent. And inside BADI implementation, we cannot write a COMMIT statement.
What is a workaround for this? While going through few other posts, I came across remote enabled FMs.
Is that the only way? Can I use some additions like STARTING NEW TASK etc. Following is the call used in case of cl_bcs:
CALL METHOD G_REF_SEND_REQUEST->SEND(
EXPORTING
I_WITH_ERROR_SCREEN = 'X'
RECEIVING
RESULT = G_SENT_TO_ALL ).
I also tried using SO_NEW_DOCUMENT_SEND_API1 STARTING NEW TASK and it works fine. But the subject length is a constraint their.
Please suggest.
Thanks in advance.
Hi friend.
*& Report ZTEST_273068_EMAIL_CL_BCS
REPORT ZTEST_273068_EMAIL_CL_BCS.
CONSTANTS:
gc_subject TYPE so_obj_des VALUE 'ABAP Email with CL_BCS',
gc_raw TYPE char03 VALUE 'RAW'.
DATA:
gv_mlrec TYPE so_obj_nam,
gv_sent_to_all TYPE os_boolean,
gv_email TYPE adr6-smtp_addr,
gv_subject TYPE so_obj_des,
gv_text TYPE bcsy_text,
gr_send_request TYPE REF TO cl_bcs,
gr_bcs_exception TYPE REF TO cx_bcs,
gr_recipient TYPE REF TO if_recipient_bcs,
gr_sender TYPE REF TO cl_sapuser_bcs,
gr_document TYPE REF TO cl_document_bcs.
TRY.
"Create send request
gr_send_request = cl_bcs=>create_persistent( ).
"Email FROM...
gr_sender = cl_sapuser_bcs=>create( sy-uname ).
"Add sender to send request
CALL METHOD gr_send_request->set_sender
EXPORTING
i_sender = gr_sender.
"Email TO...
gv_email = '[email protected]'.
gr_recipient = cl_cam_address_bcs=>create_internet_address( gv_email ).
"Add recipient to send request
CALL METHOD gr_send_request->add_recipient
EXPORTING
i_recipient = gr_recipient
i_express = 'X'.
"Email BODY
APPEND 'Hello world! My first ABAP email!' TO gv_text.
gr_document = cl_document_bcs=>create_document(
i_type = gc_raw
i_text = gv_text
i_length = '12'
i_subject = gc_subject ).
"Add document to send request
CALL METHOD gr_send_request->set_document( gr_document ).
"Send email
CALL METHOD gr_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = gv_sent_to_all ).
IF gv_sent_to_all = 'X'.
WRITE 'Email sent!'.
ENDIF.
"Commit to send email
COMMIT WORK.
"Exception handling
CATCH cx_bcs INTO gr_bcs_exception.
WRITE:
'Error!',
'Error type:',
gr_bcs_exception->error_type.
ENDTRY.
Just Execute it.
Regards,
Thrimu
Similar Messages
-
I am unable to send emails using mail from my btinternet and yahoo accounts similar problem to others with mobile me accounts on lion any suggestions?
Do I need to delete all my email accounts and start again?
-
Sending email using Mail from T-Mobile Hot Spot
I cannot send email messages from a Hot Spot using the Mail program. It says it cannot send using the server smtp.mac.com. This is the first problem I've had with this. Today is my first day using a Hot Spot. Has anyone encountered this same issue? Do I have to change some of the settings?
I tried using the Internet based .Mac account and was able to send messages but not directly from Mail program.5. Does T-Mobile provide me with an email account?
T-Mobile does not provide email accounts for its users.
6. Can I access my personal email account through my T-Mobile HotSpot account?
You can access any web-based email account such as Yahoo.com or Hotmail.com. You can also access corporate email accounts if your employer provides you with a virtual private network (VPN) client and a firewall. T-Mobile strongly recommends that its customers take measures to ensure the security of their wireless connections, such as virtual private networks (VPNs), encryption and firewalls. As with any wireless communication, the T-Mobile HotSpot service is not inherently secure and you should ensure you have adequate security safeguards in place. See the Hotspot Security Statement posted on our website for additional information concerning the security of the service and steps you can take to enhance the security of the service.
http://hotspot.t-mobile.com/support_faq.htm#U1 -
Sending email using CL_BCS in the background with subject line 255 chars
Hello Gurus,
Following is the sample code,. When I run in the foreground, I am getting the mail, with proper subject line. However my output medium type is '5-'External Send#. When I am trying to run this in my output program, it is resulting in dump.
When I keep 'COMMIT WORK', I am getting a dump saying tText * Invalid COMMIT WORK in an update function module.*
When I remove this 'COMMIT WORK', I am still getting the error, saying Screen output without connection to user. (The current ABAP program "SAPLSTXC" statements could not be executed.)
Hoping for a quick solution.
Regards,
Shaheen
REPORT Z_CL_BCS_TEST.
* Trying classes
DATA: send_request TYPE REF TO cl_bcs.
DATA: li_main_text TYPE bcsy_text,
lw_main_text LIKE LINE OF li_main_text.
DATA: document TYPE REF TO cl_document_bcs.
DATA: recipient TYPE REF TO if_recipient_bcs.
DATA: sender TYPE REF TO if_sender_bcs.
DATA: l_mtitle LIKE sodocchgi1-obj_descr.
DATA: sent_to_all TYPE os_boolean.
DATA: bcs_exception TYPE REF TO cx_bcs.
DATA: lv_sub TYPE string.
TRY.
* -------- create persistent send request ------------------------
send_request = cl_bcs=>create_persistent( ).
* -------- create and set document---------------
* Email title
l_mtitle = 'attachment'.
lv_sub = 'Email Title : I want to try for a subject which is more than 50 chars. will this work?'.
CALL METHOD send_request->set_message_subject
EXPORTING
ip_subject = lv_sub.
* Fill the body of the mail
REFRESH li_main_text.
lw_main_text = 'This is test email'.
APPEND lw_main_text TO li_main_text.
CLEAR: lw_main_text.
lw_main_text = 'Regards'.
APPEND lw_main_text TO li_main_text.
CLEAR: lw_main_text.
* Create Email Object
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = li_main_text
i_subject = l_mtitle ).
* Add document object to send request
send_request->set_document( document ).
* add recipient (e-mail address)
recipient =
cl_cam_address_bcs=>create_internet_address(
'Shaheen.Taori at solvay.com' ). " changed the email id purposefully
* Add recipient object to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
* ---------- send document ---------------------------------------
* sent_to_all = send_request->SEND_WITHOUT_DIALOG( I_WITH_ERROR_SCREEN = ' ').
CALL METHOD send_request->SEND_WITHOUT_DIALOG.
* EXPORTING
* e_sent_to_all = 'X'.
* IF sent_to_all IS INITIAL.
* MESSAGE 'Erorr while sending email ' TYPE 'E'.
* EXIT.
* ENDIF.
COMMIT WORK.
* exception handling
CATCH cx_bcs INTO bcs_exception.
MESSAGE i865(so) WITH bcs_exception->error_type.
ENDTRY.Try using method SEND instead of SEND_WITHOUT_DIALOG.
Also try calling method SET_SEND_IMMEDIATELY before calling method SEND.
Use below code lines,
send_request->set_send_immediately( i_send_immediately = 'X' ).
sent_to_all = send_request->send( i_with_error_screen = 'X' ). " Instead of CALL METHOD send_request->SEND_WITHOUT_DIALOG. -
Can I send email using Java from my localhost(Tomcat) with Internet connect
Hi friends,
Please tell me can I send email from my localhost (Tomcat) using Java when my computer is connected to Internet?
I don't have any SMTP username or password or the like, as I found in some codes available in net.
Please suggest and any simple code if possible.
Please don't send me the link of JavaMail API to read.
---SujoyThank you for the link. Though I have not tested the provided code, I will test it.
--Sujoy -
Error while sending email using TemplateEmailSender in CSC server
Hi,
We are trying to send email using TemplateEmailSender from CSC server. But it is giving Null Pointer Exception in ProfiledMessageSource like below. The same code is working fine in commerce instance but it is failing in CSC instance. We are using ATG2007.1p3
Any pointers would be helpful.
Below is the error.
Error while sending email
java.lang.NullPointerException
at atg.userprofiling.dms.ProfiledMessageSource.isConfiguredForProfileSubject(ProfiledMessageSource.java:196)
at atg.userprofiling.dms.DPSMessageSource.fireEndSessionMessage(DPSMessageSource.java:864)
at atg.userprofiling.dms.DPSMessageSource.fireEndSessionMessage(DPSMessageSource.java:848)
at atg.userprofiling.SessionEventTrigger.nameContextElementPreUnbound(SessionEventTrigger.java:553)
at atg.nucleus.GenericContext.sendPreUnboundEvent(GenericContext.java:200)
at atg.nucleus.GenericContext.preNotifyRemovedObject(GenericContext.java:528)
at atg.nucleus.GenericContext.removeElement(GenericContext.java:566)
at atg.servlet.SessionNameContext.unbindFromNameContext(SessionNameContext.java:557)
at atg.servlet.SessionNameContext.stopSession(SessionNameContext.java:534)
at atg.servlet.SessionNameContext.decrementWrapperCount(SessionNameContext.java:242)
at atg.servlet.SessionBindingReporter.valueUnbound(SessionBindingReporter.java:206)
at org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1625)
at org.apache.catalina.session.StandardSession.expire(StandardSession.java:749)
at org.apache.catalina.session.StandardSession.expire(StandardSession.java:655)
at org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1100)
at org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:150)
at atg.userprofiling.email.TemplateInvoker$TemplateSession.endSession(TemplateInvoker.java:935)
at atg.userprofiling.email.TemplateEmailSender.createMessage(TemplateEmailSender.java:2387)Thanks for the reply.
My issue is fixed now. It is JBOSS configuration issue. Sessions are not maintained properly that's why we are getting NULL profile in the session. Our application has multiple WARs so we fixed it by setting emptySessionPath to TRUE. If emptySessionPath attribute in server.xml is false, then each WAR will have its own jsessionid cookie.
I did not touch ProfiledMessageSource as its required for session triggering. -
I am unable to send emails using iCloud, but am receiving.
I am unable to send emails using iCloud from both my laptop and my ipad. I am paying for 25Gb of storage and am only using 3Gb at the moment. I get the following message " Your email has been placed in the Outbox as you have exceeded your limit for sending emails". I have not sent any emails today at all!
http://support.apple.com/kb/ht4863
Or contact Apple: https://getsupport.apple.com -
How can I send email using two different email address that both link back to my one exchange account on my Ipad mini?
On my PC I simply have a master return email address and use a POP for the secondary address. Both are through the one exchange account without a problem. I need to be able to do the same on my Ipad.Ah, I should have made that clear. My domain didn't come from google. It was purchased at and is hosted at dreamhost, but I haven't used their email servers in years - I just route everything through gmail. I actually have a bunch of domains (with websites).
Gmail has an option that lets someone with custom domains send (and receive) email through gmail using the custom domain once Google confirms proper ownership of the domain (to prevent spammers and such). Gmail has a setting for "send email as" which allows gmail to be sent using a custom domain as the sender. I'm pretty sure Apple's old mobileme had this feature too, but I didn't use it. -
IPhone cannot send email using Yahoo account. iPhone no envia correo Yahoo.
Hi Everyone,
I just got my iPhone from Movistar Venezuela and I've found I'm unable to send email using my Yahoo account. However, I can receive Yahoo email just fine (paid $20 for Mail Plus subscription), my GMail account can send and receive perfectly, and I can go surfin' Safari with no problems too.
The error message I get is "Cannot send mail: an error occurred while delivering this message". I called Movistar Customer Support and they said everything was fine on their end...
In typical Apple fashion, the error message is so simple I have no idea where the problem is. Does anyone know how can I get more information and how to solve this annoying problem? My Yahoo account is actually my primary account...
Thanks in advance!
Saludos a todos,
Acabo de comprarme un iPhone de Movistar en Venezuela y me encuentro sin poder enviar emails con mi cuenta Yahoo. Sin embargo, si puedo recibir correo Yahoo bien (pague $20 por mi suscripcion a Mail Plus), mi cuenta de GMail si puede enviar y recibir email sin problema y puedo navergar con Safari sin ningun problema.
El mensaje de error que recibo es el siguiente": "No se puede enviar correo: se ha producido un error al enviar el mensaje". Llame a Atencion al Cliente de Movistar y me dijeron que no habia ningun problema con mi linea o con su servicio de datos...
Como tipica cosa Apple, el mensaje de error es tan simple que no tengo NI IDEA de cual es el problema. Alguien mas ha sufrido este problema? Sabe alguien como puedo obtener mas informacion de este error y como solucionarlo? Lamentablemente, mi cuenta Yahoo es mi correo principal...
Gracias de antemano!Creo que resolvi el problema, temporalmente.
1) Borra tu cuenta
2) Vuelvela a crear
3) Ve a Ajustes
4) Ve a Mail Contactos Calendarios
5) Ve a la cuenta problematica
6) Ve a SMTP
7) Anadir nuevo
8)
Nombre servidor: smtp.mail.yahoo.com
Nombre de usuario: no dejar vacio
Contrasena: no dejar vacio
Usar SSL: si
Autenticacion: Contrasena
Puerto del Servidor: 25
Lo consegui de aqui: http://www.emailaddressmanager.com/tips/mail-settings.html
Dime que tal te funciona.
I think I solved the issue, temporarily at least
1) Delete account
2) Create again
3) Go to settings
4) Go to Mail, Contacts, Calendars
5) Open problematic account
6) Go to SMTP
7) Add a new server
8)
Name: smtp.mail.yahoo.com
User name: do not leave blank
Password: do not leave blank
SSL: Yes
Autentication: Password
Port: 25
I got this info from: http://www.emailaddressmanager.com/tips/mail-settings.html
Let me know how this works -
Sending email using IMAP through SMTP Port 587
Hi,
I have been sending Mail Merged email to people in organizations that I am active in, using IMAP embedded in StarOffice 5.2 (on Windows 98 Second Edition). This worked fine until a few weeks ago when I received an error message stating that AOL, as part of their anti-spam efforts, was no longer accepting third-party emails on default port 25. All third-party email must now use port 587. I looked in the IMAP dialog and in the Tools -> Options dialog, but did not see any place to change the SMTP port. The AOL error message information page had instructions for changing the port in other applications (Outlook, Eudora, etc.), but not for StarOffice. So, I have some questions:
1.Is it possible to change the port in StarOffice 5.2?
2.If not, how does StarOffice 8 send Mail Merged email? Does it use IMAP, and if so, can the port be changed?
3.Also, I like the integrated configuration in StarOffice 5.2, where database fields can be directly accessed in the Insert -> Fields -> Other dialog. In looking at the Mail Merge section in "SO8_What's New.pdf", it appears that Mail Merge in StarOffice 8 is restricted to predefined fields. Could I still access fields from my existing databases?
These is a lot of questions, but right now I am blocked from sending Mail Merged emails which is imparing communications with volunteers who are running educational programs. I appreciate any and all help that anyone can provide.Please try this out!!!!!!!!!
You can send emails using Outlook also. You can send email over Microsoft Exchange with this object (or another email server, using IMAP/POP).
Sub SendMailOutlook(aTo, Subject, TextBody, aFrom)
'Create an Outlook object
Dim Outlook 'As New Outlook.Application
Set Outlook = CreateObject("Outlook.Application")
'Create e new message
Dim Message 'As Outlook.MailItem
Set Message = Outlook.CreateItem(olMailItem)
With Message
'You can display the message To debug And see state
'.Display
.Subject = Subject
.Body = TextBody
'Set destination email address
.Recipients.Add (aTo)
'Set sender address If specified.
Const olOriginator = 0
If Len(aFrom) > 0 Then .Recipients.Add(aFrom).Type = olOriginator
'Send the message
.Send
End With
End Sub -
Does any one have a sample code for sending email using IMAP ?
Hi
thank you for reading my post
I have tried to use SMTP and because of some problems i could not use it and i must use Imap (authentication required)
here is my SMTP code , does any one know how i can tune it to use Imap , or has a code snippet to send email using Imap ?
thanks
private static void postMail(String[] recipients, String subject, String message,
String from) throws MessagingException {
boolean debug = false;
class SMTPAuthenticator extends javax.mail.Authenticator
public PasswordAuthentication getPasswordAuthentication()
return new PasswordAuthentication(mail_usrname,mail_password);
//Set the host smtp address
Properties props = new Properties();
FileInputStream fis;
try {
System.out.println("Loading property file");
fis = new FileInputStream(new File("c:/email.properties"));
props.load(fis);
System.out.println("property file done");
} catch (FileNotFoundException e) {
System.out.println("file not found");
e.printStackTrace();
} catch (IOException e) {
System.out.println("can not read properties file");
e.printStackTrace();
/*props.put("mail.smtp.user", mail_usrname);
props.put("mail.smtp.host", smtpHost);
props.put("mail.smtp.port", smtpPort);
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.socketFactory.port", smtpPort);
// create some properties and get the default Session
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getDefaultInstance(props, null);
session.setDebug(debug);
// create a message
Message msg = new MimeMessage(session);
// set the from and to address
InternetAddress addressFrom = new InternetAddress(from);
msg.setFrom(addressFrom);
InternetAddress[] addressTo = new InternetAddress[recipients.length];
for (int i = 0; i < recipients.length; i++) {
addressTo[i] = new InternetAddress(recipients);
msg.setRecipients(Message.RecipientType.TO, addressTo);
// Setting the Subject and Content Type
msg.setSubject(subject);
msg.setContent(message, "text/HTML");
System.out.println(msg.toString());
Transport.send(msg);Please try this out!!!!!!!!!
You can send emails using Outlook also. You can send email over Microsoft Exchange with this object (or another email server, using IMAP/POP).
Sub SendMailOutlook(aTo, Subject, TextBody, aFrom)
'Create an Outlook object
Dim Outlook 'As New Outlook.Application
Set Outlook = CreateObject("Outlook.Application")
'Create e new message
Dim Message 'As Outlook.MailItem
Set Message = Outlook.CreateItem(olMailItem)
With Message
'You can display the message To debug And see state
'.Display
.Subject = Subject
.Body = TextBody
'Set destination email address
.Recipients.Add (aTo)
'Set sender address If specified.
Const olOriginator = 0
If Len(aFrom) > 0 Then .Recipients.Add(aFrom).Type = olOriginator
'Send the message
.Send
End With
End Sub -
Why am I unable to send email when away from my home wifi ? I am able to receive mail OK, and have double- checked the outgoing server which is correct. This problem is consistent with my Macbook Pro, iPhone, and iPad2.
Attempts to send messages results in them sitting in the Outbox and never- ending 'sending message' displayed.
I am able to send using my me.com server.
Home service provider is Cogeco.
Any help would be appreciated.iOS: Unable to send or receive email
http://support.apple.com/kb/TS3899
Can’t Send Emails on iPad – Troubleshooting Steps
http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
iPad Mail
http://www.apple.com/support/ipad/mail/
Try a Reset - iPad How-Tos http://ipod.about.com/lr/ipad_how-tos/903396/1/
Or this - Delete the account in Mail and then set it up again.
Cheers, Tom -
When I send emails using my iPad, some recipients are telling me that I am sending them blank emails. I've had some of them forward the emails back to me so I can take a look and it seems that my message is actually there but the text is white. Interestingly enough, I was a Windows user just a few months ago and I was on the receiving end of this same problem with someone who was sending emails from her iPhone. I don't believe it is happening every time but if it happens even once it's a problem. Any idea what's going on?
Oddly enough, having reported the problem it appears to have fixed itself. There may be some combination swipe gesture that triggers it is all I can think because I suddenly manged to zoom my display x3 by double tapping three fingers. Took me a while to sort this out but then when I got back home I could suddenly see all my emails again. Bizarre!
-
Cannot send emails using 5800 xpressmusic s/w vers...
Not able to send emails using 5800 xpressmusic
S/W Version: 11.0.008
Custom S/w Version: 11.0.008.red.01
Version Date: 09-12-2008
I configured two email accounts but not able to send emails.
I also cannot see the missed call list. If i recieve a mssed call, it shows 1 missed call. When i click on Open it says no missed calls....
Please please help me............You must use mail.btinternet.com for outgoing server. You can retain your old incoming server for your own domain, but must use the BT one for any @btinternet accounts.
The following is my understanding based on use of the BT Yahoo mail service since September 2013. New users may be using the new BT mail portal - I don't know how this differs.
The BT outgoing server will block any outgoing mail sent from unauthorised accounts. This includes those in your own domain. The fix for this (as I understood it) is to add these accounts as sub-accounts to a primary BT mail account. The server will then relay them. The mail portal has an Options dialogue that lets the user manage mail accounts. Set up another account for each [email protected]
In Outlook, your domain accounts will need to set outgoing server to mail.btinternet.com and to authenticate using your @btinternet.com credentials. -
How to send emails using JSP?
How can i send emails using JSP? what are the things that i will need? please help me asap...thanks
Hi,
This works for me:
<%
String from = "Person"
String to= "my-email-address;
try{
SmtpClient client = new SmtpClient("smtp.stuff.com");
client.from(from);
client.to(to);
PrintStream message = client.startMessage();
message.println("To: " + to);
message.println("Subject: Sending an e-mail");
message.println();
message.println("Groovy :-)");
client.closeServer();
catch (IOException e){
System.out.println("ERROR SENDING EMAIL: "+e);
%>
Maybe you are looking for
-
How to use SQL OVER and PARTITION BY in OBIEE Expression Builder??
Hi there, I want to create a new logical coulmn with the following SQL query. SUM(Inventory Detail.Qty) OVER(PARTITION BY Inventory Detail.A,Inventory Detail.B,Item.C,Inventory Detail.D,MyDATE )/SUM(Inventory Detail.Qty) OVER(PARTITION BY Inventory D
-
I'm using Firefox 15 on a Mac and there don't seem to be any extensions affecting this. Thanks!
-
Creating ascii art in Illustrator
Hello, This is my first time posting and I'm hoping you can help me. I'd like to color letters of a text so that from afar the colored letters look like an image. The perfect example is ascii art - each character is colored appropriately so that as a
-
Poor quality of video in itunes
I recently downloaded episodes of "Lost", and have noticed that the image resolution at full screen is rather poor. Any ideas/suggestions?
-
Hello I have a problem in my phone The email request with Psoard forgotten I bought the phone by bringing the two years I have Vetorh with carton I want to help you thank you