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: 

Dynamic data name

Former Member
0 Kudos

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.)

2 REPLIES 2

Former Member
0 Kudos

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

Former Member
0 Kudos

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.