If you want a suitable & maintainable code, I advise you to separate html content and ABAP content. For that you can use the SAP Web Repository.
First write your html page
Local - fl
...
You can insert placeholder like and replace them with ABAP variables in the driver program.
Secondly download it in the SAP Web Repository with the transaction SMW0
Finally load your html page with appropriate function module in your driver program
call function 'WWW_HTML_MERGER'
exporting
template = 'YOUR_SWR_HTML_ID_TEXT'
* MERGE_TEXTPOOL =
* TEMPLATE_TABLE =
importing
html_table = lv_text
changing
merge_table = lt_merge
exceptions
template_not_found = 1
others = 2.
if sy-subrc <> 0.
raise exception type cx_swf_mail_manager.
endif.
change argument TEMPLATE by your template ID in SAP Web Repository
html placeholder are replaced in the internal table lt_merge