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

Problem with Internal table

former_member202474
Contributor
0 Likes
385

Hi ALl,

I have a class in which the incoming paramter is type table. In this clas I need to copy this itab to another itab1 which is of some structure type.

Eg:

data :itab type table,

itab1 type table of zstructure,

wa1 type zstructure.

I have tried the following things

1. itab1 = itab

2. loop at itab into wa1.

append wa1 to itab1.

endloop.

3. move itab to itab1.

All three give dump.(2 internal tables are not mutually convertible and compatible).

At runtime I can see that itab has the same structure like itab1.

Please guide.

Regards,

Ruby.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
354

HI,

Do as follows:-

data: y_obj_data type ref to data.
          field-symbols: <Y_F_LINE> type any.

         CREATE DATA y_obj_data LIKE LINE OF itab. 
          ASSIGN y_obj_data->* TO  <y_f_line>.
          if  <y_f_line> is assigned.
           loop at itab into  <y_f_line>.
          move-corresponding  <y_f_line> to wa1.
          append wa1 to itab1.
          endloop.
endif.

Regards,

Ankur Parab

2 REPLIES 2
Read only

Former Member
0 Likes
355

HI,

Do as follows:-

data: y_obj_data type ref to data.
          field-symbols: <Y_F_LINE> type any.

         CREATE DATA y_obj_data LIKE LINE OF itab. 
          ASSIGN y_obj_data->* TO  <y_f_line>.
          if  <y_f_line> is assigned.
           loop at itab into  <y_f_line>.
          move-corresponding  <y_f_line> to wa1.
          append wa1 to itab1.
          endloop.
endif.

Regards,

Ankur Parab

Read only

Former Member
0 Likes
354

try this way if both internal tables are same strcture...

1. itab1[] = itab[]