11-04-2008 3:01 PM
Hi Gurus,
Is there any aditions to SELECT FOR ALL ENTRIES Query which would accept Duplicate Entries also?
Thanks & Regards,
Vijaya.
11-04-2008 3:04 PM
When selecting records from a table using FOR ALL ENTRIES then select all the primary keys along with other required field to get all the records from the table.
11-04-2008 3:05 PM
Hello,
If you want to select all the entries in the table just use the field in your WHERE clause in SELECT query.
Thanks,
Jayant
11-04-2008 3:06 PM
nothing needs to be added to accept duplicates in for all entries in itab.
But you shouldnt have duplicate entries in for all entries itab as it will affect your performance. Just for performance we delete dupilcate entries.
11-04-2008 3:09 PM
generally before going to For all entries of table, delete adgescent duplicates in table will be done and then used in Select statement.
For you case you need not do that.. and you can use the table as it is.
11-04-2008 3:12 PM
Hi
What do you mean?
It's not possible there are duplicate records in a table: it would mean records with the same key.
If you means records having same value for certains fields u should use only that fields in the query and then check the record duplicate in the internal table
.DATA: WA LIKE ITAB,
NEXT TYPE I.
SELECT * FROM <TABLE>
FOR ALL ENTRIES ITAB WHERE FIELD1 = ITAB-FIELD1
AND FIELD2 = ITAB-FIELD2
AND FIELD3 = ITAB-FIELD3.
SORT ITAB BY FIELD1 FIELD2 FIELD3.
LOOP AT ITAB.
NEXT = SY-TABIX + 1.
READ TABLE ITAB INTO WA INDEX NEXT.
IF ITAB-FIELD1 <> WA-FIELD1 OR
ITAB-FIELD2 <> WA-FIELD2 OR
ITAB-FIELD3 <> WA-FIELD3.
DELETE ITAB.
ENDIF.
ENDLOOP.
Max
11-04-2008 3:29 PM
Hi Gurus,
Thanks for your prompt replies,
here in my case i need duplicate entries also where i need to sum up all the entries,
when i use for all entries it is omiting the duplicate entries,
say
3
2
3
-
8( required o/p)
-
3
2
-
5( present o/p)
-
i have used all the key fields,hope you understand my req.
Thanks & Regards,
Vijaya.
11-04-2008 3:34 PM
don't you select with DISTINCT addition? if yes remove it, otherwise copy you SELECT statement here for further analysis...
11-04-2008 3:36 PM
You say that you have used all key fields then how can you expect duplicate values .
11-06-2008 3:44 PM
Hi Gurus,
Problem was solved,wrong with my code,
only solution is we have to use all key
fields.