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: 

Working with Fields in Field Symbols

Former Member
0 Kudos

Dear Gurus,

LOOP AT <selopt_range_table> ASSIGNING <selopt_range_line>.

I mean <selopt_range_line>-low is what I want but It will give me syntax error saying <selopt_range_line> is not a structure of table so has no value. In debug mode I can see that value but it will give me a syntax error if I say something like <selopt_range_line>-lowu2026. so let me know how do I.

Thanks in Advance,

Regards,

Satya

1 ACCEPTED SOLUTION

peter_ruiz2
Active Contributor
0 Kudos

Hi Satya,

1. create another field symbol.

FIELD-SYMBOLS: <field> TYPE ANY.

2. Assign the field like this.

ASSIGN COMPONENT 'Low' OF STRUCTURE <selopt_range_line> TO <field>.

you may now use the field symbol <field> like this:

[variable] = <field>.

Regards,

Peter

6 REPLIES 6

Former Member
0 Kudos

Hi,

It seems there is problem in structure mismatch between structure of table and work area.

Thanks,

Asit Purbey.

asik_shameem
Active Contributor
0 Kudos

Hi

Since it is a dynamic structure, it wont have the filed LOW while doing syntax check.

So you have to assign the field dynamically using ASSIGN COMPONENT.

Declare a FS,

FIELD-SYMBOLS: <gfs_field> TYPE ANY.

LOOP AT <selopt_range_table> ASSIGNING <selopt_range_line>.

ASSIGN COMPONENT 'LOW' OF <selopt_range_line> TO <gfs_field>.

IF sy-subrc = 0.

" Process <gfs_field>

ENDIF.

..

ENDLOOP.

peter_ruiz2
Active Contributor
0 Kudos

Hi Satya,

1. create another field symbol.

FIELD-SYMBOLS: <field> TYPE ANY.

2. Assign the field like this.

ASSIGN COMPONENT 'Low' OF STRUCTURE <selopt_range_line> TO <field>.

you may now use the field symbol <field> like this:

[variable] = <field>.

Regards,

Peter

I355602
Advisor
Advisor
0 Kudos

Former Member
0 Kudos

If you want to access field of a structure then you have to declare field symbols using

FIELD-SYMBOLS <FS> [<type>|STRUCTURE <s> DEFAULT <wa>].

else you can declare it as any and should use offset method to read required value from field sysmbol.

Hope this will help to clear your doubts.

Edited by: Sunil Sawaikar on Mar 13, 2009 6:20 AM

Former Member
0 Kudos

Solved it

thanks a lot