Send a mail with the class CL_HTTP_CLIENT

hi,
i use this program and i would send a mail with a attachment file PDF. I try to use the function module SO_NEW_DOCUMENT_ATT_SEND_API1 but i dont know to translate the data XSTRING to internal table.
Thank you.
*& Report  ZYTEST_TRANSFER_URL2                                        *
REPORT  zytest_transfer_url2                    .
*- begin of internal data
TYPE-POOLS: swfxc, icon.
DATA: l_http_client TYPE REF TO if_http_client.
DATA: l_url TYPE string.
DATA: l_code TYPE sy-subrc.
DATA: l_code_string TYPE string.
DATA: l_message_string TYPE string.
DATA: lt_http_fields TYPE tihttpnvp.
DATA: l_http_field_wa TYPE ihttpnvp.
DATA: l_char_header(40) TYPE c.
DATA: l_body_string TYPE string.
DATA : line TYPE string.
DATA: result_tab TYPE TABLE OF string,
result_str TYPE string.
*- end of internal data
DATA: lv_contents TYPE string.
DATA: lv_location TYPE string.
*- begin of parameters
PARAMETERS: url TYPE swc_value.
PARAMETERS : receiver TYPE somlreci1-receiver LOWER CASE.
*- end of parameters
START-OF-SELECTION.
  PERFORM main.
*& Form main
text
FORM main.
PERFORM get_contents USING lv_contents.
*- Create the HTTP-Client
  l_url = url.
l_proxy_host =
l_proxy_service =
  CALL METHOD cl_http_client=>create_by_url
  EXPORTING
  url = l_url
proxy_host = l_proxy_host
proxy_service = l_proxy_service
  IMPORTING
  client = l_http_client
  EXCEPTIONS
  argument_not_found = 1
  plugin_not_active = 2
  internal_error = 3
  OTHERS = 4.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
*- send the http post
  CALL METHOD l_http_client->send
    EXCEPTIONS
      http_communication_failure = 1
      http_invalid_state         = 2.
  IF sy-subrc <> 0.
    WRITE: / icon_red_light AS ICON.
    CALL METHOD l_http_client->get_last_error
      IMPORTING
        code    = l_code
        MESSAGE = l_message_string.
    CALL METHOD l_http_client->close.
    l_code_string = l_code.
    CONCATENATE 'HTTP-Send: RC=' l_code_string              "#EC NOTEXT
    INTO l_code_string .
    CONCATENATE l_code_string l_message_string
    INTO l_message_string SEPARATED BY space.
    PERFORM print_string USING l_message_string.
    EXIT.
  ENDIF.
*- receive the result of http post
  CALL METHOD l_http_client->receive
    EXCEPTIONS
      http_communication_failure = 1
      http_invalid_state         = 2.
  IF sy-subrc <> 0.
    WRITE: / icon_red_light AS ICON.
    CALL METHOD l_http_client->get_last_error
      IMPORTING
        code    = l_code
        MESSAGE = l_message_string.
    CALL METHOD l_http_client->close.
    l_code_string = l_code.
    CONCATENATE 'HTTP-Receive: RC=' l_code_string           "#EC NOTEXT
    INTO l_code_string .
    CONCATENATE l_code_string l_message_string
    INTO l_message_string SEPARATED BY space.
    PERFORM print_string USING l_message_string.
    EXIT.
  ENDIF.
*- print the results
  CALL METHOD l_http_client->response->get_status
    IMPORTING
      code = l_code.
  IF l_code < 300.
HTTP-codes: 100 - 199 = informations
HTTP-codes: 200 - 299 = client-request successful (200 = OK)
    WRITE: / icon_green_light AS ICON.
  ELSE.
HTTP-codes: 300 - 399 = redirected; further actions required
HTTP-codes: 400 - 499 = client-request incomplete
HTTP-codes: 500 - 599 = server errors
    WRITE: / icon_red_light AS ICON.
  ENDIF.
*-- get the http header fields
  CALL METHOD l_http_client->response->get_header_fields
    CHANGING
      fields = lt_http_fields.
  LOOP AT lt_http_fields INTO l_http_field_wa.
    l_char_header = l_http_field_wa-name.
    WRITE: / l_char_header.
    l_char_header = l_http_field_wa-value.
    WRITE: l_char_header.
  ENDLOOP.
  WRITE: / sy-uline.
*- get the body
  DATA: lv_bin_contents TYPE xstring.
  lv_bin_contents = l_http_client->response->get_data( ).
  PERFORM save_file USING lv_bin_contents.
ENDFORM. "main
*& Form print_string
FORM print_string USING p_string TYPE string.
  REFRESH result_tab.
  SPLIT p_string AT cl_abap_char_utilities=>cr_lf INTO TABLE result_tab.
  LOOP AT result_tab INTO result_str.
    WRITE:/ result_str.
  ENDLOOP.
ENDFORM. " print_string
*& Form save_file
text
FORM save_file USING lv_bin_contents.
  DATA: save_file(1000) TYPE c VALUE '/tmp/test3.pdf'.
  DATA: lv_file TYPE localfile.
  DATA : g_file(80).
  g_file = url.
  DO.
    SHIFT g_file LEFT UP TO '/'.
    IF sy-subrc NE 0.
      EXIT.
    ENDIF.
    SHIFT g_file LEFT.
  ENDDO.
  SHIFT g_file RIGHT UP TO '.'.
  SHIFT g_file RIGHT.
  lv_file = save_file.
  OPEN DATASET lv_file FOR OUTPUT IN BINARY MODE.
  IF sy-subrc NE 0.
    WRITE:'SY-SUBRC :',sy-subrc.
