Showing results for 
Search instead for 
Did you mean: 

Convert HTML to plain text?

Product and Topic Expert
Product and Topic Expert
0 Kudos


for a multipart e-mail I want to convert HTML into plain text in ABAP. This means e.g. to remove the <tags> and replace <br>, <p> with CR/LF and more.

Do I have to reinvent this coding on my own or can I use something?

Thanks very much for any ideas!

Best regards,


Accepted Solutions (0)

Answers (1)

Answers (1)

Active Contributor
0 Kudos

Hallo Oliver,

Probably in the end you will have to do some inventing yourself. Let me give some bits and pieces.

Probably as first step, put in the CR/LF sequences.


    OF ' sequences.

  WHILE line CP '<>*'.

    offset = sy-fdpos.

    IF line CA '>'. ENDIF.

    length = sy-fdpos + 1.

    CONCATENATE line0(offset) linelength(*) INTO line.


  CONDENSE line.

However, I am not sure if you will be totally happy with such output. It is not bad. Have used it myself once before.

As final idea, consider an HTML encoding, just to be sure

  line = CL_HTTP_UTILITY=>ESCAPE_HTML( line ).

bye, brian