Hi Chris,
Hope it helpful.
Report ZDEMO.
data: lv_data type string.
data: begin of itab occurs 0,
value(100) type c,
end of itab,
count type i,
index type string,
lv_output type string.
field-symbols: <fs> like line of itab.
start-of-selection.
lv_data = 'You need # keyboard and # screens '.
split lv_data at '#' into table itab.
loop at itab assigning <fs>.
if <fs>(01) NE ' '.
lv_output = <fs>.
else.
ADD 1 to count.
move count to index.
concatenate lv_output '#' index <fs> into lv_output.
endif.
endloop.
write lv_output.
Regards,
Venkat.