MESSAGE i000 WITH text-014. "'File Directory not found'.
    EXIT.
  ENDIF.
  TRANSFER lv_bin_contents TO lv_file.
  CLOSE DATASET lv_file.
  IF sy-subrc <> 0.
    EXIT.
  ENDIF.
  IF sy-subrc EQ 0.
MESSAGE i000 WITH text-012."'Successfully downloaded to Application
server'.
    EXIT.
  ENDIF.
ENDFORM. "save_file

hi,
i use this program and i would send a mail with a attachment file PDF. I try to use the function module SO_NEW_DOCUMENT_ATT_SEND_API1 but i dont know to translate the data XSTRING to internal table.
Thank you.
*& Report  ZYTEST_TRANSFER_URL2                                        *
REPORT  zytest_transfer_url2                    .
*- begin of internal data
TYPE-POOLS: swfxc, icon.
DATA: l_http_client TYPE REF TO if_http_client.
DATA: l_url TYPE string.
DATA: l_code TYPE sy-subrc.
DATA: l_code_string TYPE string.
DATA: l_message_string TYPE string.
DATA: lt_http_fields TYPE tihttpnvp.
DATA: l_http_field_wa TYPE ihttpnvp.
DATA: l_char_header(40) TYPE c.
DATA: l_body_string TYPE string.
DATA : line TYPE string.
DATA: result_tab TYPE TABLE OF string,
result_str TYPE string.
*- end of internal data
DATA: lv_contents TYPE string.
DATA: lv_location TYPE string.
*- begin of parameters
PARAMETERS: url TYPE swc_value.
PARAMETERS : receiver TYPE somlreci1-receiver LOWER CASE.
*- end of parameters
START-OF-SELECTION.
  PERFORM main.
*& Form main
text
FORM main.
PERFORM get_contents USING lv_contents.
*- Create the HTTP-Client
  l_url = url.
l_proxy_host =
l_proxy_service =
  CALL METHOD cl_http_client=>create_by_url
  EXPORTING
  url = l_url
proxy_host = l_proxy_host
proxy_service = l_proxy_service
  IMPORTING
  client = l_http_client
  EXCEPTIONS
  argument_not_found = 1
  plugin_not_active = 2
  internal_error = 3
  OTHERS = 4.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
*- send the http post
  CALL METHOD l_http_client->send
    EXCEPTIONS
      http_communication_failure = 1
      http_invalid_state         = 2.
  IF sy-subrc <> 0.
    WRITE: / icon_red_light AS ICON.
    CALL METHOD l_http_client->get_last_error
      IMPORTING
        code    = l_code
        MESSAGE = l_message_string.
    CALL METHOD l_http_client->close.
    l_code_string = l_code.
    CONCATENATE 'HTTP-Send: RC=' l_code_string              "#EC NOTEXT
    INTO l_code_string .
    CONCATENATE l_code_string l_message_string
    INTO l_message_string SEPARATED BY space.
    PERFORM print_string USING l_message_string.
    EXIT.
  ENDIF.
*- receive the result of http post
  CALL METHOD l_http_client->receive
    EXCEPTIONS
      http_communication_failure = 1
      http_invalid_state         = 2.
  IF sy-subrc <> 0.
    WRITE: / icon_red_light AS ICON.
    CALL METHOD l_http_client->get_last_error
      IMPORTING
        code    = l_code
        MESSAGE = l_message_string.
    CALL METHOD l_http_client->close.
    l_code_string = l_code.
    CONCATENATE 'HTTP-Receive: RC=' l_code_string           "#EC NOTEXT
    INTO l_code_string .
    CONCATENATE l_code_string l_message_string
    INTO l_message_string SEPARATED BY space.
    PERFORM print_string USING l_message_string.
    EXIT.
  ENDIF.
*- print the results
  CALL METHOD l_http_client->response->get_status
    IMPORTING
      code = l_code.
  IF l_code < 300.
HTTP-codes: 100 - 199 = informations
HTTP-codes: 200 - 299 = client-request successful (200 = OK)
    WRITE: / icon_green_light AS ICON.
  ELSE.
HTTP-codes: 300 - 399 = redirected; further actions required
HTTP-codes: 400 - 499 = client-request incomplete
HTTP-codes: 500 - 599 = server errors
    WRITE: / icon_red_light AS ICON.
  ENDIF.
*-- get the http header fields
  CALL METHOD l_http_client->response->get_header_fields
    CHANGING
      fields = lt_http_fields.
  LOOP AT lt_http_fields INTO l_http_field_wa.
    l_char_header = l_http_field_wa-name.
    WRITE: / l_char_header.
    l_char_header = l_http_field_wa-value.
    WRITE: l_char_header.
  ENDLOOP.
  WRITE: / sy-uline.
*- get the body
  DATA: lv_bin_contents TYPE xstring.
  lv_bin_contents = l_http_client->response->get_data( ).
  PERFORM save_file USING lv_bin_contents.
