Send mail using cl_bcs. need text in mail body

Hi friends,
please provide me some solution to send mail with out attachment and the message should only be in mail body.
Code :
TRY.
*     -------- create persistent send request ------------------------
        send_request = cl_bcs=>create_persistent( ).
*     -------- create and set document -------------------------------
*     create document from internal table with text
        CLEAR lv_const.
        CONCATENATE 'Dear' gs_cust-name1 ',' INTO lv_const SEPARATED BY space.
        APPEND lv_const TO text.
        CLEAR lv_const.
        CONCATENATE 'at' gs_cust-new_date 'planned delivery for you with following items:'
                    INTO lv_const SEPARATED BY space.
        APPEND lv_const TO text.
        l_space = '                                       ' .
        APPEND l_space TO text .
        CLEAR : gs_mat,
                lv_const.
        CLEAR l_quan.
        LOOP AT gt_mat INTO gs_mat WHERE new_date = gs_cust-new_date.
          l_quan = gs_mat-zmeng.
          CONCATENATE gs_mat-matnr gs_mat-maktx l_quan INTO lv_const SEPARATED BY space.
          APPEND lv_const TO text.
          CLEAR :
                  lv_const.
        ENDLOOP.
        l_space = '                                       ' .
        APPEND l_space TO text .
        APPEND 'Please contact with us if you confirm whether above products are' TO text.
        CLEAR lv_const.
        CONCATENATE 'required on' gs_cust-new_date 'with specified quantity.'
                    INTO lv_const SEPARATED BY space .
        APPEND lv_const TO text.
        APPEND 'You can contact with us via e-mail:xxxxxx or via' TO text.
        APPEND 'phone +xxxxxxxxxxxxxx' TO text.
        l_space = '                                       ' .
        APPEND l_space TO text .
        APPEND 'Best regards' TO text.
        APPEND 'Linde Central Logistic Team' TO text.
        lo_document = cl_document_bcs=>create_document(
                        i_type    = 'RAW'
                        i_text    = text
*                        i_length  = '12'
                        i_subject = 'test mail' ).
*     add document to send request
        CALL METHOD send_request->set_document( lo_document ).
*     --------- add recipient (e-mail address) -----------------------
*     create recipient - please replace e-mail address !!!
        recipient = cl_cam_address_bcs=>create_internet_address(
                                          'address' ).
*     add recipient with its respective attributes to send request
        CALL METHOD send_request->add_recipient
          EXPORTING
            i_recipient = recipient
            i_express   = 'X'.
*     ---------- send document ---------------------------------------
          CALL METHOD send_request->send(
            EXPORTING
              i_with_error_screen = 'X'
            RECEIVING
              result              = sent_to_all ).
          COMMIT WORK.
*  Send Immediately
          send_request->set_send_immediately( i_send_immediately = 'X' ).
      CATCH cx_bcs INTO bcs_exception.
        WRITE: text-001.
        WRITE: text-002, bcs_exception->error_type.
        EXIT.
    ENDTRY.
Please provide me the solution if i am missing any thing.
Thanks,
Kat

thank you for looking into this thread,
i have configured the in scot.
currently sending all RAW type as TXT. this has resolved my issues.

