easyHtmlEmail
easyHtmlEmail copied to clipboard
Not possible to replace multiple time same variable at different place
Hi, In the template I have !SY-MANDT! at 2 different lines Only the first one is replaced. To avoid this I made a copy of the function module WWW_HTML_MERGER and with the line below
data lv_lines type i.
lv_lines = lines( html_table ).
loop at merge_table into merge_item.
do lv_lines times.
enddo.
endloop.
in replacement of
loop at merge_table into merge_item.
....
endloop.
and this works better.
Also to add a table I have changed the REPLACE_PLACEHOLDER
elseif replacement_type eq 'T'.
concatenate lv_string '<table class="table table-striped thead-default table-bordered" border="0" cellpadding="0" cellspacing="0" style="width: 100%; max-width: 100%; border: 1px solid #e2e8f0;"><thead> <tr>' cl_bcs_convert=>gc_crlf into lv_string.
lo_type_tab ?= cl_abap_typedescr=>describe_by_data( itab ).
lo_struct ?= lo_type_tab->get_table_line_type( ).
lt_component = lo_struct->get_components( ).
loop at lo_struct->components assigning <ls_component>.
concatenate lv_string '<th style="line-height: 24px; font-size: 16px; margin: 0; padding: 12px; border-color: #e2e8f0; border-style: solid; border-width: 1px 1px 2px;" align="left" valign="top">' <ls_component>-name '</th>' cl_bcs_convert=>gc_crlf
into lv_string.
endloop.
concatenate lv_string '</tr> </thead> <tbody>' cl_bcs_convert=>gc_crlf into lv_string.
loop at <lt> assigning <wa>.
concatenate lv_string '<tr>' space into lv_string.
do.
clear: lv_value.
assign component sy-index of structure <wa> to <any>.
if sy-subrc <> 0.
exit.
else.
lo_type ?= cl_abap_typedescr=>describe_by_data( <any> ).
dump_type <any> lo_type lv_value lv_convexit.
concatenate lv_string '<td style="line-height: 24px; font-size: 16px; margin: 0; padding: 12px; border: 1px solid #e2e8f0;" align="left" valign="top">' lv_value '</td>' cl_bcs_convert=>gc_crlf into lv_string.
endif.
enddo.
concatenate lv_string '</tr>' cl_bcs_convert=>gc_crlf into lv_string.
endloop.
concatenate lv_string '</tbody>' '</table>' cl_bcs_convert=>gc_crlf into lv_string.
Wouldn't it be easier to use two different nlaceholder names for the same variable?
go_easy_email->replace_placeholder(
EXPORTING
placeholder_name = '!mand_occurrence1!' " Placeholder to be replaced
replacement_type = 'R' " ('A','B','R',' ','T')control value & placeholder
single_value = mand " To be filled when 'A', 'B', 'R'
).
go_easy_email->replace_placeholder(
EXPORTING
placeholder_name = '!mand_occurrence2!' " Placeholder to be replaced
replacement_type = 'R' " ('A','B','R',' ','T')control value & placeholder
single_value = mand " To be filled when 'A', 'B', 'R'
).