Send email when error

Hi!
How can I send to somebody (USER) an email if during a process of a prog.
an error occurs. Any Function Module ??
Regards
sas

Hi,
Here is the example Program to send the mail
*& 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
Regards
Sudheer

Similar Messages

  • ESB Notification channel not sending emails when error is not retryable

    Hi everyone,
    I'm facing a problem on a production environment, two Oracle SOA suite 10.1.3.3 machines in cluster, operating system Linux Unbreakable.
    I've succesfully set up the notification channel for ESB and it is correctly sending mail.
    Today after some errors ESB did not sent any mail and there is not a single error in the log files, both in opmn/logs and j2ee/OC4J_.../log/...
    At the same time some retryable error has been seen, and for in this case the mail was correctly sent, so the only clue I have is that for some reason there is a configuration that tells the server not to send mails for not retryable errors... Am I right? Is there a chance to change this behaviour?
    Thank's for your attention,
    Lisa

    Hi Lisa,
    >>
    I'm facing a problem on a production environment, two Oracle SOA suite 10.1.3.3 machines in cluster, operating system Linux Unbreakable.
    I've succesfully set up the notification channel for ESB and it is correctly sending mail.
    Today after some errors ESB did not sent any mail and there is not a single error in the log files, both in opmn/logs and j2ee/OC4J_.../log/...
    At the same time some retryable error has been seen, and for in this case the mail was correctly sent, so the only clue I have is that for some reason there is a configuration that tells the server not to send mails for not retryable errors... Am I right? Is there a chance to change this behaviour?
    >>
    I'm also using 10.1.3.3 MLR#17 in cluster, OS: AIX 5.3L and didn't faced your behaviour before.
    What exactly errors do you facing? ESB email notification works not for all errors.
    For example: failure at JCA layer (FTP adapter that poll for XML files and receive a text file) - didn't produce any notification (you must manually configure rejection handler for this, if you need more than files at $OH/j2ee/.../jca/...) and this's expected behaviour.
    Best Regards,
    Mikhail.

  • Cannot send email when clicking lonk on web page

    I cannot send email when clicking link on web page. 
    When I would click the link to send via email I was being directed to hotmail to open new account.
    Today the tech tried to assist me and completely messed up my email capabilities by setting up
    windows live account.
    I am thoroughly disgusted with FIOS internet services..Every time I've called them in the past month problem has been with someone else whose portal services they are using.
    I cannot send emails because all my contact information cannot be moved.
    I'm paying for FIOS internet service that is almost non existent.
    THe VZ in home agent doesn't work nor does the FIOS information site.
    My next move is to get rid of FIOS.
    They create more problems then they solve with me.

    If I understand your problem correctly, you are having trouble when clicking on a MailTo link on any webpage? What loads when you click this type of link is a setting in your browser. If you tell us what browser you are using, we can try to direct you to the setting.
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.
    "All knowledge is worth having."

  • HT4979 why can I not send email when away from my home wifi? Am able to receive messages OK, and outgoing mailserver is correct?

    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

  • I am having problems sending emails when using apps. I dont receive any emails when I try to send documents such as pdf or pictures. I tried sending it to my other email account but I don't get any email. What is wrong?

    I am having problems sending emails when using apps. I dont receive any emails when I try to send documents such as pdf or pictures. I tried sending it to my other email account but I don't get any email. What is wrong?

    System Preferences > Network > your-connection-medium > (Assist me) > ( Diagnostics )
    This sometimes provides additional helpful information, sometimes not so much.

  • TS2621 why may I send email when wi-fi is enabled, but not when it is disabled?

    iphone 4s with verizon will send email via wi-fi but not 3G. Are there any ideas why?

    Depends on the email account.  If it is from your Internet provider they may only allow use of their SMTP server for sending emails when on their network.  To send emails when not on their network (i.e. when using Cellular data) it would require using a different SMTP server.

  • My iPhone will not send emails when away from my home wifi

    my iphone will not send emails when away from home wifi any advice

    Hey craggee,
    Thanks for the question. This is usually do to a limitation by your ISP/email provider:
    If you are only able to use your email account while connected to your home network, this may be a limitation put in place by your email service provider. For further support, please contact your email service provider directly.
    iOS: Troubleshooting Mail
    http://support.apple.com/kb/TS3899
    Thanks,
    Matt M.

  • Trouble sending email when on Wifi.

    Can't send email when on Wifi, but can send when on 4G or maybe 3G - I forget. Can receive emails fine on both.  To further confuse things I have three email accounts on my phone, two of them have no trouble sending or receiving when on either wifi or 4G.. I've checked and compared settings dozens of time.
    I have a private hosted email account (not sure if that is the right word) But I don't have google, AOL, or something like that..
    Thanks

    "But wouldn't I be using the same outgoing mail server if I was wifi or 4G?"
         Yes it would be the same. Maybe I'm too tired to figure this out.
    The only other thing that comes to mind is that your wifi router's firewall may be blocking that port. But if that were the case, your PC or Mac wouldn't be able to send mail either.

  • Send email when ownership is assigned' is not working

    Send email when ownership is assigned'
    is not working
    even though this option is disabled designer workflow task creation sends an email to the user when task is assigned to the user.
    We have october CU updates 2013.
    MCTS Sharepoint 2010, MCAD dotnet, MCPDEA, SharePoint Lead

    Hi Amit,
    Per my knowledge, if the task is created from a workflow, then you may use the task actions in the workflow.
    And some task actions will send an email to the user who the task is assigned to, so the email is sent from the workflow and it is not sent from the option “Send email when ownership is assigned”.
    If you are using 2013 workflow, the send email action cannot be prevented from the workflow.
    If you are using 2010 workflow, you can go into the task process to delete the Send an Email action.
    https://support.office.com/en-nz/article/Use-the-task-process-editor-for-approval-workflows-8680b4a4-36b1-441c-b070-e515976078aa#__toc264538566
    Thanks,
    Victoria
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Victoria Xia
    TechNet Community Support

  • Send email when a LWAPP AP is not reponding!

    Hi,
    Is it possible for the WLC 4404/25 to send email when it lost communication with an LWAPP AP?

    Not that I am aware of. If you are using an external dhcp server with reservations for the APs or static ip assignments, you can use a monitoring system to alert you

  • TS3899 I can't send email when wifi is on

    I can't send email when wifi is on. How do I fix??

    I can't send email when wifi is on. How do I fix??

  • Send Email when built in approval workflow status column changes to approved

    I Implemented the built in approval work flow in a document library,I want to send an email when the column indicating the status of the workflows changes from in progress to approved.

    Hi ,
    According to your description, my understanding is that you want to send email when the built-in approval workflow status was approved.
    For the default built-in approval workflow, per my knowledge, there is not a way to modify it. As a workaround, you can create a Reusable Workflow with SharePoint Designer 2010, and publish it to your SharePoint, then you can use it like the built-in approval
    workflow.
    You can do as the followings:
    Install SharePoint Designer 2010.
    Open your site with SharePoint Designer 2010.
    Click Workflow under Navigation.
    Click Reusable Workflow, and type a name.
    Add “Start Approval Process” action, in the ‘these user’ , type the approvers.
    Click ‘Approval’ field, and under Customization, click “Change the behavior of a single task”.
    On the “When a Task Completes”, add “Send an Email” action in the approved condition,like the screenshot below.
    Then save and publish the workflow, then you can use the workflow in your SharePoint site .
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • I run DeviceDemo sample to send email, when click send email button after f

    I run DeviceDemo sample to send email, when click send email button after filling all fields, it took me to EverNote application, can not send email. does anyone has this kind experience? how to fix it?

    Hi,
    ADF Mobile cannot directly send emails as this is a security precaution of your mobile phone (imagine all applications could send mails without you confirming). Instead the send mail functionality launches the mail client you have configured and fill in the information you provided in the application. The mail function by the way is implemented through Cordova.
    Frank

  • Need a perl script which monitors a network folder and sends email when new files/folders arrived...

    I need a perl script (or something else better) which monitors a network folder and sends email when new files/folders arrived. I tried it in Automator but failed.
    Thanks!

    Yes. I tried it. But whenever I restart m Mac, the watch folder doesn't work until I reconnect to network or run the Automator... I need a simple system that automatically connects to the network and monitor the folder, even I restart the Mac.
    Thanks!

  • Send email when report has error status

    Hi Gurus,
    Is there any possible way through which i can send an email only when we come across an error report in B2B 10g.
    Note: Error report means when the status of the report shows error at the console.
    Any suggestions will be appreciated.
    Regards
    Ayush

    Hi Ayush,
    If I got it right then you want to send Email notification in case an error occurs in Oracle B2B. You can definitely do it.
    Monitor the error queue (by default IP_IN_Queue) and dequeue messages for B2BERRORUSER. using a BPEL/java utility. Using same utilities you may send Email notification.
    Please let us know if you are lokking for something else.
    Regards,
    Anuj

