Converting html file into zip file and send email attaching zip file

Hi Experts,
I am trying to send email with attachment(html). Which contains more than 7MB. So, It is throwing an error like Size exceeded.
So, Now i need to compress the data for less than 7MB.
I decided to convert HTML File into ZIP File.
Kindly suggest me to convert the HTML file into ZIP file and sending email with attached ZIP file.
Correct answer rewarded,
Thanks & Regards,
N. HARISH KUMAR

Hi Experts,
*// HTML_TAB converting into ZIP File
   DATA  : zip_tool TYPE REF TO cl_abap_zip,
           filename TYPE string ,
           filename_zip TYPE string .
   DATA  : t_data_tab TYPE TABLE OF x255,
           bin_size TYPE i,
           buffer_x TYPE xstring,
           buffer_zip TYPE xstring.
filename = text-007.                                                                          "'HTML_TAB
*describe the attachment
   DESCRIBE TABLE html_tab LINES tab_lines.
   bin_size = tab_lines * 255.
   CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
     EXPORTING
       input_length = bin_size
     IMPORTING
       buffer       = buffer_x
     TABLES
       binary_tab   = html_tab.
   IF sy-subrc <> 0.
*     message id sy-msgid type sy-msgty number sy-msgno
*     with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
   ENDIF.
*create zip tool
   CREATE OBJECT zip_tool.
*add binary file
   CALL METHOD zip_tool->add
     EXPORTING
       name    = 'FSSAI_MAIL.HTML'
       content = buffer_x.
*get binary ZIP file
   CALL METHOD zip_tool->save
     RECEIVING
       zip = buffer_zip.
   CLEAR: t_data_tab[],bin_size.
   CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
     EXPORTING
       buffer        = buffer_zip
     IMPORTING
       output_length = bin_size
     TABLES
       binary_tab    = html_tab.
Thanks & Regards,
N. HARISH KUMAR

