dynamic - Declare variable name dynamically -
the task create variable dynamic name. not type, name!
all ways proposed me (e.g. via cl_abap_typedescr
, cl_abap_elemdescr
classes) useless.
want implement semantically this, syntax incorrect:
create data (name) type var_type.
is there solution?
i think if 'name' declared field-symbol work.
effect statement declares symbolic field called . @ runtime, can assign concrete field field symbol using assign. operations performed field symbol directly affect field assigned it.
try 1 out:
data: b_1 type i, b_2 type i, b_3 type i, b_4 type i, num1(1) type n, fldname type fieldname. field-symbols: <fld> type i. 4 times. num1 = sy-index. concatenate 'b_' num1 fldname. assign (fldname) <fld>. <fld> = sy-index. enddo. write: b_1, b_2, b_3, b_4.
Comments
Post a Comment