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: 

Assign a value to a feild in dynamic work area

Former Member
0 Kudos

field-symbols: <dyn_table> type standard table,

<dyn_wa>,

<dyn_field>.

loop at <dyn_table> into <dyn_wa>.

do.

assign component sy-index

of structure <dyn_wa> to <dyn_field>.

if sy-subrc <> 0.

exit.

endif.

if sy-index = 1.

write:/ <dyn_field>.

else.

write: <dyn_field>.

endif.

enddo.

endloop.

In <Dyn_table> i have created feilds F1, F2,F3 dynamicly and so in <dyn_wa> . with this code i can read the feilds F1,F2,F3 from <Dyn_WA> but what if i want assign a value to it like

<Dyn_table> -F1 = 123 " This code is not working as feilds are added dynamicly to it ....

Please advice how we can do <Dyn_table> -F1 = 123 some thing like this

3 REPLIES 3

Former Member
0 Kudos

Hi,

Assign a blank structure to FS_TAB with fields F1 F2 and F3.

Then you can address FS_TAB-F1.

Hope this helps,

Raj

Former Member
0 Kudos

hello Rajat,

thanks for your intrest .. but the proble we dont now how many feilds will be there in the (It's dynamicly done at runtime ) so creating the sturtue is also a ?

Former Member
0 Kudos

Hi Rajat,

I hope this problem might have already solved..

In other case..

--> Create fieldcatalog for internal table

--> From Fieldcatalog you can get the position of the fields, Hence u can use

ASSIGn Composinent <position> of structure <> to <fs>.

--> after this, you can directly pass ur value to <fs>

<fs> = '20'.

Cheers,

Nag