Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Sending internal table data to the mail as attachment in text format

Former Member
0 Kudos

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

7 REPLIES 7

Former Member
0 Kudos

Hi Shyam ,

Use this thread to solve your issue.

Regards,

Vijay

0 Kudos

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.

0 Kudos

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.

former_member404244
Active Contributor
0 Kudos

Hi,

Check the below link

http://www.sapdev.co.uk/reporting/email/emailhome.htm

Regards,

Nagaraj

Former Member

vallamuthu_madheswaran2
Active Contributor
0 Kudos

EFG_GEN_SEND_EMAIL try this FM

Thanks & regards,

Vallamuthu.M

Former Member
0 Kudos

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.