E-mail results as an attachement in excel format

Hello,
I have printer MPDF using device type PDF1 and Host Spooll Access Method 'M' for sending e-mails from our SAP 7.0.  We are getting e-mails with file attachments in PDF format from a number of our background jobs set to print to printer MPDF.
Is there anything similar which can be done to get e-mails in XLS format from a background job? 
Is there a device type which can do this?
Is there any way to accomplish this task without ABAP programming?
Please advise.
Thanks
Galina

It's not feasible without additional development. You would have to either change the program itself or create a "wrapper" program, which would get the output and then send an email with XLS attachment by using a function module, for example. Function modules and all the details may be found on SDN, it has been discussed many times.
HTML can be imported into Excel - lazy users...

Similar Messages

  • How to send Mailing Spool Details of Background jobin EXCEL format

    Dear All,
    Hope every one doing awesome.
    As per client requirement we need to send spool detail to user in EXCEL format.
    http://sapignite.com/sending-mail-for-background-job/
    As per the mentioned thread ABAPER created the code and we are getting mails in HTML format.
    Now the user wants the files in EXCEL format.
    I had checked in SCOT and doesn't found any useful setting that will make the required changes.
    Any other suggestion ?
    Tons of thanks for your support.
    Regards
    Nikhil

    need solution..

  • Send ALV report as attachment in EXCEL format

    Hi SAP Guru,
    I had a report output as ALV format.
    Currently, when the background job ended, it would be send out to the recipent thru SAPconnect as PDF format using internet mailing address.
    I tried to search for a configuraiton for EXCEL output but there don;t seems to be any option availble.
    I can only choose from PDF/TEXT/HTM/PS in the output document type selection in SOST.
    How can I configure to allow the system to send out the ALV report to my recipent in EXCEL format instead of PDF or HTML?
    Thanks

    Hi,
    By Using OOPS Concept you can send ALV Output as Excel Format by using Class Interface: CL_BCS.
    Do some search on CL_BCS.
    There are some demo Program, sreach for BCS* on SE38.
    Thanks & Regards
    M Nair

  • Report output to excel format

    Hi Experts,
    My requriement is I have to send a mail with report output in excel format as an attachment.
    I wrote the below subroutine for building excel sheet but I am getting output in the single row.  I am using version 4.6
    Please  help me regarding this. ASAP
    FORM BUILD_XLS_DATA .
      CONSTANTS: CON_CRET TYPE STRING VALUE '0D', "OK for non Unicode
      CON_TAB TYPE STRING VALUE '09'. "OK for non Unicode
      CONCATENATE 'Vendor' 'Country' 'Name'
      INTO IATTACH SEPARATED BY CON_TAB.
      CONCATENATE CON_CRET IATTACH INTO IATTACH.
      APPEND IATTACH.
      LOOP AT IT_lfa1.
       CONCATENATE IT_lfa1-lifnr IT_lfa1-land1 IT_lfa1-name1      INTO IATTACH
            SEPARATED BY CON_TAB.
        CONCATENATE CON_CRET IATTACH INTO IATTACH.
        APPEND IATTACH.
      ENDLOOP.
    ENDFORM.                    "build_xls_data
    Thanx,
    Sudha

    Hi Sudha,
    I am sending the standard format of sending a mail along with an attachment in .xls format.
    Try this code.
    form sendmail.
      CLEAR GV_DELIMIT.
      GV_DELIMIT = CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
      TEMPREAD = LV_LNCNT1.
      REFRESH OBJTXT.
      CONCATENATE 'The no. of error records are : ' TEMPREAD
      INTO OBJTXT-LINE.
      APPEND OBJTXT.
      CLEAR OBJPACK. REFRESH OBJPACK.
      CONCATENATE   C_CODE     
                    C_CMMT  
                    C_COMMENT1
                    INTO OBJTXT-LINE  SEPARATED BY GV_DELIMIT.
      APPEND OBJTXT.
      LOOP AT IT_DATA INTO WA_DATA.
        CONCATENATE   WA_DATA-ZCODE
                      WA_DATA-ZCOMMENT
                      WA_DATA-ZREASON
                      INTO OBJTXT-LINE  SEPARATED BY GV_DELIMIT.
        APPEND OBJTXT.
      ENDLOOP.
      CLEAR GV_DELIMIT.
      CLEAR OBJPACK. REFRESH OBJPACK.
      CLEAR DOC_CHNG.
      TAB_LINES = 0.
      OBJHEAD = REJFILE. APPEND OBJHEAD.
      DESCRIBE TABLE OBJTXT LINES TAB_LINES.
      READ TABLE OBJTXT INDEX TAB_LINES.
      DOC_CHNG-OBJ_NAME = REJFILE.
      MOVE TEXT-006 TO
      DOC_CHNG-OBJ_DESCR.
      DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
      CLEAR OBJPACK-TRANSF_BIN.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 0.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = 1.   " 3.
      OBJPACK-DOC_TYPE = 'RAW'.
      APPEND OBJPACK.
      FOR ASCII TO BINARY OBJECT FUNCTION
      TOTLINEXFER = 0.
      TOTXFER = 0.
      BINMAXLEN = 255.
      REFRESH OBJBIN.
      LV_CR = CL_ABAP_CHAR_UTILITIES=>CR_LF.
      TGTMAXLEN = BINMAXLEN.
      TGTLEN = 0.
      LOOP AT OBJTXT FROM 2.
        IF NOT OBJTXT-LINE CP 'The no. of records are '." AND
          CONCATENATE OBJTXT-LINE LV_CR INTO BUFFER.
          SRCOBJLEN = STRLEN( BUFFER ).
          SRCOBJPTR = 0.
          WHILE SRCOBJLEN > 0 .
            XFERLEN = TGTMAXLEN - TGTLEN.
            IF XFERLEN > SRCOBJLEN.
              XFERLEN = SRCOBJLEN.
              MOVE BUFFERSRCOBJPTR TO OBJBIN-LINETGTLEN.
              TGTLEN = TGTLEN + SRCOBJLEN.
              SRCOBJLEN = 0.
              CLEAR BUFFER.
            ELSE.
              MOVE BUFFER+SRCOBJPTR(XFERLEN) TO
              OBJBIN-LINE+TGTLEN(XFERLEN).
              APPEND OBJBIN.
              CLEAR OBJBIN-LINE.
              TGTLEN = 0.
              SRCOBJLEN = SRCOBJLEN - XFERLEN.
              SRCOBJPTR = SRCOBJPTR + XFERLEN.
              TOTLINEXFER = TOTLINEXFER + 1.
            ENDIF.
            TOTXFER = TOTXFER + XFERLEN.
          ENDWHILE.
        ENDIF.
      ENDLOOP.
      IF TGTLEN > 0.
        APPEND OBJBIN.
        TOTLINEXFER = TOTLINEXFER + 1.
      ENDIF.
      CLEAR OBJPACK-TRANSF_BIN.
      OBJPACK-TRANSF_BIN = 'X'.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 0.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TOTLINEXFER.
      OBJPACK-DOC_TYPE = 'XLS'.
      OBJPACK-OBJ_NAME = REJFILE.
      OBJPACK-OBJ_DESCR = 'Rejected Entries File'.
      OBJPACK-DOC_SIZE = TOTXFER.
      APPEND OBJPACK.
      REFRESH RECLIST.
      MAIL1 =   Recepient Mail Id
      RECLIST-RECEIVER = MAIL1.
      RECLIST-REC_TYPE = 'U'.
      APPEND RECLIST.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA = DOC_CHNG
          PUT_IN_OUTBOX = 'X'
          COMMIT_WORK   = 'X'
        TABLES
          PACKING_LIST  = OBJPACK
          OBJECT_HEADER = OBJHEAD
          CONTENTS_BIN  = OBJBIN
          CONTENTS_TXT  = OBJTXT
          RECEIVERS     = RECLIST.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    endform.
    Hope this is helpful to you. If you need further information, revert back.
    Reward all the helpful answers.
    Regards
    Nagaraj T

  • Converting oracle reports output  to excel format

    i am using Report Builder 9.0.2.0.3, and want to view the results of the report in excel format. I have gone through many discussion forums and don't wish to use the rep2excel software,as suggested in those forums. I wish to know, at the earliest in what way can this be achieved.

    Hello,
    Since Reports 9.0.2 , it is possible to execute a Reports as a JSP
    Go to :
    http://www.oracle.com/technology/products/reports/htdocs/getstart/demonstrations/index.html
    Click on the link "Output to Excel with Oracle9i Report"
    (This slideshow steps you through creating Excel output from Oracle9i Reports.)
    Regards
    Message was edited by:
    dsegard

  • Problem in excel format while sending mail with excel attachment.

    Hi Gurus ,
    I am sending a email with Excel attachment using FM SO_DOCUMENT_SEND_API1 or SO_NEW_DOCUMENT_ATT_SEND_API1.
    I am able to send a mail with excel attachment with a piece of code which I got from SDN itself.
    But the problem is when I am trying to open the attachment, <b>A pop up comes which says that it is not in recognizable format. Would you like to open it?
    and several other lines of caution.</b>
    When i choose to open it, i get the correct data in one excel sheet. Certain vertical lines of the excel sheet is missing. <b>But no data is missing. </b>
    I am attaching the code below. Can any one please tell me where is the problem in this code ?
    Thanx in advance
    types: begin of t_mara,
    matnr type mara-matnr,
    matkl type mara-matkl,
    mtart type mara-mtart,
    meins type mara-meins,
    end of t_mara.
    data: gt_mara type table of t_mara,
    wa_mara like line of gt_mara,
    it_packing_list type table of SOPCKLSTI1,
    wa_packing_list like line of it_packing_list,
    it_receivers type table of SOMLRECI1,
    wa_receivers like line of it_receivers,
    it_mailbody type table of SOLISTI1,
    wa_mailbody like line of it_mailbody,
    it_attachment type table of SOLISTI1,
    wa_attachment like line of it_attachment.
    data: la_doc type SODOCCHGI1.
    constants:
    con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
    con_cret type c value cl_abap_char_utilities=>CR_LF.
    * get material
    select matnr matkl mtart meins
    into table gt_mara
    from mara
    up to 25 rows.
    * Populate the subject/generic message attributes
    la_doc-obj_langu = sy-langu.
    la_doc-obj_descr = 'Material Details' . "Mail Header
    la_doc-sensitivty = 'F'.
    la_doc-doc_size = 1.
    * Add the recipients email address
    CLEAR wa_receivers.
    REFRESH it_receivers.
    wa_receivers-receiver = 'PCSDEVL'.
    wa_receivers-rec_type = 'U'.
    wa_receivers-com_type = 'INT'.
    wa_receivers-notif_del = 'X'.
    wa_receivers-notif_ndel = 'X'.
    APPEND wa_receivers to it_receivers.
    * Mail Body
    CLEAR wa_mailbody.
    REFRESH it_mailbody.
    wa_mailbody-line = 'Please find the attachment'.
    APPEND wa_mailbody to it_mailbody.
    * Mail attachmwnt
    CLEAR wa_attachment.
    REFRESH it_attachment.
    CONCATENATE 'MATNR' 'MATKL' 'MTART' 'MEINS'
    INTO wa_attachment SEPARATED BY con_tab.
    CONCATENATE con_cret wa_attachment INTO wa_attachment.
    APPEND wa_attachment to it_attachment.
    LOOP AT gt_mara INTO wa_mara.
    CONCATENATE wa_mara-matnr wa_mara-matkl
    wa_mara-mtart wa_mara-meins
    INTO wa_attachment SEPARATED BY con_tab.
    CONCATENATE con_cret wa_attachment INTO wa_attachment.
    APPEND wa_attachment to it_attachment.
    ENDLOOP.
    * Describe the body of the message
    CLEAR wa_packing_list.
    REFRESH it_packing_list.
    wa_packing_list-transf_bin = space.
    wa_packing_list-head_start = 1.
    wa_packing_list-head_num = 0.
    wa_packing_list-body_start = 1.
    wa_packing_list-body_num = 1.
    wa_packing_list-doc_type = 'RAW'.
    APPEND wa_packing_list to it_packing_list.
    * Create attachment notification
    wa_packing_list-transf_bin = 'X'.
    wa_packing_list-head_start = 1.
    wa_packing_list-head_num = 1.
    wa_packing_list-body_start = 1.
    DESCRIBE TABLE it_attachment LINES wa_packing_list-body_num.
    wa_packing_list-doc_type = 'XLS'. " To word attachment change this as 'DOC'
    wa_packing_list-obj_descr = ' '.
    concatenate wa_packing_list-doc_type 'file' into wa_packing_list-OBJ_DESCR
    separated by space.
    wa_packing_list-doc_size = wa_packing_list-body_num * 255.
    APPEND wa_packing_list to it_packing_list.
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
    document_data = la_doc
    PUT_IN_OUTBOX = 'X'
    * SENDER_ADDRESS = SY-UNAME
    * SENDER_ADDRESS_TYPE = 'B'
    COMMIT_WORK = 'X'
    * IMPORTING
    * SENT_TO_ALL =
    * NEW_OBJECT_ID =
    * SENDER_ID =
    tables
    packing_list = it_packing_list
    * OBJECT_HEADER =
    CONTENTS_BIN = it_attachment
    CONTENTS_TXT = it_mailbody
    * CONTENTS_HEX =
    * OBJECT_PARA =
    * OBJECT_PARB =
    receivers = it_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.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.

    REPORT  Zex5 LINE-SIZE 255 LINE-COUNT 255 .
    class CL_ABAP_CHAR_UTILITIES definition load. "-->
    TABLES : vbap.
    SELECT-OPTIONS: s_vbeln FOR vbap-vbeln.
    DATA : BEGIN OF itab OCCURS 1,
           vbeln LIKE vbap-vbeln,
           posnr LIKE vbap-posnr,
           matnr LIKE vbap-matnr,
           END OF itab.
    parameters : p_email like somlreci1-receiver
    DATA: tlines type i.
    DATA: itmessage   LIKE solisti1 OCCURS 1 WITH HEADER LINE. "Ok
    DATA: itattach    LIKE solisti1 OCCURS 2 WITH HEADER LINE. "Ok
    DATA: itpacklist  LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
    DATA: itreclist   LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
    data: itattachment like solisti1 OCCURS 2 WITH HEADER LINE.
    start-of-selection.
      SELECT vbeln posnr matnr
             FROM vbap
             INTO TABLE itab
             WHERE vbeln IN s_vbeln.
    **Make the internal table data to be compatible in excel format .
      PERFORM BUILD_XLS_FORMAT.
    **Populate message of body text.
      clear itmessage.
      refresh itmessage.
      itmessage = 'Please find attached Excel file'.
      append itmessage.
      PERFORM send_mail_as_xls_attachment tables itmessage
                                                 itattach
             using p_email 'Excel Attachment' 'TXT'    " 'XLS'
              using p_email 'TEXT Attachment' 'TXT'    " 'XLS'
                            'TestFileName'
                            'SalesOrders' .
    *&      Form  BUILD_XLS_FORMAT
          text
    -->  p1        text
    <--  p2        text
    form BUILD_XLS_FORMAT.
    previosuly we were using for unicode ..now replaced
    **Declare constants for the spacing .
    *Constants : con1 type x value '0D',
               con2 type x value '09'.
      Constants : con1 type c
            value CL_ABAP_CHAR_UTILITIES=>CR_LF,
            con2 type c
            value CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
    **For the Header descriptions.
      Concatenate 'SalesORdNo'
                  'Item'
                  'Materialno' into itattach separated by con2.
      Concatenate con1 itattach into itattach.
      Append itattach.
    **Now align the items in the itab as above .
      Loop at Itab.
        concatenate itab-vbeln
                    itab-posnr
                    itab-matnr into itattach separated by con2.
        concatenate con1 itattach into itattach .
        Append itattach.
      endloop.
    endform.                    " BUILD_XLS_FORMAT
    *&      Form  send_mail_as_xls_attachment
          text
         -->P_ITMESSAGE  text
         -->P_ITATTACH  text
         -->P_P_EMAIL  text
         -->P_0116   text
         -->P_0117   text
         -->P_0118   text
         -->P_0119   text
    form send_mail_as_xls_attachment tables   p_itmessage
                                              p_itattach
                                     using    p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription.
      Data : xdocdata like sodocchgi1,
             xcnt type i.
    *Fill the document data.
      xdocdata-doc_size = 1.
    *Populate the subject/generic message attributes.
      xdocdata-obj_name  = 'SAPRPT'.
      xdocdata-obj_langu = sy-langu.
      xdocdata-obj_descr = p_mtitle.
    *Fill the document data and fetch size of attachment.
      clear xdocdata.
      read table itattach index xcnt.
      xdocdata-doc_size = ( xcnt - 1 ) * 255 + strlen( itattach ).
    xdocdata-doc_size =  ( xcnt - 1 ) * 255.
      xdocdata-obj_name  = 'SAPRPT'.
      xdocdata-obj_langu = sy-langu.
      xdocdata-obj_descr = p_mtitle.
      clear itattachment. refresh itattachment.
         itattachment[] = p_itattach[].
    *Describe the body of the message.
      clear itpacklist. refresh itpacklist.
      itpacklist-transf_bin = 'X'.
      itpacklist-head_start = '1'.
      itpacklist-head_num = '0'.
      itpacklist-body_start = '1'.
      describe table itattachment lines itpacklist-body_num .
      itpacklist-doc_type = 'TXT'.
    itpacklist-doc_type = 'XLS'.
      append itpacklist.
    *Create attachment notification.
      itpacklist-transf_bin = 'X'.
      itpacklist-head_start = '1'.
      itpacklist-head_num = '1'.
      itpacklist-body_start = '1'.
      describe table itattachment lines itpacklist-body_num .
      itpacklist-doc_type = p_format.
      itpacklist-obj_name = p_filename.
      itpacklist-obj_descr = p_attdescription.
      itpacklist-doc_size = itpacklist-body_num * 255 .
      append itpacklist.
    *FIll the receivers list.
      Clear itreclist. refresh itreclist.
      itreclist-receiver = p_email.
      itreclist-rec_type = 'U'.
      itreclist-com_type = 'INT'.
      itreclist-notif_del = 'X'.
      itreclist-notif_ndel = 'X'.
    *itreclist-notif_read = 'X'.
      append itreclist.
    *CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
      document_data                    = xdocdata
      PUT_IN_OUTBOX                    = 'X'
      commit_work    = 'X'
      SENDER_ADDRESS                   = SY-UNAME
    tables
       packing_list                    = itpacklist
       CONTENTS_BIN                    = itattachment
       CONTENTS_TXT                    = itmessage
       receivers                       = itreclist
    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.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = xdocdata
          PUT_IN_OUTBOX              = 'X'
        TABLES
          packing_list               = itpacklist
          CONTENTS_BIN               = itattachment
          CONTENTS_TXT               = itmessage
          receivers                  = itreclist
        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.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    endform.                    " send_mail_as_xls_attachment
    Just execute the above code and let me know.
    What is the sap version u r using .
    Vijay

  • I have a scenario. Import IDOC into PI and PI transform IDOC to Excel. Using mail adapter attach that Excel using pi and send to customer. Can you please help me on the same?

    HI Experts,
    I have a scenario. Import IDOC into PI and PI transform IDOC to Excel. Using mail adapter attach that Excel using pi and send to vendor. Can you please help me on the same?
    Thanks
    SaiSreevastav

    Hi Sai,
    you can use XSLT or java mapping or adapter module to convert IDOC xml to XLS. Please refer the below blog
    Convert incoming XML to Excel or Excel XML – Part 1 - XSLT Way
    Convert incoming XML to Excel Sheet Part 2 – Adapter Module way
    Convert incoming XML to Excel Sheet
    then after converting to Excel, you can use the payloadswap bean in mail adapter
    XI: Sender mail adapter - PayloadSwapBean - Step by step
    regards,
    Harish

  • How to attach a excel or word file when replying to a mail ?

    Hi,
    I am having problem while using safari app.
    When i am to reply to a mail and while replying i am to attach an excel or word file, how should i do it ?

    Doesn't matter what mail it is.  You cannot actually do this on an iPhone.  It is a bit frustrating. The only thing you can attach to a mail message (from within the message itself) is a photo or video.
    You can email all sorts of things from within lots of apps, but you cannot add something to a message.

  • Periodically auto generation of Report in background and send result to user mail ID in Excel Format

    Hi Experts, I want to get the warehouse inventory report to be receive by email in excel format every month end. also i have 4-5 transaction for that I need the report by email in excel format in specific frequency.
    Can some one help me on this?
    Regards,
    Rushikesh

    Hi Rushikesh,
    You can create batch Jobs (Trx. SM36) for executing the transactions in background at specified times and in the spool recipient option mention the email IDs of the recipients.
    Regards,
    Namita

  • Ability to send report in excel format through ibot to mail

    Hi,
    we are using sibel analytics 7.7.1 ,.
    my requirement is to send report in excel format as attachment through ibots to mails.
    is it possible in 7.7. Default we can send as plain text, pdf, HTML format we can send the report . We need in excel format.
    Please give advice
    Thanks & Regards
    Anjireddy

    Hi,
    we are using sibel analytics 7.7.1 ,.
    my requirement is to send report in excel format as attachment through ibots to mails.
    is it possible in 7.7. Default we can send as plain text, pdf, HTML format we can send the report . We need in excel format.
    Please give advice
    Thanks & Regards
    Anjireddy

  • Is it possible to mail the data in excel format in data tabs?

    Hi all,
    I need a few clarification .
    We all know report data can be mailed in excel format.
    But my excel is having 4 tabs of data.
    Is that can also be mailed if so can you please guide...
    Regards
    sas

    hi,
    you can do it..
    try the following given code..
    *&      Form  process_email
    * subroutine created for processing and sending the attachments to mail id.
    FORM process_email.
      IF p_sender EQ space.
        gd_sender_type = space.
      ELSE.
        gd_sender_type = 'INT'.
      ENDIF.
    *Body
      docdata-obj_name = 'Mail_Excel_File'.
      docdata-obj_descr = 'Excel file attachment'.
      objtxt = 'Attached is the sample Excel file'.
      APPEND objtxt.
      DESCRIBE TABLE objtxt LINES tab_lines.
      READ TABLE objtxt INDEX tab_lines.
      docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
      CLEAR objpack-transf_bin.
      objpack-head_start = 1.
      objpack-head_num = 0.
      objpack-body_start = 1.
      objpack-body_num = tab_lines.
      objpack-doc_type = 'RAW'.
      APPEND objpack.
    *Attachment
      n = 1.                                    "for sending 1st attachment
      DESCRIBE TABLE objbin1 LINES tab_lines.
      objpack-doc_size = tab_lines * 255.
      objpack-transf_bin = 'X'.
      objpack-head_start = 1.
      objpack-head_num = 1.
      objpack-body_start = n.
      objpack-body_num = tab_lines.
      objpack-doc_type = 'XLS'.
      docdata-obj_name = 'Excel_File_Attachment1'.
      objpack-obj_descr = 'Excel File Attachment1'.
      APPEND objpack.
      n = n + tab_lines.                       "for sending 2nd attachment
      DESCRIBE TABLE objbin2 LINES tab_lines.
      objpack-doc_size = tab_lines * 255.
      objpack-transf_bin = 'X'.
      objpack-head_start = 1.
      objpack-head_num = 1.
      objpack-body_start = n.
      objpack-body_num = tab_lines.
      objpack-doc_type = 'XLS'.
      docdata-obj_name = 'Excel_File_Attachment2'.
      objpack-obj_descr = 'Excel File Attachment2'.
      APPEND objpack.
      n = n + tab_lines.                       "for sending 3rd attachment
      DESCRIBE TABLE objin3 LINES tab_lines.
      objpack-doc_size = tab_lines * 255.
      objpack-transf_bin = 'X'.
      objpack-head_start = 1.
      objpack-head_num = 1.
      objpack-body_start = n.
      objpack-body_num = tab_lines.
      objpack-doc_type = 'XLS'.
      docdata-obj_name = 'Excel_File_Attachment3'.
      objpack-obj_descr = 'Excel File Attachment3'.
      APPEND objpack.
    *Create the list of recipients
      reclist-receiver = p_email1.
      reclist-rec_type = 'U'.
      reclist-express = 'X'.
      APPEND reclist.
    *Send the e-mail by using this function module
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = docdata
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = objpack
          contents_bin               = objbin_final
          contents_txt               = objtxt
          receivers                  = 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.
      COMMIT WORK.
    ENDFORM.                    "process_email
    hope this helps
    Regards
    RItesh J

  • ALV output to be mailed in excel format

    Hi All,
    Currently we have a alv grid report, but my user requirement is he want this alv grid output to be mailed to his mail id in excel format.
    some times data may be huge of about 8000 - 10,000 lines.
    is it possiable.
    can any one help.

    hi check this code
    Here i'm posting u sample code try to execute it. It will convert all the data in the related tables to excel format and transfer it to respective mail id
    code&----
    *& Report ZTESTMAIL *
    REPORT ZTESTMAIL .
    tables: ekko.
    parameters: p_email type somlreci1-receiver .
    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.
    t_object_header = 'Text.xls'. append t_object_header.
    *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
    object_header = t_object_header
    packing_list = t_packing_list
    contents_bin = t_attachment
    contents_txt = it_message
    receivers = t_receivers
    exceptions
    too_many_receivers = 1
    document_not_sent = 2
    document_type_not_exist = 3
    operation_no_authorization = 4
    parameter_error = 5
    x_error = 6
    enqueue_error = 7
    others = 8.
    Populate zerror return code
    ld_error = sy-subrc.
    Populate zreceiver return code
    loop at t_receivers.
    ld_receiver = t_receivers-retrn_code.
    endloop.
    endform.
    *& 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
    *PARAMETERS: psubject(40) type c default 'Testing',
    *p_email(40) type c . "use ur email id
    *data: it_packing_list like sopcklsti1 occurs 0 with header line,
    *it_contents like solisti1 occurs 0 with header line,
    *it_receivers like somlreci1 occurs 0 with header line,
    *it_attachment like solisti1 occurs 0 with header line,
    *gd_cnt type i,
    *gd_sent_all(1) type c,
    *gd_doc_data like sodocchgi1,
    *gd_error type sy-subrc.
    *data: it_message type standard table of SOLISTI1 initial size 0
    *with header line.
    **START-OF-SELECTION.
    *START-OF-SELECTION.
    *Perform populate_message_table.
    **Send email message, although is not sent from SAP until mail send
    **program has been executed(rsconn01)
    *PERFORM send_email_message.
    **Instructs mail send program for SAPCONNECT to send email(rsconn01)
    *perform initiate_mail_execute_program.
    **& Form POPULATE_MESSAGE_TABLE
    Adds text to email text table
    *form populate_message_table.
    *Append 'Line1' to it_message.
    *Append 'Line2' to it_message.
    *Append 'Line3' to it_message.
    *Append 'Test- 1' to it_message.
    *endform. " POPULATE_MESSAGE_TABLE
    **& Form SEND_EMAIL_MESSAGE
    Send email message
    *form send_email_message.
    Fill the document data.
    *gd_doc_data-doc_size = 1.
    DATA: TAB_LINES LIKE sy-tabix.
    DESCRIBE TABLE it_message LINES TAB_LINES.
    READ TABLE it_message INDEX TAB_LINES.
    gd_doc_data-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( it_message )
    Populate the subject/generic message attributes
    *gd_doc_data-obj_langu = sy-langu.
    *gd_doc_data-obj_name = 'SAPRPT'.
    *gd_doc_data-obj_descr = psubject.
    *gd_doc_data-sensitivty = 'F'.
    Describe the body of the message
    Information about structure of data tables
    *clear it_packing_list.
    *refresh it_packing_list.
    *it_packing_list-transf_bin = space.
    *it_packing_list-head_start = 1.
    *it_packing_list-head_num = 0.
    *it_packing_list-body_start = 1.
    *describe table it_message lines it_packing_list-body_num.
    *it_packing_list-doc_type = 'RAW'.
    *append it_packing_list.
    Add the recipients email address
    *clear it_receivers.
    *refresh it_receivers.
    *it_receivers-receiver = p_email.
    *it_receivers-rec_type = 'U'.
    it_receivers-com_type = 'INT'.
    it_receivers-notif_del = 'X'.
    it_receivers-notif_ndel = 'X'.
    *append it_receivers.
    Call the FM to post the message to SAPMAIL
    *call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    *exporting
    *document_data = gd_doc_data
    *put_in_outbox = 'X'
    *importing
    *sent_to_all = gd_sent_all
    *tables
    *packing_list = it_packing_list
    *contents_txt = it_message
    *receivers = it_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.
    Store function module return code
    *gd_error = sy-subrc.
    Get it_receivers return code
    *loop at it_receivers.
    *endloop.
    *endform. " SEND_EMAIL_MESSAGE
    **& Form INITIATE_MAIL_EXECUTE_PROGRAM
    Instructs mail send program for SAPCONNECT to send email.
    *form initiate_mail_execute_program.
    *wait up to 2 seconds.
    *if gd_error eq 0.
    *submit rsconn01 with mode = 'INT'
    *with output = 'X'
    *and return.
    *endif.
    *endform. " INITIATE_MAIL_EXECUTE_PROGRAM
    [/code]

  • Problem in sending a mail in Excel Format

    Hi Experts,
              i have created one report which send a mail to the customer in Excel format. For that Report, i have used on function module for downloading .
      the Coding is like this,
       CALL FUNCTION 'WS_DOWNLOAD'
             EXPORTING
                  FILENAME = 'C:\YD1.XLS'
                  FILETYPE = 'DAT'
             TABLES
                  DATA_TAB = ITAB_RESULT
                  FIELDNAMES = IOUTHEAD.
      After Downloading i have send the XLS File to the Customer using user Function Module.
      My Problem is,
            I have attached the Excel to the Custmer.
    But the Excel File not displaying the headers . But In my Business Workplace(sbwp) the Attached Excel file displaying the header and the Details . in SBWP it is displaying correctly. But when the Customer's Place(SyStem) the particular Excel File not displaying the Headers.
       where and what is the error in my report?
    Regards,
    Neptune.M

    HI
    GOOD
    CHECK OUT THIS LINK,
    http://www.thespot4sap.com/Articles/SAP_Mail_UNIX.asp
    CODE
    FORM SEND_MAIL.
      DATA: OBJPACK   LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
      DATA: OBJHEAD   LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
      DATA: OBJBIN    LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
      DATA: OBJTXT    LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
      DATA: RECLIST   LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
      DATA: DOC_CHNG  LIKE SODOCCHGI1.
      DATA: TAB_LINES LIKE SY-TABIX.
      DATA L_NUM(3).
    Creation of the document to be sent
    File Name
      DOC_CHNG-OBJ_NAME = 'SENDFILE'.
    Mail Subject
      DOC_CHNG-OBJ_DESCR = 'Delivered Mail'.
    Mail Contents
      OBJTXT = 'Object text'.
      APPEND OBJTXT.
      DESCRIBE TABLE OBJTXT LINES TAB_LINES.
      READ TABLE OBJTXT INDEX TAB_LINES.
      DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
    Creation of the entry for the compressed document
      CLEAR OBJPACK-TRANSF_BIN.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 0.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TAB_LINES.
      OBJPACK-DOC_TYPE = 'RAW'.
      APPEND OBJPACK.
    Creation of the document attachment
      LOOP AT ITAB_DATA.
        CONCATENATE ITAB_DATA-PRODUCTOR
                    ITAB_DATA-VBELN
                    ITAB_DATA-POSNR
                    ITAB_DATA-MATNR INTO OBJBIN.
        APPEND OBJBIN.
      ENDLOOP.
      DESCRIBE TABLE OBJBIN LINES TAB_LINES.
      OBJHEAD = 'ORDERS'.
      APPEND OBJHEAD.
    Creation of the entry for the compressed attachment
      OBJPACK-TRANSF_BIN = 'X'.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM   = 1.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM   = TAB_LINES.
      OBJPACK-DOC_TYPE   = 'TXT'.
      OBJPACK-OBJ_NAME   = 'WEBSITE'.
      OBJPACK-OBJ_DESCR  = 'ORDERS.TXT'.
      OBJPACK-DOC_SIZE   = TAB_LINES * 255.
      APPEND OBJPACK.
    Completing the recipient list
    target recipent
      clear RECLIST.
      RECLIST-RECEIVER = '[email protected]'.
      RECLIST-EXPRESS  = 'X'.
      RECLIST-REC_TYPE = 'U'.
      APPEND RECLIST.
    copy recipents
      clear RECLIST.
      RECLIST-RECEIVER = '[email protected]'.
      RECLIST-EXPRESS  = 'X'.
      RECLIST-REC_TYPE = 'U'.
      RECLIST-COPY     = 'X'.
      APPEND RECLIST.
    Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                DOCUMENT_DATA              = DOC_CHNG
           TABLES
                PACKING_LIST               = OBJPACK
                OBJECT_HEADER              = OBJHEAD
                CONTENTS_BIN               = OBJBIN
                CONTENTS_TXT               = OBJTXT
                RECEIVERS                  = RECLIST
           EXCEPTIONS
                TOO_MANY_RECEIVERS         = 1
                DOCUMENT_NOT_SENT          = 2
                OPERATION_NO_AUTHORIZATION = 4
                OTHERS                     = 99.
    ENDFORM.                    " SEND_MAIL
    THANKS
    MRUTYUN

  • Mail in attachment in text format

    hi,
    As per my requirement I need to send the errored records of file into mail in text format.
    I have used the link to develop the code suggested by someone in sdn only to to so.
    http://www.sapdevelopment.co.uk/reporting/email/attach_xlsmod.htm.
    But now the problem is that the attatchment is in excel format.
    But I want it in text format.
    How to proceed?
    Please help.
    Thanks and Regards,
    Smriti Singh

    Hi,
    here a short example like i do it:
    * Mehr Beispile unter BCS_EXAMPLE_* mit se38
    * Mehr Beispile unter BCS_TEST*     mit se38
    DATA: SEND_REQUEST       TYPE REF TO CL_BCS.
    DATA: SUBJECT            TYPE SO_OBJ_DES.
    DATA: ATT_TYPE           TYPE SOODK-OBJTP.
    DATA: IT_TEXT            TYPE BCSY_TEXT.
    DATA: WA_TEXT            LIKE SOLI.
    DATA: IT_BIN             TYPE SOLIX_TAB.
    DATA: WA_BIN             TYPE SOLIX.
    DATA: DOCUMENT           TYPE REF TO CL_DOCUMENT_BCS.
    DATA: SENDER             TYPE REF TO CL_SAPUSER_BCS.
    DATA: RECIPIENT          TYPE REF TO IF_RECIPIENT_BCS.
    DATA: BCS_EXCEPTION      TYPE REF TO CX_BCS.
    DATA: SENT_TO_ALL        TYPE OS_BOOLEAN.
    * Bytes der Datei
    DATA: IT_LENGHT          TYPE SO_OBJ_LEN.
    DATA: N10(10)            TYPE N.
    START-OF-SELECTION.
      PERFORM MAIN.
      PERFORM RSCONN01_EXECUTE.
    END-OF-SELECTION.
    FORM MAIN.
      TRY.
    * Dokument erstellen (mit Anhang)
          SEND_REQUEST = CL_BCS=>CREATE_PERSISTENT( ).
          PERFORM HEAD_CONT.
          PERFORM RAW_ATT.
    * Dokument (mit Anhang) setzen
          CALL METHOD SEND_REQUEST->SET_DOCUMENT( DOCUMENT ).
    * Absender setzen
          SENDER = CL_SAPUSER_BCS=>CREATE( SY-UNAME ).
          CALL METHOD SEND_REQUEST->SET_SENDER
            EXPORTING
              I_SENDER = SENDER.
    * Empfänger setzen
          RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS(
                                            'email@address' ).
          CALL METHOD SEND_REQUEST->ADD_RECIPIENT
            EXPORTING
              I_RECIPIENT = RECIPIENT
              I_EXPRESS   = 'X'.
    * Dokument senden
          CALL METHOD SEND_REQUEST->SEND(
            EXPORTING
              I_WITH_ERROR_SCREEN = 'X'
            RECEIVING
              RESULT              = SENT_TO_ALL ).
          COMMIT WORK.
    * Sende-Error abfangen
        CATCH CX_BCS INTO BCS_EXCEPTION.
          WRITE: 'Fehler aufgetreten.'(001).
          WRITE: 'Fehlertyp:'(002), BCS_EXCEPTION->ERROR_TYPE.
          EXIT.
      ENDTRY.
    ENDFORM.                    "main
    FORM HEAD_CONT.
      CLEAR: IT_TEXT[], WA_TEXT, SUBJECT.
      ATT_TYPE = 'RAW'.
      SUBJECT = 'Betreffzeile'.
      WA_TEXT = 'First Line'. APPEND WA_TEXT TO IT_TEXT.
      WA_TEXT = 'Second Line'. APPEND WA_TEXT TO IT_TEXT.
      DESCRIBE TABLE IT_TEXT LINES N10.
      N10 = ( N10 - 1 ) * 255 + STRLEN( WA_TEXT ).
      IT_LENGHT = N10.
      TRY.
          DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
                    I_TYPE    = ATT_TYPE
                    I_TEXT    = IT_TEXT
                    I_LENGTH  = IT_LENGHT
                    I_SUBJECT = SUBJECT ).
    * Error abfangen
        CATCH CX_BCS INTO BCS_EXCEPTION.
          WRITE: 'Fehler aufgetreten.'(001).
          WRITE: 'Fehlertyp:'(002), BCS_EXCEPTION->ERROR_TYPE.
          EXIT.
      ENDTRY.
    ENDFORM.                    "HEAD_CONT
    *&      Form  RAW_ATT
    *       text
    FORM RAW_ATT.
      CLEAR: IT_TEXT[], WA_TEXT, SUBJECT.
      ATT_TYPE = 'RAW'.
      SUBJECT = 'Text Anhang'.
      WA_TEXT = 'First Line in ATT'. APPEND WA_TEXT TO IT_TEXT.
      WA_TEXT = 'Second Line in ATT'. APPEND WA_TEXT TO IT_TEXT.
    * Lenght of Att_Text
      DESCRIBE TABLE IT_TEXT LINES N10.
      N10 = ( N10 - 1 ) * 255 + STRLEN( WA_TEXT ).
      IT_LENGHT = N10.
      TRY.
          CALL METHOD DOCUMENT->ADD_ATTACHMENT
            EXPORTING
              I_ATTACHMENT_TYPE    = ATT_TYPE
              I_ATT_CONTENT_TEXT   = IT_TEXT
              I_ATTACHMENT_SIZE    = IT_LENGHT
              I_ATTACHMENT_SUBJECT = SUBJECT.
    * Error abfangen
        CATCH CX_BCS INTO BCS_EXCEPTION.
          WRITE: 'Fehler aufgetreten.'(001).
          WRITE: 'Fehlertyp:'(002), BCS_EXCEPTION->ERROR_TYPE.
          EXIT.
      ENDTRY.
    ENDFORM.                    "ATT_RAW
    *&      Form  RSCONN01_EXECUTE
    *       text
    FORM RSCONN01_EXECUTE.
    * Besser 2 Sekunden warten, damit alles versendet ist
      WAIT UP TO 2 SECONDS.
      SUBMIT RSCONN01 WITH MODE   = 'INT'
                      WITH OUTPUT = ' '
                      AND  RETURN.
    ENDFORM.                    "RSCONN01_EXECUTE
    See also the mentioned examples.
    Hope it helps.
    Regards, Dieter

  • Extension of excel file in email attachment is .excel instead of .xls

    I have concurrent program and I'm trying to use the 'delivery option' to send the output as attachment in email. I defined a rtf template and can open the output from 'Output' button correctly. it can also send mail with attach, but the file name of the attachment is .excel which Excel cannot recognize. My question is , is there any setup to specify the file extension of excel output. I'm sure bursting can work correctly, I just want to try the delivery option. Thanks in advance.

    Please see these links.
    excel output in report builder reports
    http://forums.oracle.com/forums/search.jspa?threadID=&q=excel+AND+XML&objID=f475&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

Maybe you are looking for