‎2007 Jan 19 2:13 PM
Hi!
I need a <b>placeholder for my variable</b>, and this is the situation:
Output fields on screen: OUT1, OUT2, etc. Instead of hard-coding
OUT1 = 'some_text'.
OUT2 = 'some_text'....can I use a placeholder for the variable name of the itself, e.g.
data: fieldname(4) value 'OUTX', sytabix(1).
loop at i_text.
sytabix = sy-tabix.
move sytabix to fieldname+3(1). "OUT1, OUT2, OUT3 etc.
<fieldname> = i_text-text. "meaning OUT1 | OUT2... = i_text-text.
endloop.Thanks for all help!
- Mari Virik
‎2007 Jan 19 2:29 PM
You can use FIELD-SYMBOLS. Together with CONCATENATE (to create fieldname) you should be able to do it.
‎2007 Jan 19 2:46 PM
Hi!
Thank you for your advice
I have tried to use <fs>, but I can't seem to get it quite right... Perhaps you can give me a code example?
- Mari Virik
‎2007 Jan 19 3:21 PM
field-symbols : <fs>.
data : begin of t_out occurs 0,
f1(5),
end of t_out.
data : begin of fl_name,
x1(7) value 't_out-f',
x2(1) type n,
end of fl_name.
t_out-f1 = 'AA1'.
append t_out.
t_out-f1 = 'AA2'.
append t_out.
t_out-f1 = 'AA3'.
append t_out.
loop at t_out.
fl_name-x2 = sy-tabix.
assign (fl_name) to <fs>.
write 😕 fl_name, <fs>.
endloop.
‎2007 Jan 22 11:34 AM