02-07-2007 9:32 AM
Hi all,
is it possible to create field-symbol, whose name is dynamic created?
f.e. depend on entries in specific colum in customizing table .
(loop at custom_tab into custom_stru.
field-symbols: <custom_stru-name> type any....
endloop.)
02-07-2007 9:40 AM
Hi
No u can't do it, you can only create a field-symbol with the same type, but only if the type is defined in dictionary:
FIELD-SYMBOLS: <MY_FIELD> TYPE ANY.
LOOP AT CUSTOM_TAB INTO CUSTOM_STRU.
ASSIGN (CUSTOM_STRU-NAME) TO <MY_FIELD>.
ENDLOOP.
Max
02-07-2007 9:52 AM
Juzio,
check below code
REPORT demo_field_symbols_stat_assign .
FIELD-SYMBOLS: <f1> TYPE ANY, <f2> TYPE i.
DATA: text(20) TYPE c VALUE 'Hello, how are you?',
num TYPE i VALUE 5,
BEGIN OF line1,
col1 TYPE f VALUE '1.1e+10',
col2 TYPE i VALUE '1234',
END OF line1,
line2 LIKE line1.
ASSIGN text TO <f1>.
ASSIGN num TO <f2>.
DESCRIBE FIELD <f1> LENGTH <f2>.
WRITE: / <f1>, 'has length', num.
ASSIGN line1 TO <f1>.
ASSIGN line2-col2 TO <f2>.
MOVE <f1> TO line2.
ASSIGN 'LINE2-COL2 =' TO <f1>.
WRITE: / <f1>, <f2>.
Pls. mark if useful.