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

Internal table - set attribute by index

Former Member
0 Likes
309

Hi all,

i have an dynamic internal table like this one:

data: begin of itab occurs 0,

value1 type c,

value2 type c,

value3 type c.

data: end of itab.

I have another table where i make a loop.

loop at xyz_table.

***********************************************

if sy-tabix = 1.

itab-value1 = xyz_table-value1.

elseif sy-tabix = 2.

itab-value1 = xyz_table-value1.

itab-value2 = xyz_table-value2.

elseif sy-tabix = 3.

itab-value1 = xyz_table-value1.

itab-value2 = xyz_table-value2.

itab-value3 = xyz_table-value3.

endif.

************************************************

endloop.

How can i develop the coding in * in a dynamic way because i know the amount of values not until runtime.

regards

1 REPLY 1
Read only

former_member156446
Active Contributor
0 Likes
284
data: begin of itab occurs 0,
value1 type c,
value2 type c,
value3 type c.
data: end of itab.

field-symbols : <fs_itab> like itab,
                      <fs_xyz> like xyz_itab.

loop at xyz_table assigning <fs_xyz>.

***********************************************
if sy-tabix = 1.
<fs_itab>-value1 = <fs_xyz>-value1.
elseif sy-tabix = 2.
<fs_itab>-value1 = <fs_xyz>-value1.
<fs_itab>-value2 = <fs_xyz>-value2.
elseif sy-tabix = 3.
<fs_itab>-value1 = <fs_xyz>-value1.
<fs_itab>-value2 = <fs_xyz>-value2.
<fs_itab>-value3 = <fs_xyz>-value3.
endif.
************************************************

endloop.