‎2009 Jan 15 4:12 PM
Hi,
How can i do for assigning a value of field symbol to char or internal table?
SAP version ECC6.0
Thanks
‎2009 Jan 15 4:18 PM
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...
‎2009 Jan 15 4:25 PM
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.
‎2009 Jan 15 4:38 PM
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..............
‎2009 Jan 15 4:52 PM
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
‎2009 Jan 15 4:56 PM
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
‎2009 Jan 15 4:57 PM
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.
‎2009 Jan 15 5:29 PM
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.
‎2009 Jan 15 7:26 PM
Hi Simo,
Did you try my code. It should work. It has worked for me.
Plz let me know.
Thanks
Geetha
‎2009 Jan 16 12:09 PM
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
‎2009 Jan 16 12:55 PM
‎2009 Jan 16 1:21 PM
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