Skip to Content
author's profile photo Former Member
Former Member

Send Mail attaching an xls file with two sheets in it.

Hi Friends,

Need some urgent help

I have two internal tables which should be downloaded into two sheets of an .xls file.

and this .xls file with two sheets should be attached to the mail.

Am able to send an xls file with one sheet to mail.But am not able to send it with two sheets to mail.

Pls help me <removed by moderator>

Bye

RAHUL

Edited by: Mike Pokraka on Aug 4, 2008 2:47 PM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 04, 2008 at 02:09 PM

    data: itcpo like itcpo,

    tab_lines like sy-tabix.

    • Variables for EMAIL functionality

    data: maildata like sodocchgi1.

    data: mailpack like sopcklsti1 occurs 2 with header line.

    data: mailhead like solisti1 occurs 1 with header line.

    data: mailbin like solisti1 occurs 10 with header line.

    data: mailtxt like solisti1 occurs 10 with header line.

    data: mailrec like somlrec90 occurs 0 with header line.

    data: solisti1 like solisti1 occurs 0 with header line.

    perform send_form_via_email.

    ************************************************************************

    • FORM SEND_FORM_VIA_EMAIL *

    ************************************************************************

    form send_form_via_email.

    clear: maildata, mailtxt, mailbin, mailpack, mailhead, mailrec.

    refresh: mailtxt, mailbin, mailpack, mailhead, mailrec.

    • Creation of the document to be sent File Name

    maildata-obj_name = 'TEST'.

    • Mail Subject

    maildata-obj_descr = 'Subject'.

    • Mail Contents

    mailtxt-line = 'Here is your file'.

    append mailtxt.

    • Prepare Packing List

    perform prepare_packing_list.

    • Set recipient - email address here!!!

    mailrec-receiver = mail id.

    mailrec-rec_type = 'U'.

    append mailrec.

    • Sending the document

    call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    exporting

    document_data = maildata

    put_in_outbox = ' '

    tables

    packing_list = mailpack

    object_header = mailhead

    contents_bin = mailbin

    contents_txt = mailtxt

    receivers = mailrec

    exceptions

    too_many_receivers = 1

    document_not_sent = 2

    operation_no_authorization = 4

    others = 99.

    endform.

    ************************************************************************

    • Form PREPARE_PACKING_LIST

    ************************************************************************

    form prepare_packing_list.

    clear: mailpack, mailbin, mailhead.

    refresh: mailpack, mailbin, mailhead.

    describe table mailtxt lines tab_lines.

    read table mailtxt index tab_lines.

    maildata-doc_size = ( tab_lines - 1 ) * 255 + strlen( mailtxt ).

    • Creation of the entry for the compressed document

    clear mailpack-transf_bin.

    mailpack-head_start = 1.

    mailpack-head_num = 0.

    mailpack-body_start = 1.

    mailpack-body_num = tab_lines.

    mailpack-doc_type = 'RAW'.

    append mailpack.

    mailhead = 'TEST.TXT'.

    append mailhead.

    • File 1

    mailbin = 'This is file 1'.

    append mailbin.

    describe table mailbin lines tab_lines.

    mailpack-transf_bin = 'X'.

    mailpack-head_start = 1.

    mailpack-head_num = 1.

    mailpack-body_start = 1.

    mailpack-body_num = tab_lines.

    mailpack-doc_type = 'XLS'.

    mailpack-obj_name = 'TEST1'.

    mailpack-obj_descr = 'Subject'.

    mailpack-doc_size = tab_lines * 255.

    append mailpack.

    *File 2

    mailbin = 'This is file 2'.

    append mailbin.

    data: start type i.

    data: end type i.

    start = tab_lines + 1.

    describe table mailbin lines end.

    mailpack-transf_bin = 'X'.

    mailpack-head_start = 1.

    mailpack-head_num = 1.

    mailpack-body_start = start.

    mailpack-body_num = end.

    mailpack-doc_type = 'XLS'.

    mailpack-obj_name = 'TEST2'.

    mailpack-obj_descr = 'Subject'.

    mailpack-doc_size = tab_lines * 255.

    append mailpack.

    endform.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 04, 2008 at 02:36 PM

    This message was moderated.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.