Application Development and Automation 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: 
Read only

Modifying Internal Table row - The column name is dynamic

Former Member
0 Likes
498

Hi,

I need to update the internal table as described below,

Assume that i have 10 columns in my internal table and i need to modifying the column value in row, which is dynamic.

for example, i'm writing it in Subroutine and it has 3 formal parameter

1) Key field value

2) Column name

3) Value of the column

in my subroutine i need to write code to modify the row, which should handle the columns dynamically.

Samples,

7th record i need to modify the 4th column value.

4th record i need to modify the 9th column value.

Please guide me to handle this requirement.write me if i'm not clear.

...Nandha

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
364

For the column check the ASSIGN statement:

No system here, but I think it is:

ASSIGN COMPONENT <index> OF STRUCTURE <structure> TO <field-symbol>.

For the row:

READ TABLE <itab> INDEX <index> INTO <work area>.

--> For your 1. example you could write:

READ TABLE <itab> INDEX 7 INTO <work area>.

ASSIGN COMPONENT 4 OF STRUCTURE <work area> TO <field-symbol>.

<field symbol> now points to the 4th column of the 7th row.

Guenther

For the column check the ASSIGN statement:

No system here, but I think it is:

ASSIGN COMPONENT <index> OF STRUCTURE <structure> TO <field-symbol>.

For the row:

READ TABLE <itab> INDEX <index> INTO <work area>.

--> For your 1. example you could write:

READ TABLE <itab> INDEX 7 INTO <work area>.

ASSIGN COMPONENT 4 OF STRUCTURE <work area> TO <field-symbol>.

<field symbol> now points to the 4th column of the 7th row.

Guenther

1 REPLY 1
Read only

Former Member
0 Likes
365

For the column check the ASSIGN statement:

No system here, but I think it is:

ASSIGN COMPONENT <index> OF STRUCTURE <structure> TO <field-symbol>.

For the row:

READ TABLE <itab> INDEX <index> INTO <work area>.

--> For your 1. example you could write:

READ TABLE <itab> INDEX 7 INTO <work area>.

ASSIGN COMPONENT 4 OF STRUCTURE <work area> TO <field-symbol>.

<field symbol> now points to the 4th column of the 7th row.

Guenther