Application Development and Automation 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: 
Read only

fields symbol

Former Member
0 Likes
1,130

Hi,

How can i do for assigning a value of field symbol to char or internal table?

SAP version ECC6.0

Thanks

11 REPLIES 11
Read only

Former Member
0 Likes
1,091

When you assign a field-symbol with any variable then any changes in its value would reflect in the variables value.

For example if you have assigned it with an independent variable or with any column of internal table with the statement ASSIGN <fs>... then <fs> = 'value'

This 'value' would reflect in the respective variable...

All you have to do is MODIFY itab...

Read only

Former Member
0 Likes
1,091

Hi,

for example, assign a field symbol to an internal table:

DATA :

i_table TYPE TABLE OF SFLIGHT.

FIELD-SYMBOLS :

<fs> TYPE SFLIGHT.

LOOP AT i_table ASSIGNING <fs>.

...

ENDLOOP.

Read only

0 Likes
1,091

No me i want to do the opposite:

i have <fs> type any. the fs is filled (table).

I want move the content (records of <fs>) in an internal table or char(250) for example.

The program dump when i put: move <fs> to char or to table..............

Read only

0 Likes
1,091

Hi Simo,

Try this way.

Loop at itab assigning <FS>.

<FS>-text = 'Add Text to Internal table itab'.

endloop.

In our first statement the the itab work area is assigned as <FS> so reference is made.

Now when you change the contents in this reference automatically the internal table value also changes.

Hope this would have helped you.

Thanks,

Prashanth

Read only

0 Likes
1,091

Hi

Say if you have value in a field symbol <fs>.

declare a character

DATA: value(60) TYPE C.

IF NOT <fs> IS INITIAL.

value = <fs>.

ENDIF.

This should work for assigning a value from a field symbol to the character.

I shall check for assigning to any table & let you know soon.

Thanks

Geetha

Read only

0 Likes
1,091

You will have to assign the <fs> with appropriate variable at first...then u can move the data..

If it is of different tupe thenit will giv u a dump.

Read only

0 Likes
1,091

THE CODE:

data: v_char(1025).

<fs> type any.

move <fs> to v_char.

The runtime error is: OBJECTS_MOVE_NOT_SUPPORTED

Short text

Conversion of type "v" to type "C" not supported.

Read only

0 Likes
1,091

Hi Simo,

Did you try my code. It should work. It has worked for me.

Plz let me know.

Thanks

Geetha

Read only

0 Likes
1,091

Hi,

For your code, You first need to assign some variable to field symbol.

Have a look.

data char(3) type c.

field-symbols : <fs> type any.

assign char to <fs>.

<fs> = 'aaa'.

move <fs> to char.

write : / char.

like this it is working.

Regards,

Seema

Read only

Former Member
0 Likes
1,091

This message was moderated.

Read only

0 Likes
1,091

Thanks so much for all your answers.

I found the solution for my problem.

If you are interested, this is the syntax what i need :

LOOP AT <l_t_messtab> ASSIGNING <l_s_messtab>.

ASSIGN COMPONENT 'T_MSG' OF STRUCTURE <l_s_messtab> TO <l_box>.

move <l_box> to CHAR.

etc..............

endloop.

FIELD-SYMBOLS:

<l_t_messtab> TYPE table,

<l_s_messtab> TYPE ANY,

<l_box> TYPE C.

NB: <l_t_messtab> is complexed structure alimented by standard program.

Available for more information