Problem sending xls file in an attachment via ABAP proxy

Hello,
I have in tmp directory a xls file, I tranfer such file to a table, and afterwards I send in an attachment via ABAP proxy, here is the code:
     l_attachment        TYPE REF TO if_ai_attachment,
        lt_attach           TYPE prx_attach,
        l_name              TYPE string,
        lx_string           TYPE xstring,
        l_string            TYPE string,
        l_type              TYPE string,
        des                 TYPE string.
  CLASS cl_ai_factory DEFINITION LOAD.
  DATA:    BEGIN OF itab OCCURS 0,
           raw(255) TYPE x,
         END OF itab.
  DATA: l_controller TYPE REF TO if_ai_posting_controller.
  DATA: it TYPE zhcm_mt_segur_out.
  CREATE OBJECT prxy.
  OPEN DATASET orig FOR INPUT IN binary MODE.
  READ DATASET orig INTO itab-raw.
  WHILE sy-subrc = 0.
    APPEND itab.
    READ DATASET orig INTO itab-raw.
  ENDWHILE.
  CLOSE DATASET orig.
  LOOP AT itab.
    CONCATENATE lx_string itab-raw INTO lx_string in byte mode.
  ENDLOOP.
  L_NAME = 'Segur.xls'.
  L_TYPE = CL_AI_ATTACHMENT=>IF_AI_ATTACHMENT~C_MIMETYPE_EXCEL.
  TRY.
      L_ATTACHMENT =
        CL_AI_FACTORY=>CREATE_ATTACHMENT_FROM_binary(
                  P_DATA = LX_STRING
                  P_TYPE = L_TYPE
                  P_NAME = L_NAME ).
      APPEND L_ATTACHMENT TO LT_ATTACH.
      L_CONTROLLER = CL_AI_FACTORY=>CREATE_CONTROLLER( ).
      L_CONTROLLER->SET_ATTACHMENTS( LT_ATTACH ).
      CALL METHOD PRXY->EXECUTE_ASYNCHRONOUS
        EXPORTING
          CONTROLLER = L_CONTROLLER
          OUTPUT     = IT.
      COMMIT WORK.
    CATCH CX_AI_SYSTEM_FAULT .
      DATA FAULT TYPE REF TO CX_AI_SYSTEM_FAULT .
      CREATE OBJECT FAULT.
      WRITE :/ FAULT->ERRORTEXT.
  ENDTRY.
I am using a Mail receiver channel, I receive a mail, with to attachments, one .xml and the other one .bin, I save it to my computer and I change the extension to .xls and when I try to open it, the file is not valid and can be opened after being repaired. What Im doing wrong? I would like to receive a valid xls file, what i should change?
Thanks a lot,
Luis

Hi,
yes I know, I have used the MessageTransformBean module, and the PayloadSwapBean module. But which parameter I should use for leaving only one attachement in the e-mail. I did this configuration:
1
localejbs/AF_Modules/MessageTransformBean
Local Enterprise Bean
<b>trans</b>
2
localejbs/AF_Modules/PayloadSwapBean
Local Enterprise Bean
<b>swap</b>
3
localejbs/AF_Modules/MessageTransformBean
Local Enterprise Bean
<b>trans1</b>
4
localejbs/sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean
Local Enterprise Bean
mail
<i><b>Module configuration</b></i>
trans
Transform.ContentDisposition
inline
swap
swap.keyName
payload-name
swap
swap.keyValue
Segur
trans1
Transform.ContentDescription
Segur
trans1
Transform.ContentDisposition
attachment;filename="Segur.xls"
trans1
Transform.ContentType
application/vnd.ms-excel;name="Segur.xls"
In the e-mail I get one attachement without name .xml and another one Segur.xsl, and I want only one attachment, the last one. What I should change in my configuration??
Best regards,
Luis

