12-14-2009 10:41 AM
HI....
I have one internal table with list of users, i need duplicate users into one internal table and unique users into another internal table..
Unique key to identify users is user mail id....
I dont want to use DELETE ADJACENT statement...
Pls Help
Thanks
Ram
12-14-2009 10:45 AM
Hi..
Ex: U have ITAB1 - Email is one of the field
1. SORT ITAB1BY EMAIL.
2. DECLARE WF_EMAIL TYPE EMAIL.
LOOP AT ITAB1.
AT FIRST.
WF_EMAIL = ITAB1-EMAIL.
ENDAT.
IF NOT WF_EMAIL = ITAB1-EMAIL.
APPEND ITAB3. " passing unique entry
WF_EMAIL = ITAB1-EMAIL.
ENDIF.
* pass the values to ITAB2 and APPEND for duplicate all records
ENDLOOP.
Hope this Helps,
Nag
Edited by: Naga Mohan Kummara on Dec 14, 2009 11:46 AM
12-14-2009 10:46 AM
Hi,
Sort itab by field1.
itab1[] = itab[].
loop at itab1.
loop at itab1 where field1 = itab1-field1.
append itab1 to itab2.
delete itab1 where field1 = itab1-field1.
endloop.
endloop.
After this, itab1 will have unique values and itab2 have duplicate values.
12-14-2009 10:53 AM
Define a Unique key for ITAB3 and appent the records and ON SUBRC return value update ITAB2 for duplicate records
12-14-2009 11:04 AM
Hi,
Try following,
Sort Itab by mail.
Loop at itab.
On change of itab-mail.
**move required fields to itab1
itab2-mail = itab-mail.
append itab1. " itab1 will have unique records
else.
**move required fields to itab2
itab2-mail = itab-mail.i " tab12 will have duplicate records
append itab2.
endon.
endloop.
12-15-2009 8:46 AM
HI,
LOOP AT ITAB1 INTO WA_ITAB1
IF WA_ITAB1-EMAIL NE WA_ITAB1_TMP-EMAIL.
WA_ITAB1_TMP = WA_ITAB1.
APPEND WA_ITAB1 TO I_ITAB1.
ELSE.
APPEND WA_ITAB1 TO I_ITAB2.
ENDIF.
ENDLOOP.