2018 Nov 19 2:42 PM
Hello experts,
i want to assign dynamic value to dynamic field.
my code is like
assign (lv_field1) to <any>."this is value like 70.000
assign lv_field2 to <any2>."this is field like <output>-field1
<any2> = <any>.
I wanna see <output>-field1 = 70.000. But its not working.
Thanks,
2018 Nov 19 3:10 PM
This works. Does it help?
DATA:
BEGIN OF struc1,
field1 TYPE int4,
END OF struc1,
BEGIN OF struc2,
field2 TYPE int4,
END OF struc2.
struc1-field1 = 70000. " 70.000
DATA(lv_field1) = 'STRUC1-FIELD1'.
ASSIGN (lv_field1) TO FIELD-SYMBOL(<any>).
DATA(lv_field2) = 'STRUC2-FIELD2'.
ASSIGN (lv_field2) TO FIELD-SYMBOL(<any2>).
<any2> = <any>.
WRITE <any2>. " 70.000
Hello experts,
i want to assign dynamic value to dynamic field.
my code is like
assign (lv_field1) to <any>."this is value like 70.000
assign lv_field2 to <any2>."this is field like <output>-field1
<any2> = <any>.
I wanna see <output>-field1 = 70.000. But its not working.
Thanks,
2018 Nov 19 3:10 PM
This works. Does it help?
DATA:
BEGIN OF struc1,
field1 TYPE int4,
END OF struc1,
BEGIN OF struc2,
field2 TYPE int4,
END OF struc2.
struc1-field1 = 70000. " 70.000
DATA(lv_field1) = 'STRUC1-FIELD1'.
ASSIGN (lv_field1) TO FIELD-SYMBOL(<any>).
DATA(lv_field2) = 'STRUC2-FIELD2'.
ASSIGN (lv_field2) TO FIELD-SYMBOL(<any2>).
<any2> = <any>.
WRITE <any2>. " 70.000
2018 Nov 28 11:40 AM
Thanks Jascha,
Your answer was usefull.
so i had to assign lv_field2 like;
(lv_field2) to field-symbol(<any2>).
not like;
lv_field2 to field-symbol(<any2>) .
2018 Nov 19 4:07 PM
" dynamic assign Here <any> reference the field whose name is content/value of lv_field1
assign (lv_field1) to <any>.
" static assignment - here <any2> reference the field lv_field2, so <any2> is not very useful?
assign lv_field2 to <any2>.What were you trying to do? (Look at online help for ASSIGN - mem_area)
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |