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: 

internal table manipulation

former_member734916
Participant
0 Kudos

Hi

i like to know that, an internal table is having five fields like

data: begin of itab1 occurs 100,

field1 type c,

field2 type c,

field3 type c,

field4 type c,

field5 type c,

end of itab1.

for every loop paas of an internal table itab2 the data should

be assigned to the next field of itab1.

after 5 iterations the data should get appended to itab1.

how to do this. can anybody help me.

points will be rewarded.

1 ACCEPTED SOLUTION

amit_khare
Active Contributor
0 Kudos

data v_var type i.

move 0 to v_var.

loop at itab2.

add1 to v_var.

case v_var.

when 1.

itab1-fld1 = data1.

when 2.

itab1-fld2 = data2.

.

.

when 6.

append itab1.

clear v_var.

endcase.

Regards,

Amit

Reward all helpful replies.

3 REPLIES 3

Former Member
0 Kudos

Can u explain ur requirement more clearly with an example

amit_khare
Active Contributor
0 Kudos

data v_var type i.

move 0 to v_var.

loop at itab2.

add1 to v_var.

case v_var.

when 1.

itab1-fld1 = data1.

when 2.

itab1-fld2 = data2.

.

.

when 6.

append itab1.

clear v_var.

endcase.

Regards,

Amit

Reward all helpful replies.

Former Member
0 Kudos

data: l_tabix like sy-tabixx.

loop at itab2.

l_tabix = sy-tabix.

if l_tabix = 1.

itab1-field1 = itab2-field1.

elseif l_tabix = 2.

itab1-field2 = itab2-field2.

elseif l_tabix = 3.

itab1-field3 = itab2-field3.

elseif l_tabix = 4.

itab1-field4 = itab2-field4.

elseif l_tabix = 5.

itab1-field5 = itab2-field5.

append itab1.

endif.

clear itab1.

endloop.