Similar Messages

  • Need a perl script which monitors a network folder and sends email when new files/folders arrived...

    I need a perl script (or something else better) which monitors a network folder and sends email when new files/folders arrived. I tried it in Automator but failed.
    Thanks!

    Yes. I tried it. But whenever I restart m Mac, the watch folder doesn't work until I reconnect to network or run the Automator... I need a simple system that automatically connects to the network and monitor the folder, even I restart the Mac.
    Thanks!

  • Someone has hacked into my account and sending emails (iCloud) pretending to be me.  I've changed my icloud password.  Do i need to do anything elase?

    Someone has hacked into my account and sending emails (iCloud) pretending to be me.  I've changed my icloud password.  Do i need to do anything else?

    You should consider enabling two-factor verification on your Apple ID, to further protect it. Without doing that, it's entirely possible that a hacker who gains access to your account in the future could take control of your Apple ID away from you entirely.
    You also should consider whether any confidential information might be stored in iCloud. If you have made the mistake of putting a list of passwords in the Notes app, for example, that list should be considered compromised, and all passwords should be changed (and removed from the Notes app).
    If you used the same password as your old iCloud password for other accounts, you need to change the password on all those accounts.
    You should also alert your contacts that your e-mail was compromised, so that they are cautious about trusting any attachments supposedly coming from you. Keep in mind that the spammer can continue to "spoof" your e-mail address on the From line of new e-mail messages, even without access to your e-mail account.

  • Combine files into one folder and send

    How do I combine separate PDFs into one folder which I can attach to an email and send as folder?  What adobe services do I need?

    You cannot email folders, unless you compress the whole folder into a ZIP file.  However, the zipped folder structure may not be compatible with other operating systems.
    Better just place all PDF docs into one ZIP file and send it like that.
    I don't think Adobe has any tools that can help you with that; unless Adobe Send contains something similar.

  • Storing files on an iPhone and sending email with attachments

    Can documents, such as PDF files, be stored on an iPhone and sent as attachments via email? The Windows mobile 6.5 makes this process very easy.

    LivingstonGlen wrote:
    Can documents, such as PDF files, be stored on an iPhone and sent as attachments via email? The Windows mobile 6.5 makes this process very easy.
    Since it can be done on an iPad and iPod touch, I see no reason why it couldn't be done on an iPhone.

  • Can someone hack into your ipad and send emails?

    there is an email in my sent (yahoo) mail that says "sent from ipad" but i didn't send it. how is that possible?

    There is no way to remotely control the iPad. If your Yahoo account was hacked, someone may have picked up one of your more recent emails sent from the iPad, and used the same signature. "Sent from iPad" is just a line of text that is put in there by default by Apple, but can easily be replicated or copied (or changed).

  • ALV report output to excel file, zip it and send to email

    my requirement is to run a report then the result will be sent to email. Attachment is an excel file that is zipped since file size is about 25MB
    I've search several forums and found a sap template in sending email with excel file attachment, it is BCS_EXAMPLE_7
    but it should be zipped, what i found is this CL_ABAP_ZIP, but with my understanding, the file needs to be in PDF format to be able to zip
    has anyone had the same requirement before?
    Would be thankful to your input guys, thanks!

    any ideas guys?

  • I've become increasingly frustrated with the ipad adobe app. I've subscribed to be able to convert my pdf files into word documents and it has yet to work I've paid for a service that does not work which in turn makes me a disgruntled customer to say the

    I've become increasingly frustrated with the ipad adobe app. I've subscribed to be able to convert my pdf files into word documents and it has yet to work I've paid for a service that does not work which in turn makes me a disgruntled customer to say the least very disappointed with such horrible service

    Which service did you subscribe to?  Adobe PDF Pack?
    Once I know the service that you subscribed to, I can move this post to the right forum so that you can get in touch with the folks who can assist you.

  • How to create xml file from Oracle and sending the same xml file to an url

    How to create xml file from Oracle and sending the same xml file to an url

    SQL/XML (XMLElement, XMLForest, XMLAgg, etc) and UTL_HTTP.
    Whether that works for you with the version of Oracle you have, your requirements, and needs is another story. A little detail goes a long way.

  • Convert PO into PDF format and send by an email to vendor

    We are using SAP version ECC 5.0. We want to convert SAP PO into PDF format and attached it in an email and send it to vendor. Please give me some tips to achieve this?
    Thanks in advance!
    Mrudula

    Hi!
    The way to achieve your goal depends on how you get PO printed - by sapscript, smartform or abap list.
    As have been mentioned you can create spool request and process it. But for sapscript and smartform you can proceed without spool request - just get back OTF data from corresponding FM and convert it to PDF.
    In case of smartform:
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = 'ZFORMNAME'
    IMPORTING
    fm_name = v_form_name
    EXCEPTIONS
    no_form = 1
    no_function_module = 2
    OTHERS = 3.
    w_ctrlop-getotf = 'X'.
    w_ctrlop-no_dialog = 'X'.
    w_compop-tdnoprev = 'X'.
    CALL FUNCTION v_form_name
    EXPORTING
    control_parameters = w_ctrlop
    output_options = w_compop
    user_settings = 'X'
    IMPORTING
    job_output_info = w_return
    EXCEPTIONS
    formatting_error = 1
    internal_error = 2
    send_error = 3
    user_canceled = 4
    OTHERS = 5.
    i_otf[] = w_return-otfdata[].
    In case of sapscript:
    options-tdgetotf = 'X'.
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
    options = options
    CALL FUNCTION 'CLOSE_FORM'
    IMPORTING
    RESULT =
    RDI_RESULT =
    TABLES
    otfdata = i_otf
    EXCEPTIONS
    unopened = 1
    bad_pageformat_for_print = 2
    send_error = 3
    spool_error = 4
    OTHERS = 5.
    Then convert to PDF
    DATA:
    pdf LIKE tline OCCURS 100 WITH HEADER LINE,
    v_len_in LIKE sood-objlen.
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
       format                      = 'PDF'
       max_linewidth               = 132
      ARCHIVE_INDEX               = ' '
    IMPORTING
       bin_filesize                =  v_len_in
        TABLES
          otf                         = i_otf
          lines                       = pdf
       EXCEPTIONS
         err_max_linewidth           = 1
         err_format                  = 2
         err_conv_not_possible       = 3
         OTHERS                      = 4
    Then send as attachment as Max proposed.
    Regards,
    Maxim.

  • I need my application to be able to open a .pdf file which was previously synced to the iBooks PFDs Collection. I then wish to remove the file from the collection and send it to email.

    I need my application to be able to open a .pdf file which was previously synced to the iBooks PFDs Collection. I then wish to remove the file from the collection and send it to email.

    I opened one of the PDF files in notepad and these are the first couple lines:
    瀖ᕁމጿ␠씴豈䧉筩롈ꓳ劏ꎯ僪뚢頟뻏즏谀㿃夑퀉꟠鲲쮂⫉笿褡밤籞冁탁ӓ轸뿐笼ⵆ횰䄌ඁ淥ة寨闤⬅鳦팥링빨嬄敎უ婏㣴ً鮓ࣿꢚ㑀녲莒඼ိȆ䕇纍쉉籶뺝갞伐쮠᥏﯒넉釖ȓ겴☧ ἣ秵駻�䣞띰㖔流羀籔朼敨ꢉ糶당⬤俉膇䄐惡�ಹꛖ鍡恡ⱶᶜ�堷﹑ﱌ僿걄뎔æ䋷귪⛢⫐䅪䉙὿烶ꖆ႟ᗔ瘞狻틫儩六잶覱낵듘盋崾�ᦜ㺆௹뻹燴ឋ騙쬄ꏿ뽒煹�钼뇲腎稦ꃲ㈃沒ꔈ뺐뛽첑䘶畱䍣紻 ⁜哠鳾

  • Send email notification including file name and description, when users upload files to particular sub-folders?

    In my site collection i have a document library and document library has customer folder, each Customer folder has 4 sub-folders. i want to send email notification with file name and description to group and users, if they upload any files to Particular
    folder name "Final" not others 3 folders. would it possible to accomplish this solution? if yes please suggest which way i can do that. 
    Note: we have different groups of people, for example Team A and Team B. if files uploaded by any member of Team A, notification should sent to only Team A and specific people not Team B.
    Thanks in advanced for any help!

    Hey Rakib,
    You can add your group and those other people in To field of send mail activity. Have below snapshot for your reference.
    If Current Item URL Contains FolderName (i.e. Final) & Is Current User a member of of Team A
    Send Email to Team A; People1; People2;
    Thanks. Please mark as an answer if it helps.

  • How can I embed a pdf file into the body of an email?

    How can I embed a pdf file into the body of an email?

    The problem is defining what it even means to “embed” a PDF file in the body of an e-mail, especially if you are dealing with a multiple page PDF file.
    E-mail is either pure text, rich text (something akin to RTF in Word), or HTML. PDF is not compatible with any of these. Thus, to embed a PDF file, something has to be converted and that means the PDF would be converted to a less graphically rich raster format. But is that what you would really want?
    I think that the MacOS and iOS e-mail clients do under some circumstances place an attached PDF file within HTML segments and by clicking on same, you get the equivalent of extracting the full PDF file, but I have no real experience with that.
    Another alternative is HTML with a proxy image with a hyperlink to an external PDF file that is invoked when you click on the hyperlink.
    Perhaps you can explain what you are really trying to accomplish and what the recipient of such an e-mail's actual experience would be?
              - Dov

  • Reg: HRforms converted to PDF and send email to individual employee

    Hi Experts,
    The requirement is convert the HR form output to pdf and send email to respective employee in standard transaction. I copied RPCEDTX0 to  ZRPCEDTX0 and include RPCEDS09 to ZRPCEDS09, the changes need to be done for individual PERNR, I have modified the include as shown below.
       CALL FUNCTION 'HRPY_PROCESS_SET_PERNR_STATUS' after this, i have written my code
    * start of changes ARAFIQUE
      DATA: formname TYPE tdsfname VALUE 'HR_ESS_PAYSLIP_TO_PDF',
            fm_name TYPE rs38l_fnam,
            pinfo LIKE pc407 OCCURS 0 WITH HEADER LINE,
            pform type tt_pc408,
            pform_l like pc408 OCCURS 0 WITH HEADER LINE.
      IF xform[] IS NOT INITIAL.
        pform_l = xform.
        APPEND pform_1 TO pform.
        pinfo-molga = '99'.
        pinfo-forml = 'ZACC'.
        APPEND pinfo.
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            formname                 = formname
    *       VARIANT                  = ' '
    *       DIRECT_CALL              = ' '
         IMPORTING
           fm_name                  = fm_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.
        CALL FUNCTION fm_name
          EXPORTING
            pinfo                      =
            pform                      = xform[]
    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.
      ENDIF.
    * end of changes ARAFIQUE
    I found out in internet that the smartform 'HR_ESS_PAYSLIP_TO_PDF' will convert to PDF and then i can send email to PERNRS.

    Hi Experts,
    I have written the below code, the payslip is getting converted to PDF and it is getting saved in presentation server. I need to pick this file and mail, I created a customized function module for sending mail. I'm not able to send email to external addresses.
    Please find my code below. I will post the function module later.
    * start of changes ARAFIQUE
      DATA: "formname TYPE tdsfname VALUE 'HR_ESS_PAYSLIP_TO_PDF',
            "fm_name TYPE rs38l_fnam,
            p_info LIKE pc407 OCCURS 0 WITH HEADER LINE,
            "pform type tt_pc408,
            p_form LIKE pc408 OCCURS 0 WITH HEADER LINE,
            pdf_content TYPE xstring,
            pdf_fsize TYPE i,
            lv_output_length TYPE i,
            lt_binary_data TYPE STANDARD TABLE OF sdokcntbin,
            it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
            it_message LIKE solisti1 OCCURS 0 WITH HEADER LINE.
      IF xform[] IS NOT INITIAL.
        p_form[] = xform[].
        p_info-molga = '99'.
        p_info-forml = 'ZACC'.
        p_info-pcols = 1.
        p_info-psize = 1.
        APPEND p_info.
        CALL FUNCTION 'CONVERT_PAYSLIP_TO_PDF'
          EXPORTING
            p_info      = p_info
          IMPORTING
            pdf_content = pdf_content
            pdf_fsize   = pdf_fsize
          TABLES
            p_form      = p_form[]
          EXCEPTIONS
            empty_form  = 1
            OTHERS      = 2.
        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 'SCMS_XSTRING_TO_BINARY'
          EXPORTING
            buffer        = pdf_content
          IMPORTING
            output_length = lv_output_length
          TABLES
            binary_tab    = lt_binary_data.
        CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
              filename                        = 'C:\Test\Testing.pdf'
              filetype                        = 'BIN'
            TABLES
              data_tab                        = lt_binary_data
    *     FIELDNAMES                      =
           EXCEPTIONS
             file_write_error                = 1
             no_batch                        = 2
             gui_refuse_filetransfer         = 3
             invalid_type                    = 4
             no_authority                    = 5
             unknown_error                   = 6
             header_not_allowed              = 7
             separator_not_allowed           = 8
             filesize_not_allowed            = 9
             header_too_long                 = 10
             dp_error_create                 = 11
             dp_error_send                   = 12
             dp_error_write                  = 13
             unknown_dp_error                = 14
             access_denied                   = 15
             dp_out_of_memory                = 16
             disk_full                       = 17
             dp_timeout                      = 18
             file_not_found                  = 19
             dataprovider_exception          = 20
             control_flush_error             = 21
             OTHERS                          = 22
        it_receivers-receiver = 'gmailid'.
        it_receivers-rec_type = 'U'.
        it_receivers-com_type = 'INT'.
        APPEND it_receivers .
        it_message-line = 'Test for sending email'.
        APPEND it_message.
        CALL FUNCTION 'ZSEND_MAIL_ATTACHMENT'
          EXPORTING
            v_file_path  = 'C:\Test\Testing.pdf'
            v_subject    = 'Test Mail'
          TABLES
            it_receivers = it_receivers[]
            it_message   = it_message[].
        IF sy-subrc EQ 0.
          COMMIT WORK.
    *   Push mail out from SAP outbox
          SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
        ENDIF.

  • Convert SAP spoolOR list to excel and send as an email attachment

    Hello All Masterminds ,
      Iu2019ve developed a utility, in which users has to maintain one u201CZu201D view where they can give any report name, type of attachment (PDF, XLS, TXT) and sender email addresses.u201DNote: thing to remember here is Iu2019m creating XLS,TXT,PDF format dynamicallyu201D 
    It is working fine for PDF. Iu2019m submitting the program and creating spool and converting it to PDF and sending to their emails as an attachment.  It looks fantastic. When Iu2019m doing the same thing for XLS it is showing messy output, I tried many functions and search lots of unanswered, unfinished SDN posts. I almost tried every single clue given in these posts but no luck. Email part is working fine using classes (  l_document = cl_document_bcs=>create_document , l_document->add_attachment , l_send_request->set_document( l_document ).,cl_sapuser_bcs=>create( l_uname ).,l_send_request->add_recipient,  l_send_request->set_send_immediately( '' ).  ) .
    My real deal is to create a beautiful XLS out put. I also tried FMs LIST_FROM_MEMORY and LIST_TO_ASCI but no-luck. I thought instead of spool if I use u201CSubmit  EXPORTING LIST TO MEMORY u201C option may be It works but BIG NO 
       Iu2019m sure some genius out there has done something like his , I ain`t genius that is why I am stuck   Please guys throw me some bones .  As I said, I am able to do most of the things. I need some magic code /answer which turns my messy, ugly unformatted excel sheet attachment to beautiful u201Cpiece of art u201CExcel output.
      Here are the FMs I tried so far with different combinations.
    CALL FUNCTION 'LIST_FROM_MEMORY'
    CALL FUNCTION 'LIST_TO_ASCI'
    CALL FUNCTION 'GUI_DOWNLOAD'
    CALL FUNCTION 'RSPO_DOWNLOAD_SPOOLJOB'
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
    CALL FUNCTION 'CONVERT_OTF'
    CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
    And logic like to get rid of things getting in Asci tables
    cl_abap_char_utilities=>newline.
    cl_abap_char_utilities=>horizontal_tab
    cl_abap_char_utilities=>VERTICAL_TAB
    cl_abap_char_utilities=>cr_lf
    FIELD-SYMBOLS: <lfs_table>,    " Internal table structure
                     <lfs_con>.      " Field Content
      DATA: l_text TYPE char1024.     " Text content for mail attachment
      DATA: l_con(50) TYPE c.        " Field Content in character format
    Columns to be tab delimeted
      LOOP AT FINAL ASSIGNING <lfs_table>.
        DO.
          ASSIGN COMPONENT sy-index OF STRUCTURE <lfs_table>
                 TO <lfs_con>.
          IF sy-subrc NE 0.
            CONCATENATE c_cr l_text INTO l_text.
            APPEND l_text TO i_attach.
            EXIT.
          ELSE.
            CLEAR: l_con.
            MOVE <lfs_con> TO l_con.
            CONDENSE l_con.
            IF sy-index = 1.
              CLEAR: l_text.
              MOVE l_con TO l_text.
            ELSE.
              CONCATENATE l_text l_con INTO l_text
                 SEPARATED BY c_tab.
            ENDIF.
          ENDIF.
        ENDDO.
      ENDLOOP.
    Posts : https://forums.sdn.sap.com/click.jspa?searchID=14756211&messageID=4401940
    https://forums.sdn.sap.com/click.jspa?searchID=14756211&messageID=4796657
    https://forums.sdn.sap.com/search.jspa?threadID=&q=convertspoolintoexcelformatforsendingmail&objID=c42&dateRange=all&numResults=30&rankBy=10001
    Will appreciate your help and time.
    Thanks,
    Saquib Khan

    Hi,
    i send excel-att like this.
    REPORT Z_EMAIL_CL_BCS MESSAGE-ID ZZ.
    More examples here BCS_EXAMPLE_* with 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.
    CONSTANTS: CON_NEWL TYPE ABAP_CHAR1 VALUE CL_ABAP_CHAR_UTILITIES=>NEWLINE,
               CON_TAB  TYPE ABAP_CHAR1 VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
    CONSTANTS: CON_NEWL TYPE X VALUE '0D', "OK for non Unicode
                CON_TAB  TYPE X VALUE '09'. "OK for non Unicode
    START-OF-SELECTION.
      PERFORM MAIN.
    END-OF-SELECTION.
    FORM MAIN.
      TRY.
        -------- create persistent send request ------------------------
          SEND_REQUEST = CL_BCS=>CREATE_PERSISTENT( ).
          PERFORM HEAD_CONT.
          PERFORM XLS_ATT.
        add document to send request
          CALL METHOD SEND_REQUEST->SET_DOCUMENT( DOCUMENT ).
        --------- set sender -------------------------------------------
          SENDER = CL_SAPUSER_BCS=>CREATE( SY-UNAME ).
          CALL METHOD SEND_REQUEST->SET_SENDER
            EXPORTING
              I_SENDER = SENDER.
        --------- set recipent -----------------------------------------
          RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS(
                                            'the email adress' ).
        add recipient with its respective attributes to send request
          CALL METHOD SEND_REQUEST->ADD_RECIPIENT
            EXPORTING
              I_RECIPIENT = RECIPIENT
              I_EXPRESS   = 'X'.
         RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS(
                                           'the email adress 2' ).
        add recipient with its respective attributes to send request
         CALL METHOD SEND_REQUEST->ADD_RECIPIENT
           EXPORTING
             I_RECIPIENT = RECIPIENT
             I_EXPRESS   = 'X'.
        ---------- send document ---------------------------------------
          CALL METHOD SEND_REQUEST->SEND(
            EXPORTING
              I_WITH_ERROR_SCREEN = 'X'
            RECEIVING
              RESULT              = SENT_TO_ALL ).
          COMMIT WORK.
        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'.
      CONCATENATE 'Betreffzeile am' SY-DATUM 'um' SY-UZEIT
      INTO SUBJECT SEPARATED BY SPACE.
      WA_TEXT = 'Hello!'.
      APPEND WA_TEXT TO IT_TEXT.
    WA_TEXT = 'dieses ist eine Testmail'.
    APPEND WA_TEXT TO IT_TEXT.
    WA_TEXT = 'Gruß'.
    APPEND WA_TEXT TO IT_TEXT.
      DESCRIBE TABLE IT_TEXT LINES N10.
      N10 = ( N10 - 1 ) * 255 + STRLEN( WA_TEXT ).
      IT_LENGHT = N10.
      DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
                I_TYPE    = ATT_TYPE
                I_TEXT    = IT_TEXT
                I_LENGTH  = IT_LENGHT
                I_SUBJECT = SUBJECT ).
    ENDFORM.                    "HEAD_CONT
    FORM XLS_ATT.
      DATA: BEGIN OF ITAB OCCURS 0,
            MATNR     LIKE MARA-MATNR,
            MTART     LIKE MARA-MTART,
            MATKL     LIKE MARA-MATKL,
            BRGEW     LIKE MARA-BRGEW,
          END   OF ITAB.
      DATA: BRGEW(18).
      CLEAR: IT_BIN[], WA_BIN, SUBJECT.
      SELECT MATNR MTART MATKL BRGEW INTO TABLE ITAB FROM MARA UP TO 10 ROWS.
      CONCATENATE 'Material'      CON_TAB
            'Materialart'   CON_TAB
            'Warengruppe'   CON_TAB
            'Bruttogewicht' CON_NEWL
              INTO WA_BIN.
      APPEND WA_BIN TO IT_BIN.
      LOOP AT ITAB.
        WRITE ITAB-BRGEW TO BRGEW.
        CONCATENATE ITAB-MATNR CON_TAB
                    ITAB-MTART CON_TAB
                    ITAB-MATKL CON_TAB
                         BRGEW CON_NEWL
                    INTO WA_BIN.
        APPEND WA_BIN TO IT_BIN.
      ENDLOOP.
      ATT_TYPE = 'XLS'.
      SUBJECT = 'My XLS attachment'.
      DESCRIBE TABLE IT_BIN LINES N10.
      N10 = ( N10 - 1 ) * 255 + STRLEN( WA_BIN ).
      IT_LENGHT = N10.
      CALL METHOD DOCUMENT->ADD_ATTACHMENT
        EXPORTING
          I_ATTACHMENT_TYPE    = ATT_TYPE
          I_ATT_CONTENT_HEX    = IT_BIN
          I_ATTACHMENT_SIZE    = IT_LENGHT
          I_ATTACHMENT_SUBJECT = SUBJECT.
    ENDFORM.                    "XLS_ATT
    Perhaps it helps.
    regards, Dieter

Maybe you are looking for