2007 Jul 25 7:16 AM
Hi all,
here i have an internal table with 32 fileds almost.
i have to delete adjacent duplicates comparing 31 fields.
i have my internal table with some data as
PERNR BEGDA ENDDA SEQNR AWDTP AWAMT
001 01012006 01012006 0 9120 10.00
001 01012006 01012006 1 9120 10.00
001 01012006 01012006 2 9120 10.00
if have sorted the table before
if use delecte adjacent duplicate from itab comparing pernr begda endda awdtp
Here i should not use seqnr.
when i use above syntax the system has to delete 2nd 2 records
but here it is deleting only 2nd record
please can any one give me suggestion
with regards
anandp
THE SYSTEM IS SAYING T_TYP_DEALS
zak_pbb_deals ARE UNKNOW
2007 Jul 25 7:19 AM
Hi,
Use the same FILEDS In SORT BY and then in DELETE ADJACENT DUPLICATES COMPARING in the SAME ORDER.
Regards,
Sesh
2007 Jul 25 7:20 AM
2007 Jul 25 7:25 AM
HI if i write twice and i have n number of duplicates then i will not work again i ahve to face the same problem
with regards
anandp
2007 Jul 25 7:31 AM
Do it like this...
SORT ITAB descending BY pernr begda endda awdtp awamt.
delete adjacent duplicate from itab comparing pernr begda endda awdtp awamt.
It will solve your problem.
Regards,
Sairam
2007 Jul 25 7:33 AM
hi.... try this piece of code
It deletes duplicates.... even if they are not adjacent
FORM get_latest_deal CHANGING ch_t_deals TYPE t_typ_deals.
DATA : ls_deals TYPE zak_pbb_deals,
l_sytabix TYPE sytabix.
FIELD-SYMBOLS : <ls_deals> TYPE zak_pbb_deals.
sorting based on date and other key fields
SORT ch_t_deals BY aktnr matnr datum DESCENDING.
LOOP AT ch_t_deals ASSIGNING <ls_deals>.
l_sytabix = sy-tabix.
for the same the promotion-article
IF <ls_deals>-aktnr = ls_deals-aktnr AND
<ls_deals>-matnr = ls_deals-matnr.
DELETE ch_t_deals INDEX l_sytabix.
CONTINUE.
ENDIF.
storing the work area
ls_deals = <ls_deals>.
ENDLOOP.
ENDFORM. " get_latest_deal
<b>
please reward points</b>
regards
raksha
2007 Jul 25 9:58 AM
2007 Jul 25 7:20 AM
make your internal table like this
now your logic will work
PERNR BEGDA ENDDA AWDTP AWAMT SEQNR
001 01012006 01012006 10.00 0 9120
001 01012006 01012006 10.00 1 9120
001 01012006 01012006 10.00 2 9120
delecte adjacent duplicate from itab comparing pernr begda endda awdtp awamt
Message was edited by:
vamsi reddy
Message was edited by:
vamsi reddy
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |