‎2009 Jan 27 8:29 AM
Hi Folks!
I got a little problem with moving data.
I'm using ref to data for a general data definition. Unfortunately after I create the data using a certain type, let's say 'A', I cant move the data of the created data to a structure of type 'A'. (It can also be type 'B'; that depends on the user input; thats why I am using ref to data).
Is there a way to move the data from the cre3ated structure to the static type structure?
I'm looking forward to reading from you
Best Regards!
‎2009 Jan 27 4:09 PM
Hey Kamil,
You can use a field symbol to move the data like this:
data: dyn_struc type ref to data.
stat_struc type A.
field-symbols <fs> type data.
create data dyn_struc type A.
assign dyn_struc->* to <fs>.
stat_struc = <fs>.
Of course, this will only work if dyn_struc was actually created with type A. Otherwise, the last line will cause a runtime error.
Best regards,
Erik
‎2009 Jan 27 4:09 PM
Hey Kamil,
You can use a field symbol to move the data like this:
data: dyn_struc type ref to data.
stat_struc type A.
field-symbols <fs> type data.
create data dyn_struc type A.
assign dyn_struc->* to <fs>.
stat_struc = <fs>.
Of course, this will only work if dyn_struc was actually created with type A. Otherwise, the last line will cause a runtime error.
Best regards,
Erik
‎2009 Jan 28 7:56 AM
Hi !
Thanks a lot !! That solved my problem.
What tried to do was to move the REF TO DATA to the static structure. (doh)
Then I assigned each component of both structures to a field symbol and moved the data then, but I never thought about moving the whole assigned structure field symbol to the static fields.
Thanks a lot!
Best regards,
Kamil
‎2009 Jan 27 4:25 PM
Hi
Can't u create it dynamically?
DATA W_DYN TYPE REF TO DATA.
CREATE DATA W_DYN TYPE (<TYPE>).If u can know the type of structure B, u can use it in order to create the variable dynamically.
Max