2013 Jun 10 7:24 AM
Hello,
I am in middle of something where I need to get the value of a variable by referencing it.
For example -
Data: gv_var_val type c length 1,
gv_var_name type c length 10.
At run-time I will have gv_var_name = 'GV_VAR_VAL'. but I will need to get the value of a "GV_VAR_VAL" which might be 0/1/2/3......
I tried field-symbols but failed to manage it properly ....
can u please assist me a little?
Thanks,
Ravi Sonar.
2013 Jun 10 7:46 AM
2013 Jun 10 7:31 AM
move 'GV_VAR_VAL' to w_field (char 20).
assign (w_field) to <field>
and now <field> contain the value of GV_VAR_VAL.
regards
Fred
2013 Jun 10 7:35 AM
Hi,
As suggested, using assign statement with () will help you to get value.
2013 Jun 10 7:43 AM
Hi Ravindra,
Field symbols are the direct memory locations for the values of the field.These are just like pointers.
so by using field symbols you can achieve it.
Thanks & Regards,
Pavan.N
2013 Jun 10 7:46 AM
2013 Jun 10 8:04 AM
Thanks Frederic, thanks Raymond.....
Was confused in Round Brackets
Solved....
2014 Feb 07 6:29 AM
Another way of doing it
DATA: DREF TYPE REF TO CHAR5,
DATA TYPE C LENGTH 5 VALUE 'TEXT1'.
GET REFERENCE OF DATA INTO DREF.
WRITE / DREF->*.