Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

delete

Former Member
0 Likes
691

I want to delete duplicate records from an Internal Table by comparing all the fields.

CAN I use the code below or do i need to specify comparing fields.

DELETE ADJACENT DUPLICATES FROM it_bsid.

Shejal.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
662

Hi,

Example..

For DELETE ADJACENT DUPLICATES you have to sort first..

SORT ITAB BY MATNR.

DELETE ADJACENT DUPLICATES FROM ITAB COMPARING MATNR.

If you don't give the comparing it will check for all the fields..

Thanks,

Naren

5 REPLIES 5
Read only

Former Member
0 Likes
663

Hi,

Example..

For DELETE ADJACENT DUPLICATES you have to sort first..

SORT ITAB BY MATNR.

DELETE ADJACENT DUPLICATES FROM ITAB COMPARING MATNR.

If you don't give the comparing it will check for all the fields..

Thanks,

Naren

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
662

Just use that statement, omitting the COMPARING extension will simply mean that it will look at the entire line.

sort it_bsid ascending.
DELETE ADJACENT DUPLICATES FROM it_bsid.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
662

<b>DELETE ADJACENT DUPLICATES FROM it_bsid comparing all fields.</b>

Don't forget to sort.

Read only

Former Member
0 Likes
662

Hi Shejal,

If you didnt specify COMPARING clause it will consider all fields of internal table.

These two statements will work in same manner.

DELETE ADJACENT DUPLICATES FROM it_bsid.

DELETE ADJACENT DUPLICATES FROM it_bsid COMPARING ALL FIELDS.

Thanks,

Vinay

Read only

Former Member
0 Likes
662

Thanks everyone.

Shejal.