ENDFORM. "main
*& Form print_string
FORM print_string USING p_string TYPE string.
  REFRESH result_tab.
  SPLIT p_string AT cl_abap_char_utilities=>cr_lf INTO TABLE result_tab.
  LOOP AT result_tab INTO result_str.
    WRITE:/ result_str.
  ENDLOOP.
ENDFORM. " print_string
*& Form save_file
text
FORM save_file USING lv_bin_contents.
  DATA: save_file(1000) TYPE c VALUE '/tmp/test3.pdf'.
  DATA: lv_file TYPE localfile.
  DATA : g_file(80).
  g_file = url.
  DO.
    SHIFT g_file LEFT UP TO '/'.
    IF sy-subrc NE 0.
      EXIT.
    ENDIF.
    SHIFT g_file LEFT.
  ENDDO.
  SHIFT g_file RIGHT UP TO '.'.
  SHIFT g_file RIGHT.
  lv_file = save_file.
  OPEN DATASET lv_file FOR OUTPUT IN BINARY MODE.
  IF sy-subrc NE 0.
    WRITE:'SY-SUBRC :',sy-subrc.
MESSAGE i000 WITH text-014. "'File Directory not found'.
    EXIT.
  ENDIF.
  TRANSFER lv_bin_contents TO lv_file.
  CLOSE DATASET lv_file.
  IF sy-subrc <> 0.
    EXIT.
  ENDIF.
  IF sy-subrc EQ 0.
MESSAGE i000 WITH text-012."'Successfully downloaded to Application
server'.
    EXIT.
  ENDIF.
ENDFORM. "save_file

