‎2011 Aug 01 1:33 PM
Hi
I would like to know if is it possible to do something like follow: say I have a variable A with a value:
DATA A TYPE string VALUE 'VAR_X'.What I need is to make a test on another variable of the program that is VAR_X. So the question is, how can I 'understand' value of A and use it as a variable name?
thank you
Gabriele
‎2011 Aug 01 2:23 PM
I know the functinality of field-symbols to make something similar.
DATA: l_string TYPE string.
FIELD-SYMBOLS: <any> TYPE ANY.
l_string = 'fieldname'.
CONCATENATE 'strucname-' l_string INTO l_string.
ASSIGN (l_string) TO <any>.<any> contains now the value of strucname-fieldname. Maybe this is useful for you.
I do not know if this is just possible for structure or if it also works with simple variables.
Regards
EDIT: It works:
DATA: l_string TYPE string.
data: l_field type string value 'AAA'.
FIELD-SYMBOLS: <any> type any.
l_string = 'l_field'.
ASSIGN (l_string) TO <any>.
write: <any>.Output is 'AAA'.
Edited by: Maximilian Tews on Aug 1, 2011 3:25 PM
‎2011 Aug 01 2:23 PM
I know the functinality of field-symbols to make something similar.
DATA: l_string TYPE string.
FIELD-SYMBOLS: <any> TYPE ANY.
l_string = 'fieldname'.
CONCATENATE 'strucname-' l_string INTO l_string.
ASSIGN (l_string) TO <any>.<any> contains now the value of strucname-fieldname. Maybe this is useful for you.
I do not know if this is just possible for structure or if it also works with simple variables.
Regards
EDIT: It works:
DATA: l_string TYPE string.
data: l_field type string value 'AAA'.
FIELD-SYMBOLS: <any> type any.
l_string = 'l_field'.
ASSIGN (l_string) TO <any>.
write: <any>.Output is 'AAA'.
Edited by: Maximilian Tews on Aug 1, 2011 3:25 PM