Similar Messages

  • How do I scan a photo to a file and then send the file as an attachment via email.

    How do I scan a photo to a file and then send the file as an attachment  via email.

    All of this depends largely on what printer /software you have, which Email client you use and to some extent which OS you are running.
    Most HP printers have HP Solution Center which is used to set up scanning,choosing where to save,etc. Once a file/photo is scanned and saved to the folder, open the folder.Select the file and at the top of the window should be the option to 'Email'.
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

  • File to R/3 via Abap proxy -- need help

    Hello,
    I have made a scenario File to R/3 via Abap Proxy
    My Inbound Async Message Interface has Message Type -Emp_Rac_Detail_MT.
    Message Type has structure
    EmpID
    EmpName
    Age
    I have table in R/3 ZRACTABLE where I need to post data
    Fields in ZRACTABLE are
    EMPID
    EMPNAME
    AGE1
    Pls send me the code that I need to write in Async Method of Proxy
    that will put data
    Regards

    Hi Herry,
    First of all u have to write a Function module in R/3 ....for that i given u the code above.
    Now in ur inbount proxy in the implementation class u have to write code right???
    Here is the code...
    **** INSERT IMPLEMENTATION HERE **** ***
    DATA:
    lv_EMPID type EMPID,
    lv_EMPNAME type EMPNAME,
    lv_AGE type AGE.
    Convert Input Parameters
    lv_EMPID        =  input-Emp_Rac_Detail_MT-EMPID.
    lv_EMPNAME      =  input-Emp_Rac_Detail_MT-EMPNAME.
    lv_AGE          =  input-Emp_Rac_Detail_MT-AGE.
    call function 'ZEMP_RAC_FM'             /** thats ur function module name **/
        EXPORTING
        EMPID       =  lv_EMPID .
        EMPNAME     =  lv_EMPNAME.
        AGE         =  lv_AGE.
    endmethod.
    Regards
    biplab
    <i>*** give points if it hepls you!!!</i>

  • Attachments via ABAP Proxy

    I have come across one client requirment where he needs to send the txt/pdf file as an attachment from R/3, currently that interface is using the ABAP Proxy, is there any idea about How to send the attachments via ABAP Proxy?

    Hi,
    Refer
    XI: RFC or ABAP Proxy ? ....ABAP Proxies with attachments
    /people/michal.krawczyk2/blog/2006/04/19/xi-rfc-or-abap-proxy-abap-proxies-with-attachments
    Problem sending xls file in an attachment via ABAP proxy
    Receive mail with PDF attachment into XI and send to ABAP proxy
    http://help.sap.com/saphelp_nw70/helpdata/en/51/d5cd16235e4643ae8ec92395c4ad97/frameset.htm
    Thanks
    Swarup

  • Push data from BW 3.5 to XI 3.0 via ABAP proxy

    Hi,
      I have the following scenario: I´m in BW 3.5 trying to send data to XI 3.0 via ABAP proxy. I´ve already found a "How-to" to do build this scenario, but something does not work. I think that problem is when a try do the logon from BW to XI because I got the message "logon data not provided" on http service in XI. I´ve already configure an RFC Destination(SM59) as R/3 connection(type 3) and another as HTTP connection to R/3(type H) and both are correct. Someone knows where I configure the user/pass to logon from BW Intergration Server to XI Integration Server?
    Regards,
    Rafael Soares

    Hello fellows!
       I discovered that my problem was configuration on SXMB_ADM transaction.
       Thank you very much for your help!
    Best regards.
    Rafael

  • I have an iPad 2, and I am sending PDF file to my iPad, via a Hotmail email. But, the PDF arrives to the iPad in Mail already opended, as a picture on the bottom of the email. Is there a way to prevent it from auto open, so I can open with iBooks instead?

    I have an iPad 2, and I am sending PDF files to my iPad, via a Hotmail account. But, the PDF arrives to the iPad Mail account already opened at the bottom of the email. Is there a way to prevent this auto-opening of the PDF. I've seen screen shots with the box, and PDF listed inside the box, but mine open automatically. I want to get them into iBooks...?

    I am having the same problem and it is even bigger.
    When opening a 1-page PDF in iBooks and sending it via mail it is sent inline as preview, but the recipient cannot open the file anymore. Also on iPad and iPhone there is no "open in" possible.
    Somehow the mail app does destroy the file. What is going wrong?

  • How to send a file as an attachment using mailx

    Hi
    Can any one tel me how to send a file as an attachment using mailx command in shell script.
    Thanks,
    Suman.

    Wrong forum where to ask such questions.
    Check this one link:
    http://www.unix.com/shell-programming-scripting/18370-sending-email-text-attachment-using-mailx.html?t=18370#post70254

  • Handle attachements   in abap proxy

    the like lets about sending the message as an attachment, can u help me out, after receiving an attachment in abap proxy, what are steps need to be done in abap proxy.
    is there necessary that the receiver transport protocol should be HTTPS 1.0

    Hi,
    [SAP Help Proxy Programming: Attachments|http://help.sap.com/saphelp_nw2004s/helpdata/en/a7/3b2a2d45a34a23b75e3b18745c63bc/content.htm]
    Regards,
    Udo

  • Problem in sending .doc file as an attachment.!

    Hi SDN,
    I am using FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' to send a .doc file as an attachment i am filling the the table contents_hex with my internal table containing the data in hex format but the attachment coming to the SAP office inbox is not showing the actual data it's showing the file with all hex values.
    can any one tell the reason?
    Please give sample code if possible for sending a word file as an attachment..
    Regards,
    Rahul

    Hi Rahul,
    I am sending you the sample code I have written for TXT.
    you can use the same code for .doc with small modification.
    You use this code and check once and let me know.
    Sample code:
    Declaration:
    DATA : w_name TYPE sos04-l_adr_name.
    DATA: sent_to_all  LIKE  sonv-flag.
    DATA:
      l_datum(10),
      ls_docdata TYPE sodocchgi1,
      lt_objpack TYPE TABLE OF sopcklsti1 WITH HEADER LINE,
      lt_objhead TYPE TABLE OF solisti1 WITH HEADER LINE,
      lt_objtxt TYPE TABLE OF solisti1 WITH HEADER LINE,
      lt_objbin TYPE TABLE OF solisti1 WITH HEADER LINE,
      lt_reclist TYPE TABLE OF somlreci1 WITH HEADER LINE,
      lt_listobject TYPE TABLE OF abaplist WITH HEADER LINE,
      l_tab_lines TYPE i,
      l_tab_lines1 TYPE i,
      l_tab_lines2 TYPE i,
      l_att_type LIKE soodk-objtp.
    CONSTANTS : c_tab TYPE x VALUE '09'.     "tab delimiter between records.
    CONSTANTS : c_line(2) TYPE x VALUE '0D'.
    CONSTANTS : l_newline(2) TYPE x VALUE '0D0A'.        "To insert Newline.
    DATA: v_str LIKE lt_objbin.
    *Program logic
    Main Text
      lt_objtxt = 'Dummy heading. ' .
        APPEND lt_objtxt.
        lt_objtxt = '' .
        APPEND lt_objtxt.
    lt_objtxt = 'Dummy second line.'.
        APPEND lt_objtxt.
        lt_objtxt = '' .
        APPEND lt_objtxt.
        lt_objtxt = 'Regards,'.
         APPEND lt_objtxt.
        lt_objtxt = 'Field Service Team' .
        APPEND lt_objtxt.
        lt_objtxt = '----
        APPEND lt_objtxt.
    lt_objtxt = 'This is system-generated email;please do not reply to this
    message.'  .
        APPEND lt_objtxt.
    lt_objtxt = 'If there are any questions regarding this error message'.
        APPEND lt_objtxt.
    lt_objtxt = '----
        APPEND lt_objtxt.
    Write Packing List (Main)
        DESCRIBE TABLE lt_objtxt LINES l_tab_lines.
        READ TABLE lt_objtxt INDEX l_tab_lines.
      ls_docdata-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
        CLEAR lt_objpack-transf_bin.
        lt_objpack-head_start = 1.
        lt_objpack-head_num = 0.
        lt_objpack-body_start = 1.
        lt_objpack-body_num = l_tab_lines.
        lt_objpack-doc_type = 'RAW'.
        APPEND lt_objpack.
    Create Message Attachment   "Attachmant of  file
        LOOP AT itab1.
          CONCATENATE itab1-bldat itab1-blart itab1-bukrs itab1-budat
                      itab1-monat itab1-waers itab1-xblnr itab1-bktxt
                       INTO lt_objbin SEPARATED BY c_tab .
          CONCATENATE  l_newline lt_objbin INTO lt_objbin.
          APPEND lt_objbin.
          CLEAR lt_objbin.
        ENDLOOP.
    Write Packing List (Attachment)
        l_att_type = 'txt'.
        DESCRIBE TABLE lt_objbin LINES l_tab_lines.
        READ TABLE lt_objbin INDEX l_tab_lines.
        lt_objpack-doc_size = ( l_tab_lines - 1 ) * 255
                                        + STRLEN( lt_objbin ).
        lt_objpack-transf_bin = 'X'.
        lt_objpack-head_start = 1.
        lt_objpack-head_num = 0.
        lt_objpack-body_start = 1.
        lt_objpack-body_num = l_tab_lines.
        lt_objpack-doc_type = l_att_type.
        lt_objpack-obj_name = 'Header file name'.
        lt_objpack-obj_descr = 'Header file name'.
        APPEND lt_objpack.
    *refresh bdclm.     "Attachemnt of second file
       CLEAR lt_objbin.
        LOOP AT bdclm.
          CONCATENATE itab2-indate itab2-intime itab2-tcode
                      itab2-longtext
                      INTO lt_objbin SEPARATED BY c_tab.
          CONCATENATE  l_newline lt_objbin INTO lt_objbin.
          APPEND lt_objbin.
          CLEAR lt_objbin.
        ENDLOOP.
        CLEAR lt_objbin.
    Write Packing List (Attachment)
        l_att_type = 'txt'.
        DESCRIBE TABLE lt_objbin LINES l_tab_lines1.
        l_tab_lines2 = l_tab_lines1 - l_tab_lines.
        READ TABLE lt_objbin INDEX l_tab_lines2.
    lt_objpack-doc_size = ( l_tab_lines2 - 1 ) * 255 + STRLEN( lt_objbin ).
        lt_objpack-transf_bin = 'X'.
        lt_objpack-head_start = l_tab_lines2.
        lt_objpack-head_num = 0.
        lt_objpack-body_start = l_tab_lines + 1.
        lt_objpack-body_num = l_tab_lines2.
        lt_objpack-doc_type = l_att_type.
        lt_objpack-obj_name = 'file name '.
        lt_objpack-obj_descr = 'file name '.
        APPEND lt_objpack.
    Create receiver list
        lt_reclist-receiver = '[email protected]'.
        lt_reclist-rec_type = 'U'.
        APPEND lt_reclist.
    Send Message
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
             EXPORTING
                document_data = ls_docdata
                put_in_outbox = 'X'
                 commit_work = 'X '
    *put_in_outbox = ''
            IMPORTING
                sent_to_all = sent_to_all
    VALUE(NEW_OBJECT_ID) LIKE  SOFOLENTI1-OBJECT_ID
             TABLES
                 packing_list = lt_objpack
                 object_header = lt_objhead
                 contents_bin = lt_objbin
                 contents_txt = lt_objtxt
                 receivers = lt_reclist
    *COMMIT_WORK = X
             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.
    Thanks,
    Yuvaraj

  • Problem in sending the file as an attachment through mail

    Hi,
    I have developed a Zreport. The functionality is like on executing this report it should send an e-mail with an attachment of the data in the xcel format.
    So, while execting this report in background mode in ECC 5.0, it is able to send the mail as an attachment but the file doesn't contain the data in it But, the same report while trying to execute in back ground mode in ECC 6.0, it is able to send the mail with the attachment and the file also has the data.
    So, my question is like are there any patches that has to be installed in ECC 5.0 system to get this successfully done.
    Thanks in advance for your answers.
    Rohith

    Hello,
    Are you using the standad sap function module or using OLE objects to generate excel?
    First try creating the excel file in foreground and see if the data is being populated.
    Kind Regards,
    Niky.

  • To send TXT file as an attachment  through Email

    Hi Experts,
    I am working on requirement where i have to send a txt file as an attachment.
    Could any one suggest me a solution.
    Thanks and Regards,
    Jeswanth Kadali

    Hi,
    Use the function module SO_NEW_DOCUMENT_ATT_SEND_API1.
    We find it convenient to use a custom function module as a wrapper for that.
    Here's the code.
    FUNCTION Z_EMAILS_ATTACH.
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(EMAIL_SUBJECT) LIKE  SODOCCHGI1-OBJ_DESCR
    *"     VALUE(ATTACHMENT_SUBJECT) LIKE  SOPCKLSTI1-OBJ_DESCR OPTIONAL
    *"     VALUE(ATTACHMENT_DOC_TYPE) TYPE  SO_OBJ_TP OPTIONAL
    *"     REFERENCE(ATTACHMENT_HEADER) LIKE  SOLISTI1 STRUCTURE  SOLISTI1
    *"  TABLES
    *"      EMAIL_BODY STRUCTURE  SOLISTI1
    *"      EMAIL_ATTACHMENT STRUCTURE  SOLISTI1 OPTIONAL
    *"      RECEIVERS STRUCTURE  SOMLRECI1
    *"  EXCEPTIONS
    *"      UNKNOWN_COMMUNICATION_TYPE
    *"      ERROR_SENDING_MAIL
    *"      EMPTY_ATTACHMENT
    *"      NO_ATTACHMENT_SUBJECT
    *"      USER_HAS_NO_EMAIL_ADDRESS
    *"      NO_RECEIVERS
    NOTE
    Single-testing when the tables passed to the function have reference
    structure SOLISTI1 meets with a problem.
    Entering non-blank rows into these tables is impossible, it seems.
    This is believed to be because the single testing fails to cope with
    the width of SOLISTI1-LINE [255 char].
    For single testing, use CVDTLINE as the reference structure - it's
    only 132 char.  Then remember to change it back to SOLISTI1...
    Based on Z_EMAIL_ATTACH which sends just one mail.
    08.06.2007  JNM
    DATA: document LIKE sodocchgi1.
    DATA: packlist LIKE sopcklsti1     OCCURS 0 WITH HEADER LINE.
    DATA: contents LIKE solisti1       OCCURS 0 WITH HEADER LINE.
    DATA: header   LIKE solisti1       OCCURS 0 WITH HEADER LINE.
    DATA: RECVLIST LIKE SOMLRECI1      OCCURS 0 WITH HEADER LINE.
    DATA: NEXT_ROW LIKE SY-TABIX.
    DATA: lines    LIKE sy-tabix.
    DATA: LAST_LINE_LENGTH TYPE I.
    DATA: d_doc_size LIKE packlist-doc_size.
    data: email_address type ad_smtpadr.
    A user without an email address cannot email.
    CALL FUNCTION 'Z_USER_EMAIL_ADDRESS'
      EXPORTING
        USER_NAME              = SY-UNAME
      IMPORTING
        EMAIL_ADDRESS          = email_address
      EXCEPTIONS
        UNKNOWN_USER           = 1
        NO_ADDRESS_KEY         = 2
        NO_ADDRESS_DATA        = 3
        NO_EMAIL_ADDRESS       = 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
              raising USER_HAS_NO_EMAIL_ADDRESS.
      ENDIF.
    Receivers?
    describe table receivers lines lines.
    if lines eq 0.
      raise no_receivers.
      endif.
    initialization
    CLEAR: CONTENTS, DOCUMENT, HEADER, PACKLIST, RECVLIST.
    REFRESH: CONTENTS, HEADER, PACKLIST, RECVLIST.
    attachment?
    DESCRIBE TABLE EMAIL_ATTACHMENT LINES LINES.
    IF LINES EQ 0 AND ATTACHMENT_SUBJECT CN SPACE.
      RAISE EMPTY_ATTACHMENT.
      ENDIF.
    IF LINES NE 0 AND ATTACHMENT_SUBJECT CO SPACE.
      RAISE NO_ATTACHMENT_SUBJECT.
      ENDIF.
    email body
    concatenate 'SAP client:'
      sy-host sy-sysid sy-mandt
      into contents separated by space.
    append contents.
    clear contents.
    append contents.
    APPEND LINES OF EMAIL_BODY TO CONTENTS.
    header - row for body
    HEADER = 'BODY HEADER'.
    APPEND HEADER.
    packing list - row for body
    PACKLIST-TRANSF_BIN = SPACE.
    PACKLIST-HEAD_START = 1.
    PACKLIST-HEAD_NUM = 1.
    PACKLIST-BODY_START = 1.
    DESCRIBE TABLE CONTENTS LINES PACKLIST-BODY_NUM.
    NEXT_ROW = 1 + PACKLIST-BODY_NUM.
    *packlist-doc_type = 'EXT'.
    PACKLIST-DOC_TYPE = 'RAW'.
    APPEND PACKLIST.
    IF ATTACHMENT_SUBJECT CN SPACE. " if there's an attachment
    attachment into contents
      APPEND LINES OF EMAIL_ATTACHMENT TO CONTENTS.
      DESCRIBE TABLE EMAIL_ATTACHMENT LINES LINES.
      READ TABLE EMAIL_ATTACHMENT INDEX LINES.
      LAST_LINE_LENGTH = STRLEN( EMAIL_ATTACHMENT ).
    header - attachment
      if attachment_header is initial.
        HEADER = 'ATTACH'.
      else.
        header = attachment_header.
        endif.
      APPEND HEADER.
    packing list - row for attachment
      CLEAR PACKLIST.
      case attachment_doc_type.
       when 'XLS'.
         PACKLIST-TRANSF_BIN = 'X'.
        when others.
          PACKLIST-TRANSF_BIN = SPACE.
        endcase.
      PACKLIST-HEAD_START = 2.
      PACKLIST-HEAD_NUM   = 1.
      PACKLIST-BODY_START = NEXT_ROW.
      if not attachment_doc_type is initial.
        packlist-doc_type   = attachment_doc_type.
      else.
        PACKLIST-DOC_TYPE   = 'RAW'.
        endif.
    packlist-doc_type   = 'EXT'.
      PACKLIST-OBJ_DESCR  = ATTACHMENT_SUBJECT.
      PACKLIST-OBJ_NAME   = 'ATTACHMENT'.
      PACKLIST-BODY_NUM   = LINES.
      D_DOC_SIZE = LAST_LINE_LENGTH + ( 255 * ( LINES - 1 ) ).
      PACKLIST-DOC_SIZE   = D_DOC_SIZE.
      APPEND PACKLIST.
      ENDIF. "attachment
    document
    document-obj_name = 'EMAIL'.
    DOCUMENT-OBJ_DESCR = EMAIL_SUBJECT.
    document-obj_langu = sy-langu.
    document-obj_expdat = sy-datum.
    document-sensitivty = 'F'.
    document-obj_prio = 9.
    document-no_change = 'X'.
    document-priority = 9.
    document-expiry_dat = sy-datum.
    ADD 1 TO: DOCUMENT-OBJ_EXPDAT, DOCUMENT-EXPIRY_DAT.
    DESCRIBE TABLE contents LINES lines.
    D_DOC_SIZE = LAST_LINE_LENGTH + ( 255 * ( LINES - 1 ) ).
    document-doc_size = d_doc_size.
    call the mail function
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
         EXPORTING
              document_data              = document
            put_in_outbox              = 'X'
              commit_work                = 'X'
         TABLES
              object_header              = header
              packing_list               = packlist
              contents_txt               = contents
              receivers                  = 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.
    IF SY-SUBRC > 0.
      RAISE ERROR_SENDING_MAIL.
      ENDIF.
    ENDFUNCTION.
    Also remember that the SAP user sending the email must have an email address in the user details, so that SAP has something to put in the "From" field when creating the email.
    That's why we use this:
    FUNCTION Z_USER_EMAIL_ADDRESS.
    ""Local interface:
    *"  IMPORTING
    *"     REFERENCE(USER_NAME) TYPE  SYUNAME DEFAULT SY-UNAME
    *"  EXPORTING
    *"     REFERENCE(EMAIL_ADDRESS) TYPE  AD_SMTPADR
    *"  EXCEPTIONS
    *"      UNKNOWN_USER
    *"      NO_ADDRESS_KEY
    *"      NO_ADDRESS_DATA
    *"      NO_EMAIL_ADDRESS
    tables:
      adr6,
      usr21,
      usr02.
    SAP logon data
    select single *
      from usr02
      where bname = user_name.
    if sy-subrc ne 0.
      message i017(ZREP) with
        'SAP user' user_name 'is unknown'
        raising unknown_user.
      endif.
    SAP user address key
    select single *
      from usr21
      where bname = user_name.
    if sy-subrc ne 0.
      message i017(ZREP) with
        'No address data assigned to SAP user' user_name
        raising no_address_key.
      endif.
    SAP user address
    select single *
      from adr6
      where addrnumber = usr21-addrnumber and
            persnumber = usr21-persnumber.
    if sy-subrc ne 0.
      message i017(ZREP) with
        'No address data found for SAP user' user_name
        raising no_address_data.
      endif.
    email_address = adr6-smtp_addr.
    if email_address is initial.
      message i017(ZREP) with
        'No address data found for SAP user' user_name
        raising no_email_address.
      endif.
    ENDFUNCTION.
    John

  • How to send PDF file as an attachment in email?

    Hi Folks,
    I have successfully configured SMTP and by now I can successfully send normal text messages along with .TXT files. However, when I am trying to send an email along with .pdf file as an attachment, I am getting the mail in my inbox, but I cannot open the .pdf file! I am getting the following Acrobat error:
    Acrobat could not open 'abc.pdf' because it is either not a supported file type or because the file has been corrupted
    Can any help me in solving this problem?
    Thanks in advance
    Regards,
    Faisal

    Hi Vajha,
    Thanks alot for your kind reply. I also express my apologies for responding to your reply lately.
    I beleive all the links you have sent me are talking about ABAP coding. what I am interested in is,
    is there any configuration that I am missing in SCOT (Basis side)?
    Since I am not an ABAPER, so I carry out these activities.
    Can anyone please answer the following queries of mine:
    1. Can't we send any PDF attachment in a mail from R/3?
    2. Do we have to do it through coding only?
    3. In scot we have option "All formats except fllw". But it does not work for me. Any inputs?
    Thanks in advance.
    Regards,
    Faisal

  • Send text file as an attachment

    Hi All,
    We have a requirement wherein we need to send the contents of an
    internal table in a text pipe delimited file as an attachment in to an
    external mail id.
    The problem is that the total record length of the internal table is
    around 450 char while the structure SOLI accepts only 255 char.
    This causes the record to be split into 2 lines.
    Is it possible to send the entire 450 char in one line? If yes, how can
    this be done?
    Thanks,
    fractal

    I think u shd use this FM for line width change:-
    CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
       EXPORTING
         LINE_WIDTH_SRC                    = 134 "ur source width
         LINE_WIDTH_DST                    = 255
        TRANSFER_BIN                      = ' '
        TABLES
          CONTENT_IN                        = GT_PDF  "ur itab name
          CONTENT_OUT                       = LT_ATT
      EXCEPTIONS
        ERR_LINE_WIDTH_SRC_TOO_LONG       = 1
        ERR_LINE_WIDTH_DST_TOO_LONG       = 2
        ERR_CONV_FAILED                   = 3
        OTHERS                            = 4

  • Sending excel file as an attachment  in email program thru Oracle8i

    I cant send my excel file as an attachment in my email program thru Oracle 8i.
    My excel file i located in my local pc C:\test.xls
    Everything is in my local machine, DB and progams.
    I have read the example of DEMO_MAIL program i am hardly understand it.
    My sample program:
    if (p_file_name is not null) then
    begin_attachment( p_mime_type=>'application/excel',               p_fname=>p_file_name,
         p_transfer_enc=>'base64'
         dbms_lob.createtemporary(l_blob, true);
         dbms_lob.open(l_bfile);
         dbms_lob.fileopen(l_bfile);
         dbms_lob.open(l_blob, dbms_lob.lob_readwrite);
         dbms_lob.loadfromfile(l_blob, l_bfile, dbms_lob.getlength(l_bfile));
         dbms_lob.fileclose(l_bfile);
         dbms_lob.close(l_bfile);
         l_file_len := dbms_lob.getlength(l_blob);
         l_modulo := mod(l_file_len,MAX_BASE64_LINE_WIDTH);
         l_pieces := trunc(l_file_len/MAX_BASE64_LINE_WIDTH);
    while (l_counter < l_pieces)
    loop
    dbms_lob.read(l_blob, l_modulo, l_filepos, l_buffer);
    l_message := utl_raw.concat(l_message, l_buffer);
    write_mb_text(l_message||g_crlf);
    l_filepos := l_counter * MAX_BASE64_LINE_WIDTH + 1;
    l_counter := l_counter + 1;
    end loop;
    if l_modulo <> 0 then
    dbms_lob.read(l_blob, l_modulo, l_filepos, l_buffer);
    l_message := utl_raw.concat(l_message, l_buffer);
    write_mb_text(l_message||g_crlf);
    end if;
    dbms_lob.close(l_blob);
    end_attachment(true);     
    Please help

    I did not receive any error messages when executing the program. It works fine, I received the email nicely but without the attachment.
    Here is the emails I received:
    LOGICAL SPACE USED HAS REACHED ITS TRESHOLD. PLEASE DO NECESSAY TO MAKE MORE ROOM FOR THE SPACE TO EXTEND.
    Tablespace Name Used Size(MB) Free Size(MB)
    SYSTEM 259.953 4.047
    USERS 144.508 55.492
    INDX 31.258 26.742
    -------7D81B75CCC90D2974F7A1CBD
    Content-Type: multipart/mixed; boundary="-----7D81B75CCC90D2974F7A1CBD"
    Content-Disposition: attachment; filename="capacity_13-JAN-05-111226.xls"
    Content-Transfer-Encoding: base64
    -haris

  • Send PDF file as an attachement en an email (only 1 st page send?)

    Hi all !
    I have a requirement to send a spool job as an .PDF attachement via email for my client.
    I was using the FM CONVERT_ABAPSPOOLJOB_2_PDF to convert a spool into a PDF file
    Then Convert PDF from 132 to 255 characters.
    Then I use the following code from the forum to send the attachment to email
    Document information.
              W_DOC_CHNG-OBJ_NAME = 'ATTACHMENT'.
              W_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
              CONCATENATE TEXT-T07 PN-PABRP PN-PABRJ INTO W_DOC_CHNG-OBJ_DESCR separated by space.
              W_DOC_CHNG-SENSITIVTY = 'F'. "Functional object
             W_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
              W_DOC_CHNG-DOC_SIZE = V_LINES_BIN * 255.
    Pack to main body as RAW.
    Obj. to be transported not in binary form
             CLEAR I_OBJPACK-TRANSF_BIN.
              I_OBJPACK-TRANSF_BIN = ''.
    Start line of object header in transport packet
              I_OBJPACK-HEAD_START = 1.
    Number of lines of an object header in object packet
              I_OBJPACK-HEAD_NUM = 0.
    Start line of object contents in an object packet
              I_OBJPACK-BODY_START = 1.
    Number of lines of the object contents in an object packet
              I_OBJPACK-BODY_NUM = V_LINES_TXT.
    Code for document class
              I_OBJPACK-DOC_TYPE = 'RAW'.
              I_OBJPACK-OBJ_NAME = 'ATTACHMENT'.
              APPEND I_OBJPACK.
    Packing as PDF.
              I_OBJPACK-TRANSF_BIN = 'X'.
              I_OBJPACK-HEAD_START = 1.
              I_OBJPACK-HEAD_NUM = 1.
              I_OBJPACK-BODY_START = 1.
              I_OBJPACK-BODY_NUM = V_LINES_BIN.
              I_OBJPACK-DOC_TYPE = 'PDF'.
              I_OBJPACK-OBJ_NAME = 'ATTACHMENT'.
              CONCATENATE 'Remuneration_Statements_' PN-PABRP '_' PN-PABRJ  '.pdf'
              INTO I_OBJPACK-OBJ_DESCR.
              I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255.
              APPEND I_OBJPACK.
              clear I_OBJPACK.
    Document information.
              CLEAR I_RECLIST.
    e-mail receivers.
              read table it_pernr into wa_pernr
                  with key pernr = pernr-pernr binary search.
              if sy-subrc eq 0.
                I_RECLIST-RECEIVER = wa_pernr-usrid.
              endif.
              I_RECLIST-COM_TYPE = 'INT'.                   "Internet Email
    *I_RECLIST-notif_del  = 'X'.
    *I_RECLIST-notif_ndel = 'X'.
              I_RECLIST-EXPRESS = 'X'.
              I_RECLIST-REC_TYPE = 'U'. "Internet address
              APPEND I_RECLIST.
              CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
                  DOCUMENT_DATA                    = W_DOC_CHNG
              PUT_IN_OUTBOX                    = ' '
                  COMMIT_WORK                      = 'X'
            IMPORTING
              SENT_TO_ALL                      =
              NEW_OBJECT_ID                    =
              TABLES
                 PACKING_LIST                     = I_OBJPACK
       OBJECT_HEADER                    = W_OBJHEAD
           CONTENTS_BIN                     = I_OBJBIN
           CONTENTS_TXT                     = I_OBJTXT
      CONTENTS_HEX                     =
      OBJECT_PARA                      =
      OBJECT_PARB                      =
            RECEIVERS                        = I_RECLIST
    The email did succesfully send to the receipents but only the first page of the PDF attachement file was sent not the 2nd page.
    Can any body help ?
    Thanks a lot

    Hi all !
    I have a requirement to send a spool job as an .PDF attachement via email for my client.
    I was using the FM CONVERT_ABAPSPOOLJOB_2_PDF to convert a spool into a PDF file
    Then Convert PDF from 132 to 255 characters.
    Then I use the following code from the forum to send the attachment to email
    Document information.
              W_DOC_CHNG-OBJ_NAME = 'ATTACHMENT'.
              W_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
              CONCATENATE TEXT-T07 PN-PABRP PN-PABRJ INTO W_DOC_CHNG-OBJ_DESCR separated by space.
              W_DOC_CHNG-SENSITIVTY = 'F'. "Functional object
             W_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
              W_DOC_CHNG-DOC_SIZE = V_LINES_BIN * 255.
    Pack to main body as RAW.
    Obj. to be transported not in binary form
             CLEAR I_OBJPACK-TRANSF_BIN.
              I_OBJPACK-TRANSF_BIN = ''.
    Start line of object header in transport packet
              I_OBJPACK-HEAD_START = 1.
    Number of lines of an object header in object packet
              I_OBJPACK-HEAD_NUM = 0.
    Start line of object contents in an object packet
              I_OBJPACK-BODY_START = 1.
    Number of lines of the object contents in an object packet
              I_OBJPACK-BODY_NUM = V_LINES_TXT.
    Code for document class
              I_OBJPACK-DOC_TYPE = 'RAW'.
              I_OBJPACK-OBJ_NAME = 'ATTACHMENT'.
              APPEND I_OBJPACK.
    Packing as PDF.
              I_OBJPACK-TRANSF_BIN = 'X'.
              I_OBJPACK-HEAD_START = 1.
              I_OBJPACK-HEAD_NUM = 1.
              I_OBJPACK-BODY_START = 1.
              I_OBJPACK-BODY_NUM = V_LINES_BIN.
              I_OBJPACK-DOC_TYPE = 'PDF'.
              I_OBJPACK-OBJ_NAME = 'ATTACHMENT'.
              CONCATENATE 'Remuneration_Statements_' PN-PABRP '_' PN-PABRJ  '.pdf'
              INTO I_OBJPACK-OBJ_DESCR.
              I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255.
              APPEND I_OBJPACK.
              clear I_OBJPACK.
    Document information.
              CLEAR I_RECLIST.
    e-mail receivers.
              read table it_pernr into wa_pernr
                  with key pernr = pernr-pernr binary search.
              if sy-subrc eq 0.
                I_RECLIST-RECEIVER = wa_pernr-usrid.
              endif.
              I_RECLIST-COM_TYPE = 'INT'.                   "Internet Email
    *I_RECLIST-notif_del  = 'X'.
    *I_RECLIST-notif_ndel = 'X'.
              I_RECLIST-EXPRESS = 'X'.
              I_RECLIST-REC_TYPE = 'U'. "Internet address
              APPEND I_RECLIST.
              CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
                  DOCUMENT_DATA                    = W_DOC_CHNG
              PUT_IN_OUTBOX                    = ' '
                  COMMIT_WORK                      = 'X'
            IMPORTING
              SENT_TO_ALL                      =
              NEW_OBJECT_ID                    =
              TABLES
                 PACKING_LIST                     = I_OBJPACK
       OBJECT_HEADER                    = W_OBJHEAD
           CONTENTS_BIN                     = I_OBJBIN
           CONTENTS_TXT                     = I_OBJTXT
      CONTENTS_HEX                     =
      OBJECT_PARA                      =
      OBJECT_PARB                      =
            RECEIVERS                        = I_RECLIST
    The email did succesfully send to the receipents but only the first page of the PDF attachement file was sent not the 2nd page.
    Can any body help ?
    Thanks a lot

Maybe you are looking for

  • Getting Error The trust relationship between the primary domain and the trusted domain failed in SharePoint 2010

    Hi, SharePoint 2010 Backup has been taken from production and restored through Semantic Tool in one of the server.The wepapplication of which the backup was taken is working fine. But the problem is that the SharePoint is not working correctly.We can

  • Cant access to internet

    Hi ,I am from Azerbaijan ,asking question about internet problem in Server 2008 ,actually there are same problems mentioned before ,but none of them is same as mine.I have testserver HP proliant,I want to test and practise all Exchange ,TMG and etc i

  • How to reinstall remote desktop and update

    Somehow I bunged up my ARD. So I followed instructions to completely remove it and I want to reinstall. Problem is, mine is an ancient copy --- version 3.0  I have updated all along using Software Update. However, I seem to be in a loop as it won't c

  • Why is my iPod Touch not being recognized in iTunes, Device Manager, or my entire computer?

    I have had my iPod Touch since christmas and it is now June. The version is 4.1 and it's the one with the camera. My previous cord worked fine and I never had any problems with iTunes or my iPod before. I lost my cord for about a month (actually I ha

  • Help with local database

    hye... i have some problem with mySQLite database.i have this code for my application (in attachment).when you clik the load button,it will load a text file on the desktop directory.when you click the filter function it will split the text file accor