Skip to Content
0
Former Member
Apr 08, 2013 at 06:18 PM

Dynamic Internal table without classes or reference ?

39 Views

Hi Experts,

I need to dynamically update a field in a internal table from another internal table. The field and table name will be dynamic. Below is the code I am trying to run. I do not want classes or ref to.

I want the fname (fieldname) and value_new from t_input and update the internal table t_KNA1 according to the field and value selected from t_input.

Below is the code.

t_input :

tabname type cdpos-tabname (. Table Name)

fname type cdpos-fname (field name)

value_new type cdpos-value)_new.

field-symbols : <fs_table> type any,

<fs_fld> type any,

<fs_val> type any.

assign t_input to <fs_table>.

LOOP AT t_input." ASSIGNING <fs_table>.

CASE t_input-tabname.

WHEN 'KNA1'.

select * from kna1 into table t_kna1 where kunnr = t_input-objectid. (kunnr)

* <fs_fld> = t_input-fname.

ASSIGN COMPONENT t_input-fname of STRUCTURE <fs_table> to <fs_val>.

move t_input-value_new to <fs_val>.

* modify TABLE t_kna1 from <fs_table>.

WHEN 'KNVV'.

ENDCASE.

ENDLOOP.

Thanks

Rahul