2012 Mar 01 11:12 AM
Hi All,
As per my requirement
1. The internal table is the input.
2. I need the duplicate records of the internal table with the combination of 2 key fields.
3. I should not use SORT because i need the index number in order as per in the table .
EX : Take Table MSEG.
Take key fields as MBLNR and WERKS.
I want the duplicate records of the combination of these 2 key fields.
The *Index Number * should not to be changed as per the table entry. ( So i avoided sorting the internal table)
Kindly give some solutions.
Thanks,
Pradeep.
Moderator message : Duplicate post locked,follow forum Rules of Engagement. Thread locked.
Edited by: Vinod Kumar on Mar 1, 2012 4:59 PM
2012 Mar 01 11:14 AM
Hi Pradeep,
Try this...
first you copy your internal table to another temporary table of same type.
itab_temp[] = itab[].
sort itab_temp[].
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING MBLNR WERKS.
LOOP AT ITAB_TEMP INTO WA_ITAB1.
DO.
READ TABLE ITAB INTO WA_ITAB2 WITH KEY MBLNR = WA_ITAB1-MBLNR AND WERKS = WA_ITAB1-WERKS.
IF SY-SUBRC EQ 0.
APPEND WA_ITAB2 TO ITAB_NEW.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDLOOP.
you may get the duplicate records in itab_new.
Hi All,
As per my requirement
1. The internal table is the input.
2. I need the duplicate records of the internal table with the combination of 2 key fields.
3. I should not use SORT because i need the index number in order as per in the table .
EX : Take Table MSEG.
Take key fields as MBLNR and WERKS.
I want the duplicate records of the combination of these 2 key fields.
The *Index Number * should not to be changed as per the table entry. ( So i avoided sorting the internal table)
Kindly give some solutions.
Thanks,
Pradeep.
Moderator message : Duplicate post locked,follow forum Rules of Engagement. Thread locked.
Edited by: Vinod Kumar on Mar 1, 2012 4:59 PM
2012 Mar 01 11:14 AM
Hi Pradeep,
Try this...
first you copy your internal table to another temporary table of same type.
itab_temp[] = itab[].
sort itab_temp[].
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING MBLNR WERKS.
LOOP AT ITAB_TEMP INTO WA_ITAB1.
DO.
READ TABLE ITAB INTO WA_ITAB2 WITH KEY MBLNR = WA_ITAB1-MBLNR AND WERKS = WA_ITAB1-WERKS.
IF SY-SUBRC EQ 0.
APPEND WA_ITAB2 TO ITAB_NEW.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDLOOP.
you may get the duplicate records in itab_new.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |