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

Former Member
0 Kudos
108

Hi,

Suppose I have an internal table having 50 fields. The table have some data. Now, I want to detect those

records which have same value in 49 fields and different value in 1 field.What will be shortest way of doing it?

Useful answers will be rewared.

Tan

5 REPLIES 5

Former Member
0 Kudos
89

you have to loop at inernal table..

store the key field of first record in some variable.

read itab into wa_itab index 1.

temp = wa_itab-keyfield

Loop at internal table.

if temp = itab-keyfield.

group 1.

else

group 2.

endloop.

regards

Former Member
0 Kudos
89

Hi,

I believe 50 fields are 50 columns.

You can convert these 50 columns into rows. and then delete adjucent duplicates will give you exact rows.

Provides 50 columns are fixed.

loop at itab.

jtab-a = itab-a.

append ....

.

.

.

.

.

.

endloop.

sort jtab.

delete adjucent duplicates from jtab.

Reward if useful!

Former Member
0 Kudos
89

Hi,

Use

Sort Internal table.

delete adjacent duplicates from itab comparing fields

Regards

Arun

Former Member
0 Kudos
89

Hi Tanmay Bh ,

It is definitly useful to use AT NEW control statement.

Here is the help.

LOOP AT ITAB INTO WA.

AT NEW 49th field.

*This is the record with atleast one record is diffrent in the 49 fields

ENDLOOP.

Hope this helps you.

Regards,

Rama.Pammi

0 Kudos
89

Please see the example;

Table with 5 fields :

a b e d f

a b c d g

a b c e g

a b c d f

I need records which has same value in 1 2 3 5 column,

but different value in 4 th column.

So the selected record will be :

a b c d g

a b c e g

-Tan