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.

Similar Messages

  • Send Email for manager of the user with Login and Password the user.

    Hello everyone,
    I need to send an email to the manager of the user with login and password when it is created in AD.
    I already have a mail server configured in the IT Resource. It has some component of the IDM that solve this issue?
    Anyone you help me with the next steps?
    Thank you.

    Thank you for your attention.
    It did not work, I did another test to send email notifying you when the User change password.
    The following error message appears in oim_server1-diagnostic.log:
    [2011-08-08T19:21:30.865-03:00] [oim_server1] [NOTIFICATION] [] [oracle.iam.passwordmgmt.impl] [tid: [ACTIVE].ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 88a924181f586e03:-25ab9c82:131aa884464:-8000-0000000000008862,0] [APP: oim#11.1.1.3.0] Resetting password
    [2011-08-08T19:21:30.936-03:00] [oim_server1] [NOTIFICATION] [IAM-0080013] [oracle.iam.platform.kernel.impl] [tid: [ACTIVE].ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 88a924181f586e03:-25ab9c82:131aa884464:-8000-0000000000008862,0] [APP: oim#11.1.1.3.0] Kernel executing default validation with process id, event id, entity and operation 59,612.0.User.RESET_PASSWORD
    [2011-08-08T19:21:31.155-03:00] [oim_server1] [NOTIFICATION] [IAM-3050013] [oracle.iam.identity.usermgmt.impl] [tid: [ACTIVE].ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 88a924181f586e03:-25ab9c82:131aa884464:-8000-0000000000008862,0] [APP: oim#11.1.1.3.0] Searching for users with the specified criteria.
    [2011-08-08T19:21:32.018-03:00] [oim_server1] [WARNING] [] [oracle.iam.passwordmgmt.impl] [tid: [ACTIVE].ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 88a924181f586e03:-25ab9c82:131aa884464:-8000-0000000000008862,0] [APP: oim#11.1.1.3.0] Sending Reset Password Notification is not successful
    [2011-08-08T19:21:32.639-03:00] [oim_server1] [NOTIFICATION] [IAM-0080046] [oracle.iam.platform.kernel.impl] [tid: [ACTIVE].ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: xelsysadm] [ecid: 88a924181f586e03:-25ab9c82:131aa884464:-8000-0000000000008862,0] [APP: oim#11.1.1.3.0] Completed orchestration with action result - oracle.iam.platform.kernel.vo.EventResult@4fe0d018
    [2011-08-08T19:21:32.642-03:00] [oim_server1] [NOTIFICATION] [IAM-0080011] [oracle.iam.platform.kernel.impl] [tid: [ACTIVE].ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: oiminternal] [ecid: 88a924181f586e03:-25ab9c82:131aa884464:-8000-0000000000008862,0] [APP: oim#11.1.1.3.0] Orchestration process with id 59,612 started running in a new thread.
    Edited by: Piza on 08/08/2011 15:24
    Edited by: Piza on 08/08/2011 15:26

  • Can I send email using my own domain address with iCloud the way I can with gmail?

    Let's say I own mydomain.com and have a [email protected] email account.  I have set that up to forward to gmail, and that would be easy to switch to iCloud.  Here's the tricky part: gmail allows me to send email as [email protected]  I've been doing this for years and it works, but I'd like to switch from gmail to iCloud.  Can I set up this same behavior with an iCloud @me.com address (which I already have but haven't been using yet)?  I know I can obviously switch the forwarding of incoming mail to my @me.com address...  but can I send [email protected] email through iCloud the way I can with gmail?  All of my devices are Apple: a Mac Mini using Apple's Mail app, and an iPhone and an iPad both using the Apple email app, so I'd rather switch everything over from gmail to iCloud.
    P.S.  Awe, c'mon Apple.  Don't turn those fake addresses into links.  I just used them for the sake of giving an example.

    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.

  • 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

  • When sending email from my ipad, the sender shows as Apple Inc??

    When sending email using my iPad, the sender shows up as Apple Inc. instead of my email address. How can I fix this?

    What does the Description say for the iCloud account on your iPad? (Click on "Settings/iCloud/Account")

  • Problem with Thunderbird email: When I send email using a mailing list, with my email included in the list, the message shows up in my Sent list and others rece

    Problem with Thunderbird email:
    When I send email using a mailing list, with my email included in the list, the message shows up in my Sent list and others receive it but it does not come to my email Inbox. The same problem occurs when I send the email to the mailing list addresses individually. When I send a simple test message to myself, I do receive it in my Inbox. Can you help me??
    Bob Greenman

    Are you using either cc or bcc? Is googlemail involved? Some email providers suppress cc's and bcc's to oneself since you will have a copy in your Sent folder.

  • When I send emails using my iPad, 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...

    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!

  • Send mail using CL_BCS through function module, run in background task.

    Hi,
    I am running a function module in Background task. in this function module I am sending mail using CL_BCS class.
    but mail is not generated. if I run the same function Module in foreground mail generated successfully....
    can anyone please tell me the reason behind this.

    Hi i realise that The LIST_TO_ASCII thing is not working correctly in background because the the list-processing in beckground is working not the same as in dialog i think.
    I can only get the last page of the list out when running in background. Any solution to this?
    my code:
        CALL FUNCTION 'LIST_TO_ASCI'
             EXPORTING
                  list_index         = sy-lsind
             TABLES
                 list_dyn_ascii = downtab
             EXCEPTIONS
                  empty_list         = 1
                  list_index_invalid = 2
                  OTHERS             = 3.
        IF sy-subrc NE 0.
          EXIT.
        ENDIF.
    Thanks ,
    LH

  • Can't send emails using .mac accounts? Finally the solution!!! Nice & Easy!

    Found this after searching these discussions for over an hour, and it really works, but you MUST create a new account, don't edit your existing one. Very quick & easy!!! Here you go, courtesy of Guillermo Toro-Lira:
    OK guys, problem solved, at least for those with a dotMac account like me.
    You have to create a new MobileMe account in your iPhone using your new MobileMe email address ( [email protected] instead of [email protected] ).
    Select Add Account... on Settings->Mail, Contacts, Calendars. Then MobileMe, enter your name, MobileMe address, password and description and select Save. The system will validate your account first. Then go back to Accounts, select your dotMac account and select delete. Your new mails, contacts, calendars will be sync'd by your new MobileMe account.
    It looks like iPhone classic 2.0 requires your new MobileMe address ([email protected]) to send emails.

    I accessed my .Mac account with the iPhone's mail client with my first generation iPhone for over a year including for a while after the change to MM before I purchased my iPhone 3G.
    The first generation iPhone and the iPhone 3G are capable of running the same firmware so there is no difference between the two in this regard. To say the first generation iPhone requires creating and accessing the @Me account instead of the @Mac account is incorrect.
    If this is true with many, how come not a single person has chimed in with this thread saying the same thing?

  • Can't send email using wifi. Spent 30 min troubleshooting with my email service provider who finally told me to contact Apple

    Can't send email using wifi. Spent 30 min troubleshooting with my email service provider who finally told me to contact Apple.
    It doesn't work when I can't get 3G, whether at home or overseas. Receives no problem, and 3G works fine when it's available.

    Maybe it is a 3GS. Anyway, I get the error that the network is not responding, and to check my settings. My ISP is Uniserve (Canada) but I am trying to use Telus (at home, where there is no 3G in my neighbourhood) or whatever is available as I travel eg. US or Europe for outgoing mail when 3G is not available. My husband has no problem with his iphone 4 when he sends email the same way usinf wifi.

  • I tried to upgrade the ios on the phone and I was asked for my icloud user and password. I don't remember these exactly and I tried several times with different options but unsuccessfully. I also forget my email used to configurate the phone.

    How i said on the question. I tried to upgrade the ios on the phone and I was asked for my icloud user and password. I don’t remember these exactly and I tried several times with different options but unsuccessfully. I also forget my email used to configurate the phone. I have the phone box and the bill. I sent you an email with my problem and attachments with the box informations, the bill and the reset request. What to do? You said to me:
    Your request comes from an unrecognized email domain. Apple accepts email requests only from email domains for Apple-authorized carriers.
    Please re-submit your request using your official carrier domain.
    but this email is authorized, what to do??
                                                                                                              respectfully, Beba

    If you have forgotten then these links are the only way to resolve
    http://www.apple.com/support/appleid/
    As long as you have owned the iPhone from new and your Apple id is the one used to activate when new
    OR have you recently purchased the iPhone secondhand ?

  • How to use a scaled object(MC) to fill the background with the new properties

    So lets say i have a stage 300 to 200 and all object that i have are for this dimensions.Also have an pattern function that fills the background.
    But the user is thinking of resizing the stage to lets say 1024 to 480 (he switched from a phone to a tablet).And now the scale of the objects in the tablet screen are more than 3times before(when seen on the Phone)
    How do i save the current new size object and use it in the creation of the new background (the 1024x480).
    currently i have this :
    public static const GAME_ORG_WIDTH:uint = 300;
    public static const GAME_ORG_HEIGHT:uint = 200;
    public function MainClass_road() {
                                  addEventListener(Event.ADDED, init);
                        public function init(e:Event):void{
                                   stage.scaleMode = StageScaleMode.NO_SCALE;
                                     stage.align = StageAlign.TOP_LEFT;
                                     stage.addEventListener(Event.RESIZE, setUpScreen);
                        public function setUpScreen(ev:Event):void{
                                  stage.removeEventListener(Event.RESIZE, setUpScreen);
                                  if(stage.fullScreenHeight > stage.fullScreenWidth){  
                                            gameStageWidth = stage.fullScreenWidth;
                                gameStageHeight = stage.fullScreenHeight;
                                  }else {
                                            gameStageWidth = stage.fullScreenHeight;       // 480
                                            gameStageHeight = stage.fullScreenWidth;                     //1024
                                  rescaleRatio = gameStageWidth / GAME_ORG_WIDTH;  
                                  //rescale every object, ie:
                                myC.scaleX = myC.scaleY =   rescaleRatio;
                       //start filling the Background with the pattern
                                       tileBgF();
    and then I use the while loop for filling the screen/background
    public function tileBgF(e:Event=null):void {
                                                      var bgClip = MyC;
                                                      var i:int = 0;
                                                      var j:int = 0;
                                                      while (bgClip.x < stage.stageWidth) {
                                                                bgClip = MyC;
                                                                while (bgClip.y < stage.stageHeight) {
                                                                          bgClip = MyC;
                                                                          tileLayer.addChild(bgClip);
                                                                          bgClip.x = bgClip.width * i;
                                                                          bgClip.y = bgClip.height * j;
                                                                          j++;
                                                                j = 0;
                                                                i++;
                                                      addChildAt(tileLayer,0);
    why does it give me
    Line 52
    1120: Access of undefined property MyC.
    in public function tileBgF
    and further more.After filling the background/screen with the pattern , how do i save it all like one big bitMap  so i can use /add it after time without doing all the checking of screen and things again.

    and is it better to use
    stage.fullScreenHeight
    in the while loop or leave it like it is ,or its irrelevant

  • Does Safari use up bandwidth if I leave it running in the background with zero tabs open?  Do I have to quit the application each time I am done to avoid exceeding my internet usage/host quota?

    If I leave Safari running in the background with zero tabs open, does it still use up bandwidth?  Do I have to quit the application each time I am done to avoid exceeding my internet usage/host quota?  I'd rather not have to since quitting the application and restarting it when I need to will quickly become tedious, but if that saves me on bandwidth usage, I'll do it.  Thanks!

    iStat pro is another good means of checking your Mac's activity.   Set it up within Dashboard.   It is a free facility.
    iStat pro for Mac - CNET Download.com

  • 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?

    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?

  • Since upgrading my computer last week i cannot send emails using talktalk, i can send via ipad and phone so not the server

    Since upgrading my system i have been unable to send emails using talktalk although i can receive them  i have no problem sending them via ipad or phone. can any one help please

    Open Mail -> Preferences -> Accounts.  Select the TalkTalk account and then the 'Account Information' tab. Drop down the 'Outgoing Mail Server (SMTP)' menu and select 'Edit SMTP Server List'.  Ensure that 'Server Name' under 'Account Information' is set to "smtp.talktalk.net".  You may also need to configure settings under the 'Advanced' tab. 
    More info here:
    http://help.talktalk.co.uk/app/answers/detail/a_id/1668/~/what-are-talktalk's-em ail-settings%3F#TalkTalk

Maybe you are looking for