Skip to Content
0
Feb 19, 2014 at 06:42 AM

Error in Mail body

369 Views

hi Experts,

Am trying to send mail in HTML format but am unable to send mail body (which i read from SO10) using FM read_text ..please check my code n let me know the solution..

data : wa_header type sodocchgi1.

*** Contents Data

data : it_content type standard table of solisti1 initial size 0,

wa_content type solisti1,

*** Receivers Data

it_receivers type standard table of somlreci1 initial size 0,

wa_receivers type somlreci1,

it_para type standard table of soparai1 initial size 0,

wa_para type soparai1.

data: v_hyperlink type cfx_hyperlink.

data: v_hyperlink1 type cfx_hyperlink.

data wa_objhead type soli_tab.

data : flines type table of tline,

w_flines like line of flines.



wa_receivers-receiver = 'notarealperson@notarealdomain.com'.

wa_receivers-rec_type = 'U'.

wa_receivers-com_type = 'INT'.

append wa_receivers to it_receivers.

clear: wa_receivers.

data : i_objpack type table of sopcklsti1,

w_objpack type sopcklsti1.

wa_header-obj_prio = 1.

wa_header-priority = 1.

wa_header-obj_langu = sy-langu.

wa_header-obj_descr = 'Mail with SAP SDN link'.

concatenate 'Dear ' 'SDN ' into wa_content-line separated by ''.

append wa_content to it_content.

clear wa_content.

v_hyperlink = 'http://--------------------/sap/bc/webdynpro/sap/zcrm_post_sales'.

append wa_content to it_content.

v_hyperlink1 = '?sap-language=EN&activity_code=MDAwNw==&Duration=Mg==&partner=MjAwMDAwMDAwMg==&Object_id=MDAwMDAwMDAxMA=='.

concatenate '<a href=' v_hyperlink v_hyperlink1 '> click here </a>' into wa_content-line.

append wa_content to it_content.

clear wa_content.

data : i_sopcklsti1 type table of sopcklsti1,

wa_sopcklsti1 type sopcklsti1.

wa_sopcklsti1-body_start = 'Teseting body'.

append wa_sopcklsti1 to i_sopcklsti1.

call function 'READ_TEXT'

exporting

* CLIENT = SY-MANDT

id = 'ST'

language = sy-langu

name = 'ZCRM_POST_SALES'

object = 'TEXT'

tables

lines = flines.


loop at flines into w_flines..

w_objtxt = w_flines-tdline .

condense w_flines-tdline .

append w_objtxt to i_objtxt.

clear w_objtxt.

endloop.

describe table i_objtxt lines v_lines_txt.

read table i_objtxt into w_objtxt index v_lines_txt.

wa_doc_chng-doc_size = v_lines_txt * 255. " 255

clear w_objpack-transf_bin.

w_objpack-head_start = 1 .

w_objpack-head_num = 0 .

w_objpack-body_start = 1 .

w_objpack-body_num = v_lines_txt.

w_objpack-doc_type = 'HTM'.

append w_objpack to i_objpack.

clear w_reclist.

w_reclist-receiver = wa_lead_final-smtp_addr.

w_reclist-rec_type = 'U'.

* i_reclist-blind_copy = 'X'.

append w_reclist to i_reclist.

call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'

exporting

document_data = wa_doc_chng

put_in_outbox = 'X'

commit_work = 'X'

* IMPORTING

* SENT_TO_ALL =

* NEW_OBJECT_ID =

tables

packing_list = i_objpack

object_header = wa_objhead

* CONTENTS_BIN = I_OBJBIN

contents_txt = i_objtxt

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

Message was edited by: Matthew Billingham - removed email address