Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Field Symbols - How to access deep structures??

former_member445996
Participant
0 Kudos

Please look at the code below and give me some suggestions:

I have a deep structure which contains some fields and a table which contains three fields and a table

let's say the name of my structure is my_struct and the structure of my struct is as follows

field_A type c

field_B type c

table_A

--> table

--> field_1

--> feld_2

--> field_3

Below is the code !!!!!

field-symbols: <my_fs> type any.

field-symbols: <fs1> type any

data: my_ref type ref to data.

create data my_ref type my_struct.

assign my_ref->* to <my_fs>.

now field-symbol my_fs is pointing to my_struct. I have been able to access fields field_A and field_B using

assign component field_A of structure <my_fs> to <fs1>.

<fs1> = 'A'

unassign <fs1>

assign component field_B of structure <my_fs> to <fs1>.

<fs1> = 'B'

unassign <fs1>

but my issue is that I have not been able to acces table_A and it's fields

Can anyone suggest how I can access the table and it's fields and also how to populate those fields?

Thanks in advance for your help.

2 REPLIES 2

naimesh_patel
Active Contributor
0 Kudos

You can access your fields in the deep structure them like this:


field-symbols: <fs_tab>  type any.

assign component table_A of structure <my_fs> to <fs_tab>.
loop at <fs_tab> assigning <fs_line>.
assign component fieldA_tablA of structure <fs_line> to <fs1>.
<fs1> = 'B'
unassign <fs1>.
endloop.

Regards,

Naimesh Patel

0 Kudos

Thanks Naimesh for the suggestion. I tried this but it did not work. Loop will not work as there are no records in the table. My objective is to add records to the table. Any idea how I can accomplis it?

Thanks again for your help.