Use of CL_BCS to send email in user exit

Hi,
I need some help from experts in this forum.
I use CL_BCS to send email if a certain condition is met inside a customer exit.
This exit is called before a confirmation dialog pop up asking whether we want to save or cancel.
I did not put commit work statement in this exit since it will commit all database update even though the transaction can still be canceled. Email will also be sent if the transaction is save. Hence, I'm relying on commit statement that come from the transaction itself.
However, this logic has create one problem for me.
If user hit cancel in the confirmation dialog that pop up after the exit is called, no commit will be executed. Hence, no email will be sent.
The problem is when the user change the data and re-save the data, there will be 2 email sent. One email come from the save action from the user and the other come from previous email that was not sent before due to no commit statement executed.
Is there any way to prevent this to happen? Please help.
PS: Points will be rewarded for those with helpful answer
Message was edited by:
        Abraham Bukit

Hi,
May be you use commit this way.
Create a custom function moudle , with you CL_BCS class codes and with comitt work inside and call the function in your userexit like
call function 'Y_CL_BCS_TRIGGER'     " << Your function module name
starting new task yscchdr-docno
exporting
   xxxxx     = xxxxx
aRs

Similar Messages

  • Sending email to user using the notification template in OIM 11g

    Hi all
    I have created a Notification Template using web console in OIM 11g.
    Iam able to access the contents from notification template in my java code.
    But iam not able to find the correct api's to send email to user using the notification template
    (like tcEmailNotificationUtil using this class we can connect to email template created in design console and creating IT resourse we can send email to user using the method sendEmail).
    Waiting for your help and pointers
    Thanks and Regards
    Bipin patil

    Thanks GP!.
    But i have the same doubt here.
    "The Notification Event is defined through a XML file that must be loaded into MDS database." - in which path and in what name it should be.
    Because under /metadata/iam-features-notification, i couldnt see any event Xml present. I thought atleast we could see the existing OOB notification template's event xml files.
    Please let me know if you are aware.
    Thanks,
    Amudha

  • Send email to users after completion of conc program by using Alerts

    Hi,
    I want to send email to users after completion of concurrent program by using Alerts . please guide me how to create alert and should send email of concurrent program details to user.
    Thanks in advance..it's a urgent requirement so help me.
    Regards
    Narender B

    Application Express != Oracle Applications
    You got into wrong forum please add here {forum:id=475}

  • Function Module to send emails to users

    Hi,
    Please help me in finding a FM that will allow me to send emails to users if a field in the internal table is blank.
    Please suggest.
    Thanks.

    Hi
    Use this
          call function 'SO_NEW_DOCUMENT_SEND_API1'
            EXPORTING
              document_data              = doc_data " Subject
              document_type              = 'RAW'
              put_in_outbox              = 'X'
              commit_work                = 'X'
            TABLES
              object_header              = obj_head " Header
              object_content             = obj_con[] " Body of mail
              receivers                  = rec " reciver
            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.
    rgds
    Arun

  • Can I use DeliveryManager just to send email with no document?

    Can I use "oracle.apps.xdo.delivery.DeliveryManager" to just send email without any document attached? or
    Is this only used to deliver the documents by email?
    I just want to use DeliveryManager just to send email with content in the body of the email. I am using BI Publisher API.
    Can any of you provide sample input for the above?

    Hi,
    You can use iMovie to record the message and save it as an email sized item and send the file as email like before.
    For those iChat AV users without a Cam and the AIM users without a cam you can do One-Way Viedo chats.
    Once you have a recorded Video file you can also drop the file on any Buddies name in you iChat Buddy list rather than using email.
    For those using other services you can set up a Jabber account and enable the required Transport/Gateways and send the files that way.
    http://www.jabber.org.au/ichat = Australian Page
    AllForces
    These are the two main information pages on how iChat can connect to the other IM services.
    Jabber Public Server list
    That would appear to be everybody.
    Ralph

  • Failed to send Email to user root. (90017)Invalid protocol: null

    Dear All ,
    After having configure the notification i goto the following error when a notification is enable.
    Failed to send Email to user root. (90017)Invalid protocol: null
    How to fix it
    Regards

    Thanks for the prompt return
    The link you send to me refer to notification with Grid control and there is no feature to perform a test to send an email . Or may me from cli .
    How can i check if EC can send an email . On Os level we use sedmail and it work
    Tx

  • How to use java mail to send email to hotmail box

    how to use java mail to send email to hotmail box??
    i can send emails to other box(my company's email account) but for hotmail, the program didnt print any err or exception the recepient cant receive the mail.
    thanks

    you ust to download activation.jar and mail.jar and add them to your build path.
    i have used the googlemail smtp server to send mail the code is following:
    public void SendMail()
    Properties props = new Properties();
    props.put("mail.smtp.user", username);
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.port", port);
    props.put("mail.smtp.starttls.enable","true");
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.socketFactory.port", port);
    try{
         Authenticator auth = new SMTPAuthenticator(username,password);
    Session session = Session.getInstance(props, auth);
    MimeMessage msg = new MimeMessage(session);
    msg.setText(text);
    msg.setSubject(subject);
    msg.setFrom(new InternetAddress(senderEmail));
    msg.addRecipient(Message.RecipientType.TO, new InternetAddress(receiver));
    Transport.send(msg);
    }catch(Exception ex) {
         System.out.println("Error Sending:");
    System.out.println(ex.getMessage().toString());
    and this the SMTPAuthenticator Class which you will need too.
    class SMTPAuthenticator extends javax.mail.Authenticator {
         private String fUser;
         private String fPassword;
         public SMTPAuthenticator(String user, String password) {
         fUser = user;
         fPassword = password;
         public PasswordAuthentication getPasswordAuthentication() {
         return new PasswordAuthentication(fUser, fPassword);
         }

  • Failed to use sample code to send email

    I tried to use the sample of 'sending email from the database with the utl_smtp package', the 2 packages were created successfully, but when I run the pl/sql block to call the stored procedure with:
    BEGIN
    demo_mail.mail(
    sender => 'Me <[email protected]>',
    recipients => 'Someone <[email protected]>, ' ||
    '"Another one" <[email protected]>',
    subject => 'Test',
    message => 'Hi! This is a test.');
    END;
    I got the error:
    ORA-29540: class oracle/plsql/net/TCPConnection does not exist.
    The error explained is:
    Cause: Java method execution failed to find a class with the indicated name.
    Action: Correct the name or add the missing Java class.
    May I know that how how I follow the action?
    I manually installed Jserver by running the initJVM.sql following the instruction. But I still get the error. Maybe My question can be: where is the class class oracle/plsql/net/TCPConnection installed, and how can I add it.
    I searched the dba_objects, the only objects similar is a JAVA CLASS '/d70c43a_TCPConnection'.
    Minny
    Thanks
    MInny

    you ust to download activation.jar and mail.jar and add them to your build path.
    i have used the googlemail smtp server to send mail the code is following:
    public void SendMail()
    Properties props = new Properties();
    props.put("mail.smtp.user", username);
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.port", port);
    props.put("mail.smtp.starttls.enable","true");
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.socketFactory.port", port);
    try{
         Authenticator auth = new SMTPAuthenticator(username,password);
    Session session = Session.getInstance(props, auth);
    MimeMessage msg = new MimeMessage(session);
    msg.setText(text);
    msg.setSubject(subject);
    msg.setFrom(new InternetAddress(senderEmail));
    msg.addRecipient(Message.RecipientType.TO, new InternetAddress(receiver));
    Transport.send(msg);
    }catch(Exception ex) {
         System.out.println("Error Sending:");
    System.out.println(ex.getMessage().toString());
    and this the SMTPAuthenticator Class which you will need too.
    class SMTPAuthenticator extends javax.mail.Authenticator {
         private String fUser;
         private String fPassword;
         public SMTPAuthenticator(String user, String password) {
         fUser = user;
         fPassword = password;
         public PasswordAuthentication getPasswordAuthentication() {
         return new PasswordAuthentication(fUser, fPassword);
         }

  • After installing the new Yosemite OS on my iMac I can no longer send email. I can receive email, but not send. I use gmail and can send email on the gmail (google) site, but not on "mail" on my iMac. Any others with this problem? What should we do?

    After installing the new Yosemite OS on my iMac I can no longer send email. I can receive email, but not send. I use gmail and can send email on the gmail (google) site, but not on "mail" on my iMac. Any others with this problem? What should we do?

    My gmail, which is correctly configured for Mail with gmail SMTP and Google IMAP, works for awhile on Mail, which I leave open while working on other applications. But several times a day I get msg from Google: "We recently blocked a sign-in attempt to your Google Account" . . . and requiring me to verify my account details, re-enter passwords, confirm security settings (or change them from "disable" to "enable less secure methods" and so on). In Mail I also have tried "taking all accounts online", and re-entering my gmail password inside Mail account settings. These steps successfully re-set comms between gmail and Mail ... for awhile, then it happens again. Enough occurrences over a work day that I just quit Mail and revert to accessing gmail directly. Apple Care advisor and an Apple knowledge base article say that Apple can't deal with this, as gmail is third-party app, and they refer me to gmail, and so far I've found nothing helpful there.
    From today I also have several instances of a window saying "Mail has unexpectedly closed" and asking me to Re-open it.
    I also use Yahoo mail, which stops working with Mac Mail at the same time as gmail, but I do not receive notices to re-verify from Yahoo.
    I recently upgraded from Mavericks to Yosemite. The Mail problem happened occasionally with Mavericks but is far more frequent with Yosemite.

  • Error Message when using Photoshop Element 9 sending email

    I was using Photoshop Element 9 sending email on Windows Live Mail.
    It was working perfect.
    A week ago, my computer had the problem and need to format and reinstall everything again.
    After that, when I used Photoshop Element 9 to send email using Windows Live Mail 2012.
    It came up error message in below:
    "Elements Organizer could not finish creating your E-mail message.
    Alternatively, you can use the Adobe E-mail Service via the Elements Organizer Preferences dialog."
    I don't want to use Adobe E-mail Service because it is very limited for email function such as attached another files or change email contents.
    Would you please give me some idea how to solve the problem ?
    Thanks,
    Joe

    Please refer the below link:
    http://forums.adobe.com/message/3284248#3284248
    http://helpx.adobe.com/photoshop-elements/kb/freeze-or-error-no-email.html
    -Harshit yadav

  • What to do about a virus that uses your mac to send email?

    what to do about a virus that uses your mac to send email?

    It's highly unlikely that your Mac has a virus, since no virus, worm or trojan has been reported, much less confirmed, as having the behavior you mention. As LB suggested, most likely it's your email account itself that has been compromised, or some other computer (a Windows system, almost certainly) that has your addresses on it has been infected.
    Check the "sent" folder for your email account and see if the bogus messages are shown there. If they are, that at least would verify that the emails were sent via your email account. Report back and let us know whether your email account is POP, IMAP or Exchange, and who your email host is.
    If the messages are not shown anywhere in your "sent mail" folder, then someone has almost certainly gotten hold of your contact list and spoofed your email address.
    Regards.

  • How many of you use CTRL + Enter to send email from Outlook

    It's a much faster option...and you don't have to grab that pesky mouse!

    I was working this morning and I asked my fiance if she used CTRL + Enter to send email from Outlook and she was not even aware that was an option. I have been using it for years and I wondered how many of you SpiceHeads use it as well?
    This topic first appeared in the Spiceworks Community

  • Re: sending email to user

    how to send a mail to the user after creating sales order details in va01? explain with example?

    Hi Asha
    I'll provide you a sample report. In which you have to replace the table and fields with the tables and fields you want
    *& Report  ZTESTMAIL                                                   *
    REPORT  ZMATURITY                               .
    tables: bseg.
    parameters: p_email type somlreci1-receiver default
    '@yahoo.com'.
    parameters: p_email1 type somlreci1-receiver default
    '@yahoo.com'.
    data: it_message type standard table of solisti1 initial size 0
    with header line.
    data: it_message1 type standard table of solisti1 initial size 0
    with header line.
    data: it_attach type standard table of solisti1 initial size 0
    with header line.
    data: text(150).
    data: t_packing_list like sopcklsti1 occurs 0 with header line,
          t_contents like solisti1 occurs 0 with header line,
          t_receivers like somlreci1 occurs 0 with header line,
          t_attachment like solisti1 occurs 0 with header line,
          t_object_header like solisti1 occurs 0 with header line,
          w_cnt type i,
          w_sent_all(1) type c,
          w_doc_data like sodocchgi1,
          gd_error type sy-subrc,
          gd_reciever type sy-subrc.
    start-of-selection.
    data: lv_date type sy-datum.
    data: lv_date1 type sy-datum.
    data: lv_formatdate(10) type c.
    data: lv_formatdate1(10) type c.
    data: var1(4) type c,
    var2(2) type c,
    var3(2) type c.
    data: begin of int_bseg occurs 0,
        BELNR LIKE BSEG-BELNR,
        ZUONR LIKE BSEG-ZUONR,
        GJAHR LIKE BSEG-GJAHR,
    end of int_bseg.
    data: begin of int_bkpf occurs 0,
          BELNR LIKE BKPF-BELNR,
          BUKRS LIKE BKPF-BUKRS,
          GJAHR LIKE BKPF-GJAHR,
          BUDAT  LIKE BKPF-BUDAT,
    end of int_BKPF.
    data: 2days_out type sy-datum.
    2days_out = sy-datum + 2.
    lv_date = 2days_out.
    var1 = lv_date+(4).
    var2 = lv_date+4(2).
    var3 = lv_date+6(2).
    concatenate var3 var2 var1 into lv_formatdate separated by '.'.
    data: var4(4) type c,
    var5(2) type c,
    var6(2) type c.
    select zuonr belnr bukrs GJAHR from bseg into
    corresponding fields of  table int_bseg
    where bukrs = 'COMPANY CODE' and
          ZUONR = lv_formatdate.
    *       loop at int_bseg.
    *it_message =  int_bseg-belnr.
    *ENDLOOP.
    *endselect.
    select  BUDAT BUKRS BELNR GJAHR  from BKPF into
    corresponding fields of table int_BKPF
    where bukrs = 'COMPANY CODE'.<-- YOUR COMPANY CODE
    *and      GJAHR = INT_BSEG-GJAHR.
    append int_BKPF.
    *lv_date1 = int_bkpf-budat.
    *  var4 = lv_date1+(4).
    *  var5 = lv_date1+4(2).
    *  var6 = lv_date1+6(2).
    *concatenate var6 var5 var4 into lv_formatdate1 separated by '.'.
    *endselect.
    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
      'Assignment Date after 2 days'
      'XLS'
      'filename'
      changing gd_error
      gd_reciever.
    * Instructs mail send program for SAPCONNECT to send email(rsconn01)
      perform initiate_mail_execute_program.
    *endif.
    end-of-selection.
    *& 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.
      describe table it_message lines t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      append t_packing_list.
    * Add the recipients email address
      clear t_receivers.
      refresh t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      append t_receivers.
      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
          object_header              = t_object_header
          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
    * 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
    *& Form POPULATE_EMAIL_MESSAGE_BODY
    * Populate message body text
    form populate_email_message_body.
      refresh it_message.
      refresh it_message1.
    * if int_bseg-belnr = int_bkpf-belnr.
      loop at int_BSEG.
    read table int_bKPF WITH KEY BELNR = INT_BSEG-BELNR
            GJAHR = INT_BSEG-GJAHR.
    lv_date1 = int_bkpf-budat.
      var4 = lv_date1+(4).
      var5 = lv_date1+4(2).
      var6 = lv_date1+6(2).
    concatenate var6 var5 var4 into lv_formatdate1 separated by '.'.
    it_message =  int_bseg-belnr.
    it_message1 =  lv_formatdate1.
    * it_message = 'Assignment Date is coming After 2 Days'.
    concatenate 'Doc. No :   'it_message
                'Posting Date :  '  it_message1
       'Assignment Date is coming After 2Days'  into
    it_message separated by space.
    append it_message.
    append it_message1.
      clear it_message.
      clear it_message1.
    endloop.
    *endif.
    endform. " POPULATE_EMAIL_MESSAGE_BODY
    Reward all helpfull answers
    Regards
    Pavan

  • Help needed! How to send Email if user created in a specific organization

    Hello experts.
    I have edited the Create User workflow to include the Email notiifcation. I follow the example in the manual under Example workflow customization.
    What I have discovered is that it will send email no matter which Organization a user is created in. e.g. Top or Top:MyOrg or Top:Disabled
    I only want Email sent if user is created in Top:MyOrg
    What data is available during the workflow?
    Currently the transition to Email User in the Notify activity doesnt have a condition... it will always branch to Email User.
    What I want is a conditional branch only doing the Email User if the organization=Top:MyOrg
    What does this condition look like?
    I guess I also need to include a branch to end in the Notify if necessary.
    I am new to customizing workflow but this is urgent request.

    sorry.
    trial and error have shown me that
    <eq>
    <ref>user.waveset.organization</ref>
    <s>Top:MyOrg</s>
    </eq>
    is the condition for me to use.

  • Send Email to User on provisioning /De-provisioning from TFS

    Hi,
    I require to create an application which will trigger an email to end-user after provisioning /De-provisioning  him/her in Team Foundation Server.
    I am new to TFS, can someone help me to get started on this.
    Thanks a lot.

    Hi AbhiroopGhosh,  
    Thanks for your post.
    What’s the version of your TFS?
    What email you want send to user? Team project alerts?
    For default TFS team project alert feature, please refer to this document:
    https://msdn.microsoft.com/en-us/library/ms181334.aspx.
    How to subscript event using TFS API, please refer to the example in this article:
    http://roadtoalm.com/2012/03/29/create-tfs-event-subscription-programmatically-with-tfs-api/. And you create and send email using your custom code.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • Keyboard trackpad not working

    All of a sudden my keyboard and trackpad don't work on my Macbook. USB keyboards and mice work fine. I took off the keyboard and tried it on another Macbook and it worked fine. Don't know if any recent updates or firmware changes have been done. Any

  • Change Management Software

    Hi, Are there any formal software tools to document and manage Change Management Thanks, Suneela.

  • Activating FI Business Content

    Hi All, I have to implement FI AR and GL. I have to install the datasources in R/3 and also need to activate them in BW. Is there any special procedure(for FI) to follow like we do for Logistics(i.e LO Cockpit etc) or is it the normal process? Best R

  • Apple Macbooks and Final Cut Pro

    I was wondering if Final Cut Pro can work on an Apple Macbook?

  • Long desktop rebuild

    I recently purchased a refurbished iBook G3. It came loaded with OS 9.2 and 10.2., as well as the OS CD's for both systems. I also received a CD containing AppleWorks 6, which I decided to install. Before the installation was complete, a message appe