Maybe you are looking for

  • Acrobat 9 Pro - Converting PDF to JPEG

    I had to reinstall my acrobat 9 pro after my hard drive had to be reformatted. When it was installed previously on my old hard drive, I never had issues with converting a pdf file to a jpeg.  Since the new installation that option does not work anymo

  • Problems with the camera on the iPhone 5 when taking a picture...

    Hello... Could someone tell me what I should do to get the camera on my iPhone 5 working normal again. From one day to another i tried to take a picture and it does not focus at all! it keeps the image blurry. I reseted the iPhone 3 times and nothing

  • Can I use ipad mini cellular abroad? If so which carrier would you recommend?

    I want to buy Ipad mini cellular through the apple web store, but I can only buy locked with a carrier. Can I use it in other country? Which carrier would you recomend to use in China and Chile?

  • Does WLS 9.0 jms ra support JCA 1.5?

    WLS 9.0 installation incudes jms-xa-adp.rar, jms-notran-adp.rar, jms-local-adp.rar. But all support only JCA 1.0 version if you look at their resource adapter descriptors. The release note says that WLS 9.0 supports JCA 1.5, does not say anything abo

  • Photoshop Elements 12 and Lightroom transfer/sharing problem

    I'm new to Adobe Lightroom 5 and Photoshop Elements 12.   I open a Lightroom image in Photoshop Elements 12 by using Photo-->Edit In--> PSE12.  I make a change in PSE12, and then "save."  I understand that I'm supposed to overwrite the default file n