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

Allignment Problem In Class CL_BCS

meghomallar_das
Participant
0 Likes
1,262

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

4 REPLIES 4
Read only

FredericGirod
Active Contributor
0 Likes
831

Hi,

it depends of the content of your mail, maybe you use an HTML content ?

regards

Fred

Read only

0 Likes
831

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

Read only

rosenberg_eitan
Active Contributor
0 Likes
831

Hi,

As said html to the rescue.

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.

Read only

meghomallar_das
Participant
0 Likes
831

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