09-22-2009 8:49 AM
Hi folks,
I need to send some internal table data to the mail as an attachment in TEXT format(.TXT). The attachment should consist of header, body (itab data in tab format) and a footer.
Presently i am able to send the mail with attachment, but the data in the notepad is not coming in a correct format.The data has been messed up and randomly distributed....Could any one seggest me how to convert internal table data to text file format..
Can anybody refer me some sample examples of it...
Thanks in advance,
Shyam.
Edited by: shyam prasad on Sep 22, 2009 9:50 AM
09-22-2009 8:53 AM
09-22-2009 9:02 AM
Hi Vijay,
Thanks for your answer.But it my report is an online report, and i canniot get it from spool. I need to convert it dynamically and then send as attachment.
Thanks,
Shyam.
09-22-2009 9:23 AM
Hii
Use the function module "SO_NEW_DOCUMENT_ATT_SEND_API1" please go through the documentation u can find a example also for this.
Regards,
Ravindra.
09-22-2009 8:55 AM
09-22-2009 12:09 PM
09-22-2009 12:16 PM
09-29-2009 2:14 PM
Hi,
Check this......
ls_doc_data LIKE sodocchgi1,
lt_packing_list TYPE TABLE OF sopcklsti1,
ls_packing_list TYPE sopcklsti1,
lt_mess_body TYPE TABLE OF solisti1,
ls_mess_body TYPE solisti1,
lt_receivers TYPE TABLE OF somlreci1 ,
ls_receivers TYPE somlreci1.
Header data of Mail
ls_doc_data-doc_size = 255.
ls_doc_data-obj_langu = sy-langu.
ls_doc_data-obj_name = 'SAPRPT'.
ls_doc_data-obj_descr = text-000.
ls_doc_data-sensitivty = 'F' .
Describe the body of the message
CLEAR : ls_packing_list,lt_packing_list.
REFRESH lt_packing_list.
ls_packing_list-transf_bin = space.
ls_packing_list-head_start = 1.
ls_packing_list-head_num = 0.
ls_packing_list-body_start = 1.
ls_packing_list-body_num = 11.
ls_packing_list-doc_type = 'RAW'.
APPEND ls_packing_list TO lt_packing_list.
populate message body
populate receiver table
Send email
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = ls_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = lt_packing_list
contents_txt = lt_mess_body
receivers = lt_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 s000.
ELSE.
MESSAGE i001.
ENDIF.