04-21-2008 4:13 PM
i have used this program for sending mail through SAP.It has two options.First for sending as an html attachement,second for plain text inline with the body of the message.Actually i need the message in html format inline with the body of the message itself(not as an attachement)
In simple words the body of the message want to be in html format,not an attachement..
&----
*& Report ZMAIL *
*& *
&----
*& *
*& *
&----
report zmail .
tables: soos1.
*type-pools: sbdst.
parameters: report like varis-report obligatory.
parameters: variant like varis-variant obligatory.
parameters:reptitle like soos1-recrem obligatory.
select-options: recnam for soos1-recrem obligatory.
*{ INSERT EDPK900415 1
selection-screen skip 1.
selection-screen begin of block b1 with frame title text-001.
selection-screen begin of line.
parameters: r1 radiobutton group g1.
selection-screen comment:5(40) text-003 for field r1.
selection-screen position 35.
selection-screen end of line.
selection-screen begin of line.
parameters: r2 radiobutton group g1.
selection-screen comment: 5(40) text-002 for field r2.
selection-screen end of line.
selection-screen end of block b1.
*} INSERT
data: begin of html_tab occurs 0.
include structure w3html.
data: end of html_tab.
data : it_pack_list like soxpl occurs 0 with header line.
data: begin of html_tab_converted occurs 0,
line(255) type c,
end of html_tab_converted.
data: listobject like abaplist occurs 20 with header line.
data: abap_list like abaplist occurs 20 with header line.
data: icontab(32) occurs 10 with header line.
data: lineno type i, length type i, size type i,
l_filename like rlgrap-filename.
data: icon_wa type icon,
internal type icon-internal,
existing type c.
data: my_bds type ref to cl_bds_document_set,
key type sbdst_object_key,
files type sbdst_files,
wa type bapifiles.
data: filename type string,
filefilter type string,
path type string,
fullpath type string.
data: user_action type i.
data: cur_guicopdepage(4) type c.
data: gui_codepage(4) type n, " added for message 500824
is_unicode type rststype-sel_ok.
data: convert_output type xstring,
convert_buffer type xstring.
data i type i.
data tablength type i.
data dummy type i.
data list_index like sy-lsind .
data begin of new_pack_list occurs 10.
include structure soxpl.
data end of new_pack_list.
data : owner like soud-usrnam.
data: fg_sysdli like sonv-flag,
fg_folrg like soxdl-folrg,
dli_tab_save like soxdl occurs 20 with header line.
data: rec_count like sy-tabix.
data: object_type like sood-objtp value 'RAW'.
data: object_hd_change like sood1 occurs 0 with header line.
data: objcont like soli occurs 0 with header line.
data: attcont_tab like soli occurs 0 with header line.
data: atthead_tab like soli occurs 0 with header line.
data so_ali like soli occurs 100 with header line.
data document_data like sodocchgi1.
data msg_text(80) type c. "Message text
data: length type i, size type i.
data profile like soprd.
data subrc like sy-subrc value 0.
data so_ali_hex type standard table of solix. "note 604603
data: objpara like selc occurs 0 with header line.
data: objparb like soop1 occurs 0 with header line.
data: receivers like soos1 occurs 0 with header line.
*data: receivers like soos5 occurs 0 with header line.
data: r_dliq type c. "Shared Distrbution List
data: r_dlip type c. "Private Distrbution list
data: rep_title(50) type c. "Report Title
data : begin of dis_lst occurs 10. "Internal table to store DL
include structure sodm1.
data : end of dis_lst.
data : begin of listtab occurs 100. "Internal Table for List CONTAINER
include structure abaplist.
data : end of listtab.
data : begin of downtab occurs 1,
line(255),
end of downtab.
data ls_cnt type n.
data:begin of it_mailid occurs 0,
mailid(100), " TYPE ZSENDINT_MAILID-MAILID,
end of it_mailid.
data c1.
c1 = ' '.
shift reptitle left deleting leading c1.
*SELECT MAILID FROM ZSENDINT_MAILID INTO TABLE IT_MAILID WHERE SUBJECT = REPTITLE AND FLAG <> 'X'.
"IF SY-SUBRC = 0.
"CLEAR RECNAM.
"REFRESH RECNAM.
"LOOP AT IT_MAILID.
"MOVE 'I' TO RECNAM-SIGN.
"MOVE 'EQ' TO RECNAM-OPTION.
"MOVE IT_MAILID-MAILID TO RECNAM-LOW.
"APPEND RECNAM.
"ENDLOOP.
"ENDIF.
*S.KARTHIKRAJA 07.10.2006
call function 'LIST_FREE_MEMORY'
tables
listobject = listobject
exceptions
others = 1.
submit (report)
using selection-set variant
exporting list to memory and return.
import listobject from memory id '%_LIST'.
if listobject[] is initial.
exit.
endif.
call function 'WWW_HTML_FROM_LISTOBJECT'
exporting
REPORT_NAME =
template_name = 'WEBREPORTING_REPORT'
tables
html = html_tab
listobject = listobject
listicons = icontab.
call function 'LIST_TO_ASCI'
exporting
list_index = -1
tables
listasci = downtab
listobject = listobject
exceptions
empty_list = 1
list_index_invalid = 2
others = 3.
call function 'TABLE_COMPRESS' "Schneller Tabellencopy
tables
in = listobject
out = so_ali. "note 604603
out = so_ali_hex. "note 604603
call function 'SO_SOLIXTAB_TO_SOLITAB' "note 604603
exporting
ip_solixtab = so_ali_hex[]
importing
ep_solitab = so_ali[].
call function 'SO_DLI_LIST_READ_XDL'
exporting
private = 'X'
public = 'X'
subscript = 'X'
tables
dli_display_tab = dli_tab_save
exceptions
communication_failure = 1
dl_list_no_entries = 2
owner_not_exist = 3
system_failure = 4
x_error = 5
parameter_error = 6
others = 7.
call function 'SO_DLI_EXPAND'
exporting
system_dli = fg_sysdli
convert = 'X'
tables
member = dis_lst
objpara = objpara
objparb = objparb
exceptions
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
dl_name_not_exist = 4
folder_not_exist = 5
folder_no_authorization = 6
forwarder_not_exist = 7
object_not_exist = 8
object_no_authorization = 9
operation_no_authorization = 10
owner_not_exist = 11
parameter_error = 12
recurrency_exist = 13
substitute_not_active = 14
substitute_not_defined = 15
system_failure = 16
x_error = 17
others = 18.
refresh receivers.
clear receivers.
move sy-datum to receivers-rcdat .
move sy-uzeit to receivers-rctim.
refresh object_hd_change.
object_hd_change-objla = sy-langu. "Language
object_hd_change-objcp = ' '. " Object can be changed byUSER
object_hd_change-objsns = 'F'. " Msg Sensitivity private orbusiness
object_hd_change-objdes = reptitle.
object_hd_change-objnam = object_hd_change-objdes.
append object_hd_change.
if r1 = 'X'.
move html_tab[] to objcont[].
else.
move downtab[] to objcont[].
endif.
describe table objcont lines i.
it_pack_list-head_start = 1.
it_pack_list-head_num = 0.
it_pack_list-body_start = 1.
it_pack_list-body_num = i.
it_pack_list-OBJTP = 'RAW'.
move variant to it_pack_list-objnam.
move variant to it_pack_list-objdes.
move 'HTM' to it_pack_list-file_ext.
append it_pack_list.
loop at html_tab.
call function 'SCP_TRANSLATE_CHARS'
exporting
inbuff = html_tab
outcode = gui_codepage
csubst = 'X'
substc_space = 'X'
substc = '00035'
importing
outbuff = convert_output
exceptions
invalid_codepage = 1
internal_error = 2
cannot_convert = 3
fields_bad_type = 4
others = 5.
concatenate convert_buffer convert_output into convert_buffer in
byte mode.
endloop.
i = 0.
describe field html_tab_converted length tablength in byte mode.
while i < xstrlen( convert_buffer ).
dummy = xstrlen( convert_buffer ) - i.
if tablength > dummy.
html_tab_converted-line = convert_buffer+i(dummy).
else.
html_tab_converted-line = convert_buffer+i(tablength).
endif.
i = i + tablength.
append html_tab_converted.
endwhile.
receivers-sel = 'X'.
receivers-sndex = ' '. "
receivers-sndpri = '1'. "Priority of the message
receivers-deliver = ' '.
receivers-not_deli = ' '.
receivers-read = ' '.
receivers-recnam = 'U-'.
receivers-mailstatus = 'E'.
receivers-sortclass = '5'.
receivers-recesc = 'U'. " U means Internet Address
receivers-SAP_BODY = 'X'.
receivers-sndart = 'INT'.
loop at recnam.
receivers-adr_name = recnam-low.
receivers-recextnam = recnam-low.
append receivers.
endloop.
owner = sy-uname.
if r1 = 'X'.
call function 'SO_OBJECT_SEND'
exporting
object_hd_change = object_hd_change
object_type = object_type
outbox_flag = 'X'
owner = owner
sender = sy-uname
tables
receivers = receivers
packing_list = it_pack_list
att_cont = objcont
att_head = atthead_tab
exceptions
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
x_error = 20
others = 21.
else.
call function 'SO_OBJECT_SEND'
exporting
object_hd_change = object_hd_change
object_type = object_type
outbox_flag = 'X'
owner = owner
sender = sy-uname
tables
objcont = objcont
receivers = receivers
exceptions
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
x_error = 20
others = 21.
endif.
commit work.
call function 'SO_DEQUEUE_UPDATE_LOCKS'.
04-21-2008 4:51 PM
i have not gone thru your source code fully.
maintain the text in Tcode SO10.
use the fn module READTEXT* to read the contents of the text.
cheers
jayanthi.K