‎2006 Jul 17 9:08 AM
Hi All,
I'm using function module SO_NEW_DOCUMENT_ATT_SEND_API1 for sending data in internal table to an email address with excel sheet attachment .
The problem is in attachment i'm not getting the data in formatted.
The whole data which is in internal table is being populated in the first cell of the excel sheet only.
How can we format the data in the excel sheet.
Thanks & Regards,
Anil.
‎2006 Jul 17 9:11 AM
check....
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME =
FILETYPE = 'ASC'
APPEND = ' '
<b> WRITE_FIELD_SEPARATOR = ','</b>
‎2006 Jul 17 9:31 AM
‎2006 Jul 17 9:59 AM
hi,
Check out this Link
http://www.sapdevelopment.co.uk/reporting/email/attach_xlsmod.htm
Regards,
Santosh
‎2006 Jul 17 9:38 AM
Check the link below for how it works......
/people/thomas.jung3/blog/2004/09/07/sending-e-mail-from-abap--version-46d-and-lower--api-interface
Also check the Code below
REPORT test.
DATA: att_size TYPE i, " att Size
att_itab_size TYPE i, " Attachment size
mailtxt_size TYPE i. " Text in mail size
DATA:
it_mailpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE, " Dist details
it_mailhead LIKE solisti1 OCCURS 1 WITH HEADER LINE," Header data
it_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE, " Rec List
it_mailtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE, " Mail Text
it_att_data LIKE solisti1 OCCURS 0 WITH HEADER LINE, " Attachment data
it_doc_att LIKE sodocchgi1. " Attri of new doc
* Text in the mail.
it_mailtxt-line = ' This is a test mail, Line Number--1'.
APPEND it_mailtxt.
it_mailtxt-line = ' This is a test mail, Line Number--2' &
' This is a test mail, Line Number--2'.
APPEND it_mailtxt.
it_mailtxt-line = ' This is a test mail, Line Number--3' &
' This is a test mail, Line Number--3' &
' This is a test mail, Line Number--3'.
APPEND it_mailtxt.
DESCRIBE TABLE it_mailtxt LINES mailtxt_size.
* Create the att File
concatenate 'Attachment Line Number 1' space into it_att_data-line.
APPEND it_att_data.
concatenate 'Attachment Line Number 2' space into it_att_data-line.
APPEND it_att_data.
concatenate 'Attachment Line Number 3' space into it_att_data-line.
APPEND it_att_data.
DESCRIBE TABLE it_att_data LINES att_itab_size.
* Attributes of new doc
CONCATENATE 'Attach' space 'mail'
INTO it_doc_att-obj_descr SEPARATED BY space.
it_doc_att-sensitivty = 'F'.
it_doc_att-doc_size = mailtxt_size * 255.
* Create Pack to text in mail body.
it_mailpack-transf_bin = space.
it_mailpack-head_start = 1.
it_mailpack-head_num = 0.
it_mailpack-body_start = 1.
it_mailpack-body_num = mailtxt_size.
it_mailpack-doc_type = 'RAW'.
APPEND it_mailpack.
* Create Pack for Attach.
it_mailpack-transf_bin = 'X'.
it_mailpack-head_start = 1.
it_mailpack-head_num = 1.
it_mailpack-body_start = 1.
it_mailpack-body_num = att_itab_size.
it_mailpack-doc_type = 'XLS'.
CONCATENATE 'My' space 'Attachment' INTO it_mailpack-obj_descr.
it_mailpack-doc_size = att_itab_size * 255.
APPEND it_mailpack.
it_reclist-receiver = 'yourname@domain.com'.
it_reclist-express = 'X'.
it_reclist-rec_type = 'U'.
it_reclist-notif_del = 'X'. " request delivery notification
it_reclist-notif_ndel = 'X'. " request not delivered notification
APPEND it_reclist.
* Call FM to send email
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = it_doc_att
put_in_outbox = 'X'
TABLES
packing_list = it_mailpack
object_header = it_mailhead
contents_txt = it_mailtxt
contents_bin = it_att_data
receivers = it_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.Cheers,
Thomas.
‎2007 Apr 12 9:10 AM
Hi Anil,
I'm facing a similar issue as you've mentioned in this case 'SO_NEW_DOCUMENT_ATT_SEND_API1'. Have u solved this issue??? If so could you please help me out...Even I'm getting all the contents of ITAB in a single Cell in EXCEL sheet....
Thanks
Ramky.G
‎2011 May 30 10:26 AM
Use Function module
CALL FUNCTION 'SO_RAW_TO_RTF' " raw to normal data type
TABLES
objcont_old =
objcont_new = .
Cheers,
MAhesh
‎2022 Jun 27 12:53 PM
You have to do alignment for the internal table data using concatenate and condense statements and pass it to contents bin.. you have to loop the internal table and inside that use concatenate statements..and in this FM . only 255 char is allowed in contents bin..you will be required to wrirte multiple concatenate.


sample images attached for rteference.
‎2022 Jun 27 12:56 PM
You post answer on a ... 16 years old question
You post the code using picture instead of using the button [CODE]
and you give a solution for a FM to NOT BE USED for a very long time ago