Professional Documents
Culture Documents
P_FORM->VARHEADER
stxftxt
report zz_test_replace_textsymbol.
* Global symbol
data: y type c length 5 value 'Lucky'.
start-of-selection.
perform start.
* ---
form start.
data: lt_text type tsftext,
ls_text type tline.
* Prepare example text
ls_text-tdline = 'Happy &X& &Y&'.
append ls_text to lt_text.
* Set individual symbol
call function 'SET_TEXTSYMBOL'
exporting
name = '&X&'
value = 'Go'.
* Set textsymbol for resolving globals
call function 'SET_TEXTSYMBOL_PROGRAM'
exporting
PROGRAM = sy-repid
event = 'OPEN_FORM'.
* Replace
data: lv_endline type i.
lv_endline = lines( lt_text ).
call function 'REPLACE_TEXTSYMBOL'
exporting
startline = 1
endline = lv_endline
tables
lines = lt_text.
read table lt_text into ls_text index 1.
write: / ls_text-tdline. " Prints 'Happy Go Lucky' "
endform. "start