2007 Jul 23 7:54 AM
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
2007 Jul 23 8:03 AM
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
2007 Jul 23 8:05 AM
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!
2007 Jul 23 8:06 AM
Hi,
Use
Sort Internal table.
delete adjacent duplicates from itab comparing fields
Regards
Arun
2007 Jul 23 8:11 AM
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
2007 Jul 23 8:39 AM
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