Hi Chris,
Try the below code.
data: lv_hash(1) value '#',
lv_spch(1) value '~',
lv_cnt type i.
data: lv_char(2).
loop at itab.
replace all OCCURRENCES of lv_hash in itab-str with lv_spch replacement count lv_cnt.
do lv_cnt times.
lv_char = lv_hash && sy-index.
replace lv_spch in itab-str with lv_char.
enddo.
endloop.
Make sure the special character you use, will not be in the string.
Thanks,
Vamshi