Similar Messages

  • [iPad Mini 1st Gen.] Can't send E-Mails with the normal "Mail" App

    Hi,
    I can't send E-Mails with the normal E-Mail App, it works only with another Mail App, but then I can't send pictures. Maybe my new router is the cause, but it works with my iPhone 5, only with my iPad mini it doesn't work.Well, how I can solve the problem?
    Sorry for my bad English.
    Many Greetings from Germany.

    Hi,
    i can't change the iCloud SMTP Server settings for outgoing E-Mails.It isn't possible to make these "How to" (or how i can call it?) and the moves before i have already done and the issue haven't solved. I think my iPad mini is to old....
    Many greetings,
    xbdsmallwork
    Edit: I have a iCloud Mail Account.

  • E71 - Can't send e-mail with the Nokia E-mail

    I'm not able to send e-mail when I use the Nokia E-mail although I can receive it.
    I use a SMTP account.
    The strange is that I compose or reply the e-mail, I click in the SEND option, but it keeps retrieving and out of the blue the e-mail disapear. It doesn't show any error message. And I can't find the e-mail that I wrote.
    The other thing is that I can't move the e-mails that are in the inbox to the drafts. When I click in options, it doens't show this options (move to drafts).

    I'm not able to send e-mail when I use the Nokia E-mail although I can receive it.
    I use a SMTP account.
    The strange is that I compose or reply the e-mail, I click in the SEND option, but it keeps retrieving and out of the blue the e-mail disapear. It doesn't show any error message. And I can't find the e-mail that I wrote.
    The other thing is that I can't move the e-mails that are in the inbox to the drafts. When I click in options, it doens't show this options (move to drafts).

  • I'm trying to unlock an Iphone 4. The celular company allready unlocked it. and send me an E Mail with the instructions to do it myself. I have done every step, and in itunes apears that my Iphone is Unlocked. But I can not use a sim CArd from another Co

    Im tying to unlock an Iphone 4.
    the celular company make it by its system, and send me an E mail with the instructions to finsh the process by myself, throug itunes.
    I did every step, and at the end appers a message telling that my Iphone is unlocked.
    but it does not work with other celular company sim card.
    It only works with the original sim Card company.
    In the Iphone appears a message teeling that has no service with another company's sim CArd.
    I don't know what to do.
    I've been doing this, with different Sim cards.
    sometimes appears a message informing that the SIM card is locked with a PIN. That i must instal the last itunes version and connect it again.
    but every Sim card I have are with PIN.
    If you can help me I;ll be very glad.
    Thank you very Much.
    nicanorfrommon

    Chrisj4203, thank you for your kind answer.
    I have done a lot of restores to the Iphone, and resets also.
    I;ve done holding both buttons as you sugested, but there is no signal appearing.
    I am in Uruguay, South America and the original company is Movistar ( Telefonica) and the new sim card is from ANTEL ( the officail and biggest company in my country).
    I don;t knoe what todo.
    I have been trying for more than one mont.
    I have gone several times to both companies. Aldo two times to Apple uruguay, and nobody can help me.

  • When I send an email with Mail, I often confuse the account which I'm using. The result is that I send a message with the wrong account! Is there a way to avoid this (for example a reminder before the email is sent)?

    When I send an email with Mail, I often confuse the account which I'm using. The result is that I send a message with the wrong account! Is there a way to avoid this (for example a reminder before the email is sent)?

    Hi, thanks for the answer, I did that already. Unfortunatly this doesn't help me at all, as I often forget to check the menu. For me composing the message is writing the text, the subject, the person to who is addressed and than press "send".
    I often forget to check the "from", and this is a problem because the software select itself one of the accounts.
    Isn't there a way at least to put as a default a blank field instead of one of the accounts? or an account which doesn't work so if I forget to specify the "from" I will be rnotofied that the message can't be sent.
    I guess this could be a rather common problem for many people!
    Thanks
    Sergio

  • My macbook pro with OS 10.6.7 'mail' program does not send my mail through the IPS wireless, I am connected to. The message is my 'e-mail is rejected by the server'. It has been working until 5 days ago. The connection doctor says I am connected and no lo

    My macbook pro with OS 10.6.7 'mail' program does not send my mail through the IPS wireless, I am connected to. The message is my 'e-mail is rejected by the server'. It has been working until 5 days ago. The connection doctor says I am connected and no log in required.
    After trying lots I found now in 'Airport Utility is 'unable to detect any airport wireless devises.....'
    There is no provider to be seen in airport utility and only 'rescan' is an option with no results...
    even so I am connected and can browse the net receive mail etc. and the outgoing 'mail server' is set to the internet provider I am connected to.
    Can you enlighten me what can I do I need to use my e-mail program urgently !!!
    Thanks for your help

    I'm not sure what "IPS wireless" is, but unless you have an Apple Wi-Fi base station (such as a Time Capsule, AirPort Extreme, or AirPort Express), AirPort Utility won't see anything.
    You might try defining a new SMTP server to see if that will work any better.
    By the way, the subject field for these messages isn't intended to hold a lot of text.  Put a short description of your problem in the subject field and save the rest of your message for the body field.

  • Send a mail with change history while changing the Routing (T-Code CA02),

    Hi All,
    I need to send a mail with change history while changing the Routing (T-Code CA02), Please let me know how can implement this scenario.
    I am trying to find out any workflow is there for the same but we have workflow for Routing creating and Display, we donu2019t have workflow for change.
    Please suggest meu2026u2026u2026u2026
    Thanks,
    Amjad.

    Hi All,
    I need to send a mail with change history while changing the Routing (T-Code CA02), Please let me know how can implement this scenario.
    I am trying to find out any workflow is there for the same but we have workflow for Routing creating and Display, we donu2019t have workflow for change.
    Please suggest meu2026u2026u2026u2026
    Thanks,
    Amjad.

  • What is the best way to send auto mail with excel(generated by query) attachment?

    Hello,
    Need to generate first data from stored procedure and the save it to an excel file and then send mail with the same excel file.
    So am searching for the best way so that i could do all process in a single task with daily or monthly schedule.
    As per my understanding, we could it via SSIS and by sql server using
    sp_send_dbmail.
    But i have to generate excel file first by stored procedure and then end it by mail.
    So please suggest the best way to accomplish all task in a single task.
    Thanks
    Ajay 

    Hi Ajay,
    As shown in the blog mentioned by Syed, to delete records from the Excel file, you need to use Update OpenRowset command to update the corresponding rows to blank.
    Alternatively, you can also use Derived Column Transformation or Conditional Split Transformation after the OLE DB Source so that you can replace the target rows with NULL before exporting to Excel destination or just redirect the expected records to the
    Excel destination.
    Then, in the Control Flow, you can add a Send Mail Task to send the Excel file by setting it as the attachment. The following screenshot is for your reference:
    Regards,
    Mike Yin
    TechNet Community Support

  • TS3276 Hey. I have problems to send e-mail with Mail. The problems is I need to un active ssl ,... but when I do this,... automatically,. its active again????. Whta can i do

    Hey. I have problems to send e-mail with Mail. The problems is I need to un active ssl ,... but when I do this,... automatically,. its active again????. Whta can i do

    Try posting this in the 10.7 Mail forum. You'll get more help there.
    DALE

  • Send a mail to the vendor at the time of approval with the attachment of PO

    Hi all,
    I want to send a mail to the vendor at the time of approval by attaching the pdf of that particular PO.
    How can I achieve this?
    I know the User Exit where the code should be written.
    But I want the solution for attaching the PDF of PO at the time of approval.
    Please help me in this regard.
    Edited by: vinil kumar aturi on Mar 16, 2009 7:52 AM

    Hi,
    Try Following Code to Send mail as PDF Attachment
    In this
    Smart form Name : ZSMART_MM_003
    This will send mail to EMAIL ADDRESS SPECIFIED IN VENDOR MASTER FK03
    This code is written for ME23n so we used nast-objky(10) for purchase order no you may replace it with your purchase order no
    and smart form name with your smart form name
    *-- Send Mail---
    *-- Function Module Call to get Customer Address (Email)--
    DATA: VENDOR TYPE ELIFN,
          ADDRNO TYPE ADRNR.
    DATA: atab-mail TYPE STRING.
    SELECT SINGLE LIFNR FROM EKKO INTO VENDOR WHERE EBELN = nast-objky(10).
    SELECT SINGLE ADRNR FROM LFA1 INTO ADDRNO WHERE LIFNR = VENDOR.
    TYPE-POOLS: szadr.
    DATA adr_kompl TYPE szadr_addr1_complete.
    DATA adr1 TYPE szadr_addr1_line.
    DATA adtel TYPE szadr_adtel_line.
    DATA admail TYPE szadr_adsmtp_line.
    DATA adfax TYPE szadr_adfax_line.
    CALL FUNCTION 'ADDR_GET_COMPLETE'
           EXPORTING
                addrnumber              = ADDRNO
           IMPORTING
                addr1_complete          = adr_kompl
           EXCEPTIONS
                parameter_error         = 1
                address_not_exist       = 2
                internal_error          = 3
                wrong_access_to_archive = 4
                OTHERS                  = 5.
    Mail
      LOOP AT adr_kompl-adsmtp_tab INTO admail.
        MOVE admail-adsmtp-smtp_addr TO atab-mail.
      ENDLOOP.
    if sy-subrc = 0.
      DATA: FILENAME TYPE STRING.
      CONCATENATE 'PurchaseOrder' nast-objky INTO FILENAME SEPARATED BY '-'.
      DATA: MESSAGELINE1 TYPE STRING,
            MESSAGELINE2 TYPE STRING.
    CONCATENATE 'Do you want to send ' FILENAME ' through E-mail to' into MESSAGELINE1.
    CONCATENATE atab-mail '?' into MESSAGELINE2.
      data: answer    TYPE c.
      CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
           EXPORTING
                defaultoption = 'N'
                textline1     = MESSAGELINE1
                textline2     = MESSAGELINE2
                titel         = ' '
                start_column  = 35
                start_row     = 10
           IMPORTING
                answer        = answer.
      IF answer EQ 'J' OR answer EQ 'Y'.
    Code to find Contact person
        DATA: CONTACT TYPE EVERK.
        SELECT SINGLE VERKF FROM EKKO INTO CONTACT WHERE EBELN = nast-objky(10).
    Internal Table declarations
        DATA: I_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE,
              I_TLINE TYPE TABLE OF TLINE WITH HEADER LINE,
              I_RECEIVERS TYPE TABLE OF SOMLRECI1 WITH HEADER LINE,
              I_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
    Objects to send mail.
              I_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
              I_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
              I_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
              I_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
    Work Area declarations
              WA_OBJHEAD TYPE SOLI_TAB,
              W_CTRLOP TYPE SSFCTRLOP,
              W_COMPOP TYPE SSFCOMPOP,
              W_RETURN TYPE SSFCRESCL,
              WA_DOC_CHNG TYPE SODOCCHGI1,
              W_DATA TYPE SODOCCHGI1,
              WA_BUFFER TYPE STRING, "To convert from 132 to 255
    Variables declarations
              V_FORM_NAME TYPE RS38L_FNAM,
              V_LEN_IN LIKE SOOD-OBJLEN,
              V_LEN_OUT LIKE SOOD-OBJLEN,
              V_LEN_OUTN TYPE I,
              V_LINES_TXT TYPE I,
              V_LINES_BIN TYPE I.
              DATA :  s_control_parameters TYPE ssfctrlop,
                      s_output_options     TYPE ssfcompop.
                      s_control_parameters-getotf = 'X'.
                      s_control_parameters-no_dialog = 'X'.
                      s_control_parameters-preview   = 'X'.
                      s_output_options-tdnoprint = 'X'.
                      s_output_options-tdimmed   = ''.
                      s_output_options-tddest = 'LP01'.        "Spool: Output device
                      s_output_options-tdreceiver = sy-uname.
                      s_output_options-tdcover = ''.
             CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
             EXPORTING
                FORMNAME = 'ZSMART_MM_003'
             IMPORTING
               FM_NAME = V_FORM_NAME
             EXCEPTIONS
               NO_FORM = 1
               NO_FUNCTION_MODULE = 2
               OTHERS = 3.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
             W_CTRLOP-GETOTF = 'X'.
             W_CTRLOP-NO_DIALOG = 'X'.
             W_COMPOP-TDNOPREV = 'X'.
             CALL FUNCTION V_FORM_NAME
             EXPORTING
                CONTROL_PARAMETERS = s_control_parameters
                OUTPUT_OPTIONS = s_output_options
                USER_SETTINGS = ''
                nast          = nast
                WA_ADDRESS    = WA_ADDRESS
             IMPORTING
                JOB_OUTPUT_INFO = W_RETURN
             TABLES
                addtel  = it_addtel
                addsmtp = it_addsmtp
             EXCEPTIONS
                FORMATTING_ERROR = 1
                INTERNAL_ERROR = 2
                SEND_ERROR = 3
                USER_CANCELED = 4
                OTHERS = 5.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Convert SMartform to pdf
          I_OTF[] = W_RETURN-OTFDATA[].
          CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            FORMAT = 'PDF'
            MAX_LINEWIDTH = 132
          IMPORTING
            BIN_FILESIZE = V_LEN_IN
          TABLES
            OTF = I_OTF
            LINES = I_TLINE
          EXCEPTIONS
           ERR_MAX_LINEWIDTH = 1
           ERR_FORMAT = 2
           ERR_CONV_NOT_POSSIBLE = 3
           OTHERS = 4.
    IF SY-SUBRC <> 0.
    ENDIF.
          LOOP AT I_TLINE.
            TRANSLATE I_TLINE USING '~'.
            CONCATENATE WA_BUFFER I_TLINE INTO WA_BUFFER.
            ENDLOOP.
            TRANSLATE WA_BUFFER USING '~'.
            DO.
              I_RECORD = WA_BUFFER.
              APPEND I_RECORD.
              SHIFT WA_BUFFER LEFT BY 255 PLACES.
              IF WA_BUFFER IS INITIAL.
                EXIT.
                ENDIF.
                ENDDO.
    Attachment
                REFRESH: I_RECLIST,
                I_OBJTXT,
                I_OBJBIN,
                I_OBJPACK.
                CLEAR WA_OBJHEAD.
                I_OBJBIN[] = I_RECORD[].
    Create Message Body Title and Description
                I_OBJTXT = 'Sir, '.
                APPEND I_OBJTXT.
                I_OBJTXT = ''.
                APPEND I_OBJTXT.
                I_OBJTXT = 'Please Find Attached '.
                APPEND I_OBJTXT.
                I_OBJTXT = FILENAME.
                APPEND I_OBJTXT.
                I_OBJTXT = 'For your reference'.
                APPEND I_OBJTXT.
                I_OBJTXT = ''.
                APPEND I_OBJTXT.
                I_OBJTXT = 'Regards'.
                APPEND I_OBJTXT.
                I_OBJTXT = CONTACT.
                APPEND I_OBJTXT.
    *Mail Subject
                DESCRIBE TABLE I_OBJTXT LINES V_LINES_TXT.
                READ TABLE I_OBJTXT INDEX V_LINES_TXT.
                WA_DOC_CHNG-OBJ_NAME = 'Purchase Order'.
                WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
                WA_DOC_CHNG-OBJ_DESCR = 'Purchase Order'.
                WA_DOC_CHNG-SENSITIVTY = 'F'.
                WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
    Main Text
                CLEAR I_OBJPACK-TRANSF_BIN.
                I_OBJPACK-HEAD_START = 1.
                I_OBJPACK-HEAD_NUM = 0.
                I_OBJPACK-BODY_START = 1.
                I_OBJPACK-BODY_NUM = V_LINES_TXT.
                I_OBJPACK-DOC_TYPE = 'RAW'.
                APPEND I_OBJPACK.
    Attachment (pdf-Attachment)
                I_OBJPACK-TRANSF_BIN = 'X'.
                I_OBJPACK-HEAD_START = 1.
                I_OBJPACK-HEAD_NUM = 0.
                I_OBJPACK-BODY_START = 1.
                DESCRIBE TABLE I_OBJBIN LINES V_LINES_BIN.
                READ TABLE I_OBJBIN INDEX V_LINES_BIN.
                I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
                I_OBJPACK-BODY_NUM = V_LINES_BIN.
                I_OBJPACK-DOC_TYPE = 'PDF'.
                I_OBJPACK-OBJ_NAME = 'smart'.
                I_OBJPACK-OBJ_DESCR = FILENAME.
                APPEND I_OBJPACK.
                CLEAR I_RECLIST.
                I_RECLIST-RECEIVER = atab-mail.
                I_RECLIST-REC_TYPE = 'U'.
                APPEND I_RECLIST.
                CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
                EXPORTING
                  DOCUMENT_DATA = WA_DOC_CHNG
                  PUT_IN_OUTBOX = 'X'
                  COMMIT_WORK = 'X'
                TABLES
                    PACKING_LIST = I_OBJPACK
                    OBJECT_HEADER = WA_OBJHEAD
                    CONTENTS_BIN = I_OBJBIN
                    CONTENTS_TXT = I_OBJTXT
                    RECEIVERS = I_RECLIST
                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.
    IF SY-SUBRC <> 0.
    WRITE:/ 'Error When Sending the File', SY-SUBRC.
    ELSE.
    WRITE:/ 'Mail sent'.
    ENDIF.
    Regards
    Nausal

  • I re-send a mail with 3 pdf attachmets to an outlook account and the attachments do not arrive to the receiver, if the receiver is a Windows PC. If the receiver is an iPhone the attachments can be accessed til the moment Unload the full message is pushed

    I re-send a mail with 3 pdf attachmets to an outlook account and the attachments do not arrive to the receiver, if the receiver is a Windows PC. If the receiver is an iPhone the attachments can be accessed til the moment Unload the full message is pushed

    It is NOT legitimate. It is SPAM
    The latest Firefox release is 7.0.1 which you should update to by visiting http://www.mozilla.org/en-US/firefox/new/

  • How do I stop  my mail from send out my e-mails with the mobile me acct instead of my default provider?  I have checked the "use only this server" in my provider account.

    How do I stop  my mail from send out my e-mails with the mobile me acct instead of my default provider?  I have checked the "use only this server" in my provider account.

    There is no such option/setting on an iPhone to determine this. Whether you can view the attachment has more to do with your connection, WiFi or cellular, and the size of the attachment than anything else. There will be a paperclip indicating the message includes an attachment regardless if downloaded with the message or not. When connected to the cellular network, if an attachment is below a designated size the attachment will be downloaded automatically. If over a certain size, you must select the attached file icon in the body of the message to download the attachment. The size limit varies by carrier/provider.
    Tell her you're gonna leave her out of the Will if she doesn't stop .

  • Send a mail with attached file .xls but i got file without

    i tried to send a mail with attached file .xls. but i am able to send the file , we recived the file without file name. please do the same
    thnaks in advance.
    END-OF-SELECTION.
    Populate message body text
    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
    'Example .xls documnet attachment'
    'XLS'
    'filename'
    CHANGING GD_ERROR
    GD_RECIEVER.
    Instructs mail send program for SAPCONNECT to send email(rsconn01)
    PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
    *& Form DATA_RETRIEVAL
    Retrieve data form EKPO table and populate itab it_ekko
    FORM DATA_RETRIEVAL.
    SELECT EBELN EBELP AEDAT MATNR
    UP TO 10 ROWS
    FROM EKPO
    INTO TABLE IT_EKPO.
    ENDFORM. " DATA_RETRIEVAL
    *& Form BUILD_XLS_DATA_TABLE
    Build data table for .xls document
    FORM BUILD_XLS_DATA_TABLE.
    CONSTANTS: CON_CRET TYPE X VALUE '0D', "OK for non Unicode
    CON_TAB TYPE X VALUE '09'. "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    *constants:
    con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
    con_cret type c value cl_abap_char_utilities=>CR_LF.
    CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
    INTO IT_ATTACH SEPARATED BY ''.
    CONCATENATE '' IT_ATTACH INTO IT_ATTACH.
    APPEND IT_ATTACH.
    LOOP AT IT_EKPO INTO WA_CHAREKPO.
    CONCATENATE WA_CHAREKPO-EBELN WA_CHAREKPO-EBELP
    WA_CHAREKPO-AEDAT WA_CHAREKPO-MATNR
    INTO IT_ATTACH SEPARATED BY ''.
    CONCATENATE '' IT_ATTACH INTO IT_ATTACH.
    APPEND IT_ATTACH.
    ENDLOOP.
    ENDFORM. " BUILD_XLS_DATA_TABLE
    *& 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.
    Create attachment notification
    T_PACKING_LIST-TRANSF_BIN = 'X'.
    T_PACKING_LIST-HEAD_START = 1.
    T_PACKING_LIST-HEAD_NUM = 1.
    T_PACKING_LIST-BODY_START = 1.
    DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
    T_PACKING_LIST-DOC_TYPE = LD_FORMAT.
    T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.
    T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
    T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.
    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
    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.
    *& Form INITIATE_MAIL_EXECUTE_PROGRAM
    Instructs mail send program for SAPCONNECT to send email.
    FORM INITIATE_MAIL_EXECUTE_PROGRAM.
    WAIT UP TO 2 SECONDS.
    SUBMIT RSCONN01 WITH MODE = 'INT'
    WITH OUTPUT = 'X'
    AND RETURN.
    ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
    *& Form POPULATE_EMAIL_MESSAGE_BODY
    Populate message body text
    FORM POPULATE_EMAIL_MESSAGE_BODY.
    REFRESH IT_MESSAGE.
    IT_MESSAGE = 'Please find attached a list test ekpo records'.
    APPEND IT_MESSAGE.
    ENDFORM. " POPULATE_EMAIL_MESSAGE_BODY

    PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
      TABLES IT_MESSAGE
      IT_ATTACH
      USING P_EMAIL
      'Failed IDOC Analysis report'(020)
      'xls'(021)
      'IDOC_REP'(022)
      CHANGING GD_ERROR
      GD_RECIEVER.
    Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
    ENDFORM.                    " F_MAIL
    *& Form BUILD_XLS_DATA_TABLE
    Build data table for .xls document
    FORM BUILD_XLS_DATA_TABLE.
    *CONSTANTS: CON_CRET TYPE X VALUE '0D', "OK for non Unicode
    *CON_TAB TYPE X VALUE '09'. "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
      constants:
       con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
       con_cret type c value cl_abap_char_utilities=>CR_LF.
      CONCATENATE text-040 text-041 text-042 text-043 text-044 text-045 text-046 text-047 text-048 text-049
      INTO IT_ATTACH SEPARATED BY con_tab.
      CONCATENATE con_cret IT_ATTACH INTO IT_ATTACH.
      APPEND IT_ATTACH.
      clear IT_ATTACH.
      loop at i_final_t into w_final.
        CONCATENATE
        w_final-mestyp w_final-docnum  w_final-statxt w_final-msgno w_final-rvplant w_final-kunnr w_final-vbeln w_final-credat
                w_final-cretim w_final-flag INTO IT_ATTACH SEPARATED BY con_tab.
        CONCATENATE con_cret IT_ATTACH INTO IT_ATTACH.
        APPEND IT_ATTACH.
        clear IT_attach.
      endloop.
    ENDFORM. " BUILD_XLS_DATA_TABLE
    *& 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.
    Create attachment notification
      T_PACKING_LIST-TRANSF_BIN = 'X'.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM = 1.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE = LD_FORMAT.
      T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.
      T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
      T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.
      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
          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.
      SUBMIT RSCONN01 WITH MODE = 'INT'
      WITH OUTPUT = 'X'
      AND RETURN.
    ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
    *& Form POPULATE_EMAIL_MESSAGE_BODY
    Populate message body text
    FORM POPULATE_EMAIL_MESSAGE_BODY.
      data: l1(99)    type c,
             l2(15)    type c,
             lt_message         type standard table of solisti1,
             ls_message      like line of lt_message.
      clear ls_message.
      l1 = 'Dear'(007).
      l2 =  'Sir/Madam'(008).
      concatenate l1 l2 ',' into
      ls_message-line separated by space.
      append ls_message to lt_message.
    *insert Blank Line
      clear ls_message.
      ls_message-line = space.
      append ls_message to lt_message.
    *Assign Message text
      clear ls_message.
      concatenate text-011
                  text-012
                  into ls_message-line separated by space.
      append ls_message to lt_message.
    *insert Blank Line
      clear ls_message.
      ls_message-line = space.
      append ls_message to lt_message.
    *Assign Message text
      clear ls_message.
      concatenate text-013
                  text-014
                  text-015
                  into ls_message-line separated by space.
      append ls_message to lt_message.
      concatenate text-016
                  text-017
                  into ls_message-line separated by space.
      append ls_message to lt_message.
    *insert Blank Line
      clear ls_message.
      ls_message-line = space.
      append ls_message to lt_message.
      ls_message-line = text-018.
      append ls_message to lt_message.
      ls_message-line = text-019.
      append ls_message to lt_message.
      clear: ls_message.
      REFRESH IT_MESSAGE.
      it_message[] = lt_message[].
      APPEND IT_MESSAGE.
    ENDFORM. " POPULATE_EMAIL_MESSAGE_BODY

  • How to send a mail with attaching a report

    hi gurus,
        my requirment is i have to send a mail with attaching the report of a program to the client.. is it possible? help me with sample code.
    Thanks in advance.
    Regards,
    Indira D

    Hi Indira,
    plz check out this code below,
    *& Report  ZATTACH                                               *
    REPORT  ZATTACH                   .
    TABLES: ekko.
    PARAMETERS: p_email   TYPE somlreci1-receiver
                                      DEFAULT '[email protected]'.
    TYPES: BEGIN OF t_ekpo,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
    END OF t_ekpo.
    DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
          wa_ekpo TYPE t_ekpo.
    TYPES: BEGIN OF t_charekpo,
      ebeln(10) TYPE c,
      ebelp(5)  TYPE c,
      aedat(8)  TYPE c,
      matnr(18) TYPE c,
    END OF t_charekpo.
    DATA: wa_charekpo TYPE t_charekpo.
    DATA:   it_message 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:   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
    START-OF-SELECTION.
      Retrieve sample data from table ekpo
      PERFORM data_retrieval.
      Populate table with detaisl to be entered into .xls file
      PERFORM build_xls_data_table.
    *END-OF-SELECTION
    END-OF-SELECTION.
    Populate message body text
      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
                                          'Example .xls documnet attachment'
                                          'XLS'
                                          'filename'
                                 changing gd_error
                                          gd_reciever.
      Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM initiate_mail_execute_program.
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp aedat matnr
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekpo.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  BUILD_XLS_DATA_TABLE
          Build data table for .xls document
    FORM build_xls_data_table.
      CONSTANTS: con_cret TYPE x VALUE '0D',  "OK for non Unicode
                 con_tab TYPE x VALUE '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    *constants:
       con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
       con_cret type c value cl_abap_char_utilities=>CR_LF.
      CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
             INTO it_attach SEPARATED BY con_tab.
      CONCATENATE con_cret it_attach  INTO it_attach.
      APPEND  it_attach.
      LOOP AT it_ekpo INTO wa_charekpo.
        CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
                    wa_charekpo-aedat wa_charekpo-matnr
               INTO it_attach SEPARATED BY con_tab.
        CONCATENATE con_cret it_attach  INTO it_attach.
        APPEND  it_attach.
      ENDLOOP.
    ENDFORM.                    " BUILD_XLS_DATA_TABLE
    *&      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.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      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
                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.
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    FORM initiate_mail_execute_program.
      WAIT UP TO 2 SECONDS.
      SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    *&      Form  POPULATE_EMAIL_MESSAGE_BODY
           Populate message body text
    form populate_email_message_body.
      REFRESH it_message.
      it_message = 'Please find attached a list test ekpo records'.
      APPEND it_message.
    endform.
    " POPULATE_EMAIL_MESSAGE_BODY
    <b>
    Reward points if this helps,</b>
    Kiran

  • Send a mail with a picture from mime repository

    Hello,
    I want to send a mail with a picture from mime repository.
    The mail is sended OK, but the receiver hasn't  the picture on the mail  (don't find the picture).
    Here is my syntax :
       st_objtxt-line = '<IMG SRC="SAPR3://005056B2002D1EE3BF8F5B5ECDCA55E1" ALIGN=RIGHT WIDTH="100" HEIGHT="80">'.
        append st_objtxt to t_objtxt.
    "SAPR3://005056B2002D1EE3BF8F5B5ECDCA55E1" is url of my object mime .
    Have you a idea to resolve this problem ? It's the syntax OK ?
    Thank for your responses.
    Regards.
    JCAIL

    Have you tried storing your picture as a business document?  Have a look at the class  cl_bds_document_set to read your picture from the BDS.

Maybe you are looking for

  • Why does replying to a sent email put my name in the To: field?

    It should work GMail style, where replying to an email that I've sent puts the receipients emails in the To: field, not my own.

  • French punctuation in Pages

    I wonder if anyone has seen the following problem already: I just purchased Pages. I need to edit documents written in French. In French, quotation marks are not "" but two arrows, sort of like << and >>. Plus, there is a space after the open quote m

  • Os 10.9 seems to be taking a long time to download, is that normal?

    I'm downloading OS 10.9 and it seems to be taking a very long time, nothing tells me that anything is happening. Is this how it works?

  • IPad 2 Personal Hotspot Limitation

    Any reason even a iPhone 3GS can do Personal Hotspot, while a much more powerful iPad 2 can't? What changes made into the new iPad that allows this? Looks to me like artifical limitation from Apple, but would love someone else to show me the real iss

  • How do I open my CS4 files in Dreamweaver CS6

    I just purchased the CS6 in the cloud and downloaded Dreamweaver.  I assumed that CS6 would see all my Dreamweaver files but it doesn't!  There are no files to open when I open CS6.  How do I get CS6 to recognize all my DW CS4 files and open them?