Application Development and Automation 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: 
Read only

problem send mail

Former Member
0 Likes
966

Hi guys,

i have a problem. When i send an e-mail and i put the text in the body of page, the receiver reads the text as attachment. Why?

Thanks...

1 ACCEPTED SOLUTION
Read only

prince_isaac
Active Participant
0 Likes
906

hie

if u are using FM

 SO_NEW_DOCUMENT_ATT_SEND_API1 

the message body is passed to contexts_txt.

regards

Isaac Prince

10 REPLIES 10
Read only

Former Member
0 Likes
906

Probably you are sending data in wrong table.

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
906

Hi

May be you are using the Function Module :SO_NEW_DOCUMENT_ATT_SEND_API1

instaed SO_NEW_DOCUMENT_SEND_API1

Regards,

Sreeram

Read only

0 Likes
906

CONCATENATE 'list records processed' sy-datum6(2) sy-datum4(2) sy-datum(4) INTO it_objtxt

SEPARATED BY space.

APPEND it_objtxt.

DESCRIBE TABLE it_objtxt LINES tab_lines.

READ TABLE it_objtxt INDEX tab_lines.

doc_chng-doc_size = ( tab_lines - 1 ) * 255 + strlen( it_objtxt ).

doc_chng-obj_descr = 'Testing Message display'.

doc_chng-obj_langu = sy-langu.

doc_chng-obj_expdat = sy-datum + 3 .

doc_chng-sensitivty = 'P'.

doc_chng-obj_prio = 1.

  • doc_chng-no_change = 'X'.

doc_chng-priority = 1.

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

document_data = doc_chng

put_in_outbox = 'X'

sender_address_type = 'U'

commit_work = 'X'

TABLES

packing_list = objpack

  • object_header = objhead

contents_bin = it_objbin

CONTENTS_TXT = it_objtxt

receivers = 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

.

Edited by: francesco aiello on Sep 17, 2009 11:40 AM

Read only

0 Likes
906

Hi

Can u try

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

document_data = doc_chng

put_in_outbox = 'X'

sender_address_type = 'U'

commit_work = 'X'

TABLES

CONTENTS_TXT = it_objtxt

receivers = 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

Regards,

Sreeram

Read only

0 Likes
906

Hi,

What ever is assigned to contents_txt will apear in the body of the mail and what ever is assigned to contents_bin will be the attachement in the FM SO_DOCUMENT_SEND_API1. Check and assign accordingly.

Regards,

Vikranth

Read only

Former Member
0 Likes
906

This message was moderated.

Read only

venkat_o
Active Contributor
0 Likes
906

Hi,

Try this way.

<font color=blue><pre> REPORT zvenkat_mail_simple.

"Variables

DATA :

g_sent_to_all TYPE sonv-flag,

g_tab_lines TYPE i.

"Types

TYPES:

t_document_data TYPE sodocchgi1,

t_packing_list TYPE sopcklsti1,

t_attachment TYPE solisti1,

t_body_msg TYPE solisti1,

t_receivers TYPE somlreci1.

"Workareas

DATA :

w_document_data TYPE t_document_data,

w_packing_list TYPE t_packing_list,

w_attachment TYPE t_attachment,

w_body_msg TYPE t_body_msg,

w_receivers TYPE t_receivers.

"Internal Tables

DATA :

i_document_data TYPE STANDARD TABLE OF t_document_data,

i_packing_list TYPE STANDARD TABLE OF t_packing_list,

i_attachment TYPE STANDARD TABLE OF t_attachment,

i_body_msg TYPE STANDARD TABLE OF t_body_msg,

i_receivers TYPE STANDARD TABLE OF t_receivers.

PARAMETERS:p_mail TYPE char120.

"start-of-selection.

START-OF-SELECTION.

"Subject of the mail.

w_document_data-obj_name = 'MAIL_TO_HEAD'.

w_document_data-obj_descr = 'Simple mail using SAP ABAP'.

"Body of the mail

w_body_msg = 'Hi,'.

APPEND w_body_msg TO i_body_msg.

CLEAR w_body_msg.

w_body_msg = 'This is body of the mail.'.

APPEND w_body_msg TO i_body_msg.

CLEAR w_body_msg.

"Write Packing List (Body)

DESCRIBE TABLE i_body_msg LINES g_tab_lines.

w_packing_list-head_start = 1.

w_packing_list-head_num = 0.

w_packing_list-body_start = 1.

w_packing_list-body_num = g_tab_lines.

w_packing_list-doc_type = 'RAW'.

APPEND w_packing_list TO i_packing_list.

CLEAR w_packing_list.

"Fill the document data and get size of attachment

READ TABLE i_body_msg INTO w_body_msg INDEX g_tab_lines.

w_document_data-doc_size = ( g_tab_lines - 1 ) * 255 + STRLEN( w_body_msg ).

"Receivers List.

w_receivers-rec_type = 'U'. "Internet address

w_receivers-receiver = p_mail.

w_receivers-com_type = 'INT'.

w_receivers-notif_del = 'X'.

w_receivers-notif_ndel = 'X'.

APPEND w_receivers TO i_receivers .

CLEAR:w_receivers.

"Function module to send mail to Recipients

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = w_document_data

put_in_outbox = 'X'

commit_work = 'X'

IMPORTING

sent_to_all = g_sent_to_all

TABLES

packing_list = i_packing_list

contents_txt = i_body_msg

receivers = i_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 i303(me) WITH 'Mail has been Successfully Sent.'.

ELSE.

WAIT UP TO 2 SECONDS.

SUBMIT rsconn01 WITH mode = 'INT' WITH output = 'X' AND RETURN.

ENDIF.</pre></font>

Thanks

Venkat

Read only

prince_isaac
Active Participant
0 Likes
907

hie

if u are using FM

 SO_NEW_DOCUMENT_ATT_SEND_API1 

the message body is passed to contexts_txt.

regards

Isaac Prince

Read only

0 Likes
906

refresh it_mess_bod.

move 'Fattura vendita biglietti' to it_mess_bod.

append it_mess_bod.

CLEAR it_mess_bod.

CLEAR objpack-transf_bin.

objpack-head_start = 1.

objpack-head_num = 0.

objpack-body_start = 1.

DESCRIBE TABLE it_mess_bod LINES objpack-body_num.

objpack-doc_type = 'RAW'.

objpack-obj_descr = <f_tab_alv>-CU_UNIT.

APPEND objpack.

DESCRIBE TABLE it_mess_bod LINES tab_lines.

READ TABLE it_mess_bod INDEX tab_lines.

doc_chng-doc_size = ( tab_lines - 1 ) * 255 + strlen( it_mess_bod ).

doc_chng-obj_descr = ltxt.

doc_chng-obj_langu = sy-langu.

doc_chng-obj_expdat = sy-datum + 3 .

doc_chng-sensitivty = 'P'.

doc_chng-obj_prio = 1.

  • doc_chng-no_change = 'X'.>Z

doc_chng-priority = 1.

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

document_data = doc_chng

put_in_outbox = 'X'

sender_address_type = 'U'

commit_work = 'X'

TABLES

packing_list = objpack

  • object_header = objhead

contents_bin = it_objbin

CONTENTS_TXT = it_mess_bod

receivers = 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

.

Edited by: francesco aiello on Sep 17, 2009 12:15 PM

Edited by: francesco aiello on Sep 17, 2009 12:23 PM

Read only

0 Likes
906

Hello gurus,

I also got the same issue.

Please tell the changes that need to do.

regards,

padmaja.