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: 

Assigining a field of field symbol to variable.

rahul2000
Contributor
0 Kudos

Dear friends,

in my field symbol <FS_DYN_TABLE_TEMP> i have a field named US_VAL which i want to assign to a variable.

but when i give <FS_DYN_TABLE_TEMP> -US_VAL it throws a syntax error sayin:-

"The data object "<FS_DYN_TABLE_TEMP>" has no structure and therefore no component called "US_VAL". called "US_VAL"."

How do i assign this to a variable.?

2 REPLIES 2

Former Member
0 Kudos

Hi Rahul,

is <FS_DYN_TABLE_TEMP> this a dynamic internal table which you are using?.

if yes,

First you have to create a work area for your dynamic internal table and then with that dynamic internal table you should access the data in that dynamic table to put into another variable.

creating work area for your dynamic internal <FS_DYN_TABLE_TEMP>.

field-symbols: <dynline> type any.

data: wa_dyntable type ref to data.

create data wa_dyntable like line of <dyntable>.

assign wa_dyntable->* to <dynline>.

here, <dyntable> is the dynamic internal table.

(but <dyline> will act like a header line.)

say suppose this dynamic internal table <dyline> has 3 components,

F1 F2 F3.

then you can take the data into some field-symbol by,

field-symbols : <fs1>.

assign component 'F1' of structure <dynline> to <fs1>.

here, <fs1> will have the same characteristics of F1 field of <dyntable> [as <dyline> has the header line F1 F2 F3].

<fs1> = wa_data-matnr.[pushing the required value into <fs1>.]

Former Member
0 Kudos

Hi Rahul,

Look below for example how to assignn value to field symbol.Hope this would help you.

Reward if useful.

Thnkx.

DATA: NUM TYPE I VALUE 12.

FIELD-SYMBOLS: <F1>,

<F2> TYPE I,

<F3> LIKE NUM.

ASSIGN: NUM TO <F1>,

NUM TO <F2>,

NUM TO <F3>.

WRITE: / ‘Line 1:’, NUM, <F1>, <F2>, <F3>.

<F1> = 32.

WRITE: / ‘Line 2:’, NUM, <F1>, <F2>, <F3>.