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

Collecting same data with different value into a table

Former Member
0 Likes
825

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
Read only

Former Member
0 Likes
785

>

> 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?

Read only

Former Member
0 Likes
785

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

Read only

0 Likes
785

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.

Read only

GauthamV
Active Contributor
0 Likes
785

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.

Read only

Former Member
0 Likes
785

Hi,

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

Read only

Former Member
0 Likes
785

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