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: 

Collecting same data with different value into a table

Former Member
0 Kudos

Hi,

Can you people help me with this problem.

I have an internal table with different data e.g :

A 2

B 1

C 3

A 1

D 7

B 5

Now i want to put the values of A,B,C,D into another internal table with some other calculation done.

But when i am using READ Table with KEY my second internal table is getting filled with A=2 and the second A=2 as well instead of 1.I guess because it is reading the first record only as its finding A first.

How will i fix this one.

Kind Regards,

6 REPLIES 6

Former Member
0 Kudos

>

> Hi,

>

> Can you people help me with this problem.

> I have an internal table with different data e.g :

> A 2

> B 1

> C 3

> A 1

> D 7

> B 5

> Now i want to put the values of A,B,C,D into another internal table with some other calculation done.

> But when i am using READ Table with KEY my second internal table is getting filled with A=2 and the second A=2 as well instead of 1.I guess because it is reading the first record only as its finding A first.

> How will i fix this one.

>

> Kind Regards,

Can you tell me the exact requirement of yours?

former_member1245113
Active Contributor
0 Kudos

Hi

If your second table also has the values of first itab say A,B,C,D

Then sort your first table.

loop at second_tab.

loop at first_tab where fnam = second_tab-fnam

endloop.

endloop

Best Regards

Ramchander Rao.K

0 Kudos

Hi,,,

my second itab dont v the values of A,B,C,D. I will fill up the second itab with the values of first itab.

GauthamV
Active Contributor
0 Kudos

In the read statement mention both fields.

ex:

READ TABLE IT_bkpf WITH KEY bukrs = IT_bsis-bukrs

belnr = it_bsis-belnr

gjahr = it_bsis-gjahr.

Former Member
0 Kudos

Hi,

Instead of Read statement use the Loop at itab with where clause... in this case you get the second record also..

Former Member
0 Kudos

take an intermediate internal table.

itab_temp[] = itab[].

now use read table from temp table and delete that entry after reading it so the next read table will point to next entry