‎2014 Sep 10 11:04 AM
Dear All,
I am using class CL_BCS to trigger mail. Whenever I am sending mail to other server (for example : gmail) the alignment of the body is irregular. Can anyone help me regarding this issue ??
Thanks and regards,
Megh
‎2014 Sep 10 11:10 AM
Hi,
it depends of the content of your mail, maybe you use an HTML content ?
regards
Fred
‎2014 Sep 10 11:19 AM
Hello Fred,
Thank you for your reply, actually for the content of the mail I have created a text object using tcode SO10 . I am just using the text object for filling up the body and sending the internal table to CL_BCS.
Can you please elaborate your solution ?
Thanks,
Megh
‎2014 Sep 10 11:35 AM
Hi,
Try this:
DATA: st_thead TYPE thead .
st_thead-tdobject = 'TEXT' .
st_thead-tdname = p_tdname .
st_thead-tdid = 'ST' .
st_thead-tdspras = 'E' .
DATA: it_itf_text TYPE tline_tab .
DATA: it_html_text TYPE htmltable .
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = st_thead-tdid
language = st_thead-tdspras
name = st_thead-tdname
object = st_thead-tdobject
IMPORTING
header = st_thead
TABLES
lines = it_itf_text
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc NE 0 .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 .
ENDIF.
DATA: html_text TYPE xstring .
CALL FUNCTION 'CONVERT_ITF_TO_HTML'
EXPORTING
i_header = st_thead
* I_PAGE = ' '
* I_WINDOW = ' '
* I_SYNTAX_CHECK = ' '
* I_REPLACE = 'X'
* I_PRINT_COMMANDS = ' '
* I_HTML_HEADER = 'X'
* I_FUNCNAME = ' '
* I_TITLE = ' '
* I_BACKGROUND = ' '
* I_BGCOLOR = ' '
* I_UNESCAPE_FORMATS =
* I_ESCAPE_SPACES = ' '
* I_ENCODING = ' '
IMPORTING
e_html_text = html_text
TABLES
t_itf_text = it_itf_text
t_html_text = it_html_text
EXCEPTIONS
syntax_check = 1
replace = 2
illegal_header = 3
OTHERS = 4
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
DATA: it_solix TYPE solix_tab .
CALL METHOD cl_bcs_convert=>xstring_to_solix
EXPORTING
iv_xstring = html_text
RECEIVING
et_solix = it_solix.
CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type = 'HTM'
i_subject = p_sbjct
i_hex = it_solix
RECEIVING
result = ob_document_bcs.
Regards.
‎2014 Sep 10 12:54 PM
Dear Fred,
Thanks for your solution. Actually I didnt needed to change the text to HTML. In call method cl_document_bcs i have passed i_type as 'HTM' and i_text as body. It worked perfectly. Anyways thanks for your help.
Megh