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

HTML E-Mails with Standard Paragraphs

Former Member
0 Likes
4,771

I am writing an ABAP which sends out emails in an html format with a few standard paragraphs in it and then some data I am looping though.  Everything works great – however I would like to find a way to “house” these standard paragraphs somewhere so I don’t have to include this in text elements in the ABAP.  I tried storing it in SO10 and the text is retrieved however any of the paragraph breaks are ignored and the sentences run together.  Does anyone have any suggestions or is the only want to do this through text elements?  Just as an fyi, this is the type of e-mail code I am using

send_request = cl_bcs=>create_persistent( ).     

send_request->set_priority( i_priority = '1' ).   
document
= cl_document_bcs=>create_document(
           i_type   
= 'HTM'
           i_text   
= t_email_body
           i_subject
= email_subject ).

send_request
->set_document( document )

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
0 Likes
3,848

Hi,

Here you indicate your code to send the HTML, but the interesting part is how do you convert your "standard text" (SO10) into HTML? For that, you may use CONVERT_ITF_TO_HTML function module.

Regards,

Sandra

8 REPLIES 8
Read only

Sandra_Rossi
Active Contributor
0 Likes
3,849

Hi,

Here you indicate your code to send the HTML, but the interesting part is how do you convert your "standard text" (SO10) into HTML? For that, you may use CONVERT_ITF_TO_HTML function module.

Regards,

Sandra

Read only

0 Likes
3,848

Good question and I should have included this.  I create the Standard Text with SO10 and then I read it with the function READ_TEXT.

   CALL FUNCTION 'READ_TEXT'
    EXPORTING
      id                      = 'ST'
      language          = 'EN'
      name                = p_mytext

      object               = 'TEXT'
    TABLES
      lines                   = i_tline

Does CONVERT_ITF_TO_HTML read from SO10 and if not then where would I store these "Standard Paragraphs".  Also do you have some sample code at all by any chance.  thx for your help!

Read only

0 Likes
3,848

You must keep READ_TEXT which reads the standard text, which is in ITF format (see by debug your i_tline data object). Moreover, add IMPORTING HEADER = ls_header. You have to convert the ITF into HTML by using the function module CONVERT_ITF_TO_HTML.

You should get something like that, more or less:

DATA lt_htmlline TYPE TABLE OF htmlline.
CALL FUNCTION 'CONVERT_ITF_TO_HTML'
  EXPORTING
    I_HEADER = ls_header
    I_HTML_HEADER = space
  TABLES
    T_ITF_TEXT = i_tline
    t_html_text = lt_htmlline.
CONCATENATE LINES OF lt_htmlline INTO t_email_body.

Sandra

Message was edited by: Matthew Billingham - minor correction

Read only

0 Likes
3,848

Thank  you very much!  I just have one more problem and that is how it is converting the Line spacing.  It is double spacing the lines and I am assuming this is the because of the Paragraphs html codes.  Do you have any suggestions on what I can do to fix this?

Text in SO10

Hello,

This is Line 1.

This is Line2.

This is Line 3

HTML From Convert Function

<P>Hello,</P>

<P></P>

<P>This is Line 1.</P>

<P>This is Line 2.</P>

<P>This is Line 3.</P>

It is coming out double spaces as follows

Hello,

This is Line 1.

This is Line 2.

This is Line 3.

Read only

0 Likes
3,848

Hi,

Here the HTML is correct. So I guess the issue is from the software that renders the HTML.

Sandra

Read only

0 Likes
3,848

thx so much for your help!

Read only

0 Likes
3,848

This message was moderated.

Read only

0 Likes
3,848

This message was moderated.