Similar Messages

  • 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

  • How to send automated mail using Weblogic API ,,,,,, NOT Java Mail API.

    Hi All,
    I need to send an automated mail using BEA Weblogic API, can you please let me know how to accomplish this task,
    I will be heartly thankful to you,
    waiting for your response back
    naveen

    does it uses weblogic API ,, is thre any other way to do the task apart from email controls ,,,, because we are using timers and email control uses event genrators.

  • 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

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

  • Read mail using java, and set the mail

    How can I read mail and set message "SEEN" with java? (javax.mail)
    IMAP supports flags; so there are no problems, just using
    msg.setFlag(Flags.Flag.SEEN, true);
    but,
    POP3 does not support flags; how can I solve this in POP3? I have searched for this problem, found that I can just check for the header "Status", but this header does not exsist. Then I tried to add this header, but again, then I got IllegalWriteException cause pop3-msg is writeprotected (yes: I opened the folder READ_WRITE); so; does anyone know how I can solve this problem?

    Hi !
    Could u plz send me the code u r having for reading mails using IMAP...actually v r trying to read mails from outlook but due to some security reasons our team has decided not to use pop3 ...
    Thanks in Advance
    sha

  • When I try to send a page by e-mail using the add-on e-mail feature, I get this message: " You don't appear to be authorized to access this service. +__+ " and cannot send the e-mail

    I cannot send e-mails of pages I wish to send using the add-this tab e-mail icon. I was able to use this all this time. But this week, I started to get this message: "You don't appear to be authorized to access this service +__+" . How do I rectify this problem?

    I cannot send e-mails of pages I wish to send using the add-this tab e-mail icon. I was able to use this all this time. But this week, I started to get this message: "You don't appear to be authorized to access this service +__+" . How do I rectify this problem?

  • How can i text/send multipe photos under 1 text/e-mail?

    does anyone know how to test/e-mail multipe attachments under one text/email?

    Or you can open camera roll and hold finger on one photo and then tap copy and paste the picture into your message then go back to camera roll and repeat the process

  • Send SMS using CL_BCS fail

    Hi
    I have created a HTTP node in SCOT called SMS for sending SMS's to customers. In my program I use class CL_BCS to send the message. But the message is never sent. In SOST I see the error: Cannot process message, no route from <user> to <phone number>. I think the reason is that in SCOT (System Status) the messages are under PAG but not in my node 'SMS' as I expected but in W/o nodes. Any ideas why the message is not correct node?
    CODE:
      CALL METHOD CL_BCS=>CREATE_PERSISTENT
        RECEIVING
          RESULT = lr_sms.
      CALL METHOD CL_DOCUMENT_BCS=>CREATE_DOCUMENT
        EXPORTING
          I_TYPE        = 'RAW'
          I_SUBJECT     = 'TEST'
          I_TEXT        = lt_text
        RECEIVING
          RESULT        = lr_document.
      l_sms_num = i_mobile.
      CALL METHOD CL_CAM_ADDRESS_BCS=>CREATE_SMS_ADDRESS
        EXPORTING
          I_SERVICE = 'SMS'
          I_NUMBER  = l_sms_num
        RECEIVING
          RESULT    = lr_rec
      CALL METHOD lr_sms->ADD_RECIPIENT
        EXPORTING
          I_RECIPIENT = lr_rec
          I_EXPRESS   = 'X'.
      CALL METHOD lr_sms->SET_DOCUMENT
        EXPORTING
          I_DOCUMENT = lr_document.
      CALL METHOD lr_SMS->SEND
        RECEIVING
          RESULT = l_bool.
    I've made sure that settings in SA14 are maintained: Pager Service = SMS, USE = SMS Service

    thank you for looking into this thread,
    i have configured the in scot.
    currently sending all RAW type as TXT. this has resolved my issues.

  • HT201320 My e-mail provider is Talk Talk.  How do I set up my iPad to receive e-mails using my existing TalkTalk e-mail address.

    My e-mail provider is TalkTalk.  How do I set up my iPad to receive and send e-mails?

    Settings -> Mail, Contacts & Calendars -> Add Account -> Other -> Add Mail Account
    Put in your email details, and tap on [Next].
    Then tap on the Pop button, and set the incoming and outgoing mail servers to Talk Talk's.
    You can find the configuration here:
    http://help.talktalk.co.uk/app/answers/detail/a_id/1458

  • How to send images and other colored text in email body

    Hi
    We are using SAP CRM 4.0 and we would like to send email to our customers using actions configured for activity. Our objective is to send Marketing Emails containing <u>Images and Color texts</u> in the BODY OF THE email and not as a PDF attachment.
    The only relevant provision we could see in SCOT is either Text or PDF. On using text , we are loosing all images and color. The PDF option works , but the email generated is a blank email with PDF document as attachment.
    We want the matter to be inserted in the body of the email and not as attachment.
    Please do let us know if any one has faced similar situation and is there a resolution.
    Thanks and Advance.
    Regards
    Sachi

    Are you pasting in the HTML code?
    You can't use the formats in the CRM editor to set bold text, etc.  You have to use the HTML code and have set the Form up as Internet mail
    http://help.sap.com/saphelp_crm40sr1/helpdata/en/82/dbfd38ccd23942e10000000a114084/content.htm
    Here's the first screen setting for my test email:
    Form          Y_TRADE_SHOW_INVITATION        / Trade Show Invitation (Test)
                                                                                    Form Usage              1 Internet Mail (SMTP)                        
        Text Type               1 HTML                                        
        IBU Scenario                                                          
        Customer Scenario                                                                               
    Page Format             DINA4         Status    Created                                                                               
    Characters Per Inch     10.00                                         
        Lines Per Inch          6.00                                          
        Style                   SYSTEM SAP Smart Forms Default                                                                               
    Created By         MANECITO            Changed By         MANECITO   
         Date               01/16/2007          Date               05/22/2007 
         Time               09:49:12            Time               18:01:51   
    then, your email has to have the HTML tags
    A bare minimum is your email has to have the <HTML> tag at the top, but it's advisable to be sure you have a more complete setup like this:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    .style1 {
         font-size: x-large;
         font-family: Verdana, Arial, Helvetica, sans-serif;
         font-weight: bold;
    .style2 {
         font-family: Verdana, Arial, Helvetica, sans-serif;
         font-weight: bold;
    .style5 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; }
    -->
    </style>
    </head>
    <body>
    ENTER YOUR HTML MESSAGE HERE
    </body>
    </html>

  • Error in sending mail Using java application using SMTP.

    Hi,
    I have created a java application of self user registration which also sends email to the user.
    I have also added two JAR files ie mail.jar and activation.jar under the PORTAL_INF/lib.
    The code works well in other servers but its showing the error-
    java.lang.NoSuchMethodError: com.sun.activation.registries.MailcapFile.getMailcapList(Ljava/lang/String;)Ljava/util/Map;
    Thanks & Regards,
    Amarys.

    Hi Amarys,
    Please check if you have configure the mail server in SAP protal.
    Refer to below documents:
    [Send email, using SMTP on remote host|Send email, using SMTP on remote host]
    [Mailing throw webdynpro for java|Mailing throw webdynpro for java]
    Best Regards
    Arun Jaiswal

  • Problem Sending Verizon Mail Using Mail Program

    I have not had a problem sending Verizon mail from my Mail program prior to Mavericks.  Now it is giving me fits. I do not have any troubke receiving mail. 
    This is what I get when I try and send mail through my Verizon account.  Do I just check Always Trust and then Connect.  There have been no Certificate issues prior to Maverick.  What is going on?   I did not get anything like this yesterday before I upgraded to Mavericks.

    This is what I get when I try and send an e-mail using my Verizon account in mail.
    Message was edited by: Stamper

  • Using VersaMail with Juno E-Mail Account

    I can receive e-mail using my paid Juno e-mail account but I cannot send out mail using it.   I keep getting this error message:  450 smtp01.nyc.untd.com authenication required.  My setup for outgoing mail is correct.  Could someone provide some information on this.
    Post relates to: Palm TX

    As a new user I am having trouble even getting Juno Email to allow me to read let alone write.
    Can someone please help me with the setting up Versa Mail to work with Juno.
    Thanks 

  • IPhoto4 and e-mail using AOL

    I have iPhoto 4.0.3 and I could have sworn that last month I was able to send pictures via e-mail using my AOL. The other day, I was trying to send some pictures but I am unable to get select "America Online". Selecting the e-mail icon at the bottom of the iPhoto window automatically opened a "Mail" window after the picture was compressed. When I went to Iphoto>Preferences, the "Mail using" tab was set to "Mail" and the other three choices (including "America Online" are dimmed, and so can't be selected. Can you help?
    Steve Rachbach

    Thanks Peter and Sue, but still problems. I was able to get into the mail preferences using minimal data on the first screen. I did change the default Email reader to my "AOL (10.3)" application. However, when I click Email on the bottom of the iPhoto screen, it still comes up with a "Mail" window. I tried quitting the programs and coming back in and I even shut down and restarted the computer. No luck, the Mail preferences window is still available and still has AOL as the default Email reader, but when a photo is selected for email, it opens a "Mail" window (with or without being signed onto AOL)

Maybe you are looking for