‎2009 Nov 18 11:50 AM
Using below code i want to send email body(t_body) as well html attachment(so_ali), But am receiving only attachment,
email body is missing, plz suggest where is the mistake in my code ASAP.
Thanks a lot in advance
Prepare the data.
plist-transf_bin = 'X'.
plist-head_start = 0.
plist-head_num = 0.
plist-body_start = 0.
plist-body_num = 0.
plist-doc_type = 'RAW'.
plist-obj_descr = 'Sairam'.
APPEND plist.
plist-transf_bin = 'X'.
plist-head_start = 0.
plist-head_num = 0.
plist-body_start = 1.
plist-doc_type = real_type.
DESCRIBE TABLE so_ali LINES plist-body_num.
Get the size.
READ TABLE so_ali INDEX plist-body_num.
plist-doc_size = ( plist-body_num - 1 ) * line_size
+ STRLEN( so_ali ).
APPEND plist.
plist-transf_bin = 'X'.
plist-head_start = 0.
plist-head_num = 0.
plist-body_start = 1.
plist-doc_type = 'RAW'.
wa_body-line = 'This is first line of email'.
append wa_body to t_body.
wa_body-line = 'This is second line of email'.
append wa_body to t_body.
DESCRIBE TABLE t_body LINES plist-body_num.
Get the size.
READ TABLE t_body into wa_body INDEX plist-body_num.
plist-doc_size = ( plist-body_num - 1 ) * line_size
+ STRLEN( wa_body ).
Move the receiver address.
MOVE: p_email TO rec_tab-receiver,
'U' TO rec_tab-rec_type.
APPEND rec_tab.
IF NOT sp_lang IS INITIAL.
document_data-obj_langu = sp_lang.
ELSE.
document_data-obj_langu = sy-langu.
ENDIF.
v_name = emailid
Subject.
document_data-obj_descr = 'Subject '.
Send the email.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = document_data
sender_address = v_name
sender_address_type = 'SMTP'
commit_work = 'X'
TABLES
packing_list = plist
contents_bin = so_ali
contents_txt = t_body
receivers = rec_tab
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.
‎2009 Nov 19 6:20 AM
Hi,
For email body please pass transf_bin as blank. plist is basically like a header information which contains the details of the data you are sending in the email, both body and attachment. When the transf_bin field is X it is interpreted as info on attachment .. when space it is info on body.
Also you have to pass the number of lines in the email body in the field plist-body_num.
plist-transf_bin = 'X'. -> need to make this blank
plist-head_start = 0.
plist-head_num = 0.
plist-body_start = 1.
plist-doc_type = 'RAW'.
wa_body-line = 'This is first line of email'.
append wa_body to t_body.
wa_body-line = 'This is second line of email'.
append wa_body to t_body.
‎2009 Nov 19 7:12 AM
‎2009 Nov 19 7:12 AM