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

Restricting duplicate entries

Former Member
0 Likes
1,733

Hi

I have used an inner join to get data from two tables KNA1 and KNVP. In the result some entries are getting duplicated. How do i restrict it to get unique records???

Hi

I have used an inner join to get data from two tables KNA1 and KNVP. In the result some entries are getting duplicated. How do i restrict it to get unique records???

10 REPLIES 10
Read only

Former Member
0 Likes
1,295

Hi,

after the data fetch , youcan execute the following command :

delete adjacent duplicates from ITAB comparing <some field>

regards,

Read only

0 Likes
1,295

thanks sachin

i got it right now

Read only

Former Member
0 Likes
1,295

Hi Mayur,

After selecting the datas you can delete the Duplicate Values from your internal Table.

For Internal tables use,

DELETE ADJACENT DUPLICATES FROM itab.

If u want to delete the duplicate entries depending on one or 2 columns then u can use

DELETE ADJACENT DUPLICATES FROM itab COMPARING f1 f2.

Thanks.

Reward If Helpful.

Read only

0 Likes
1,295

thanks viji

i got it right now

Read only

Former Member
0 Likes
1,295

Use the DISTINCT command in the query itself

Read only

Former Member
0 Likes
1,295

Hi,

Use DISTINCT option in your select query

like select distinct <field names ..............>.

Thanks

Sandeep

Reward if helpful

Read only

Former Member
0 Likes
1,295

Hi

If you Dont want any duplicate entries from the database table you can use SELECT DISTINGT clause in the query...Otherwise if you want to delete duplicate by giving condition to some specific fields after the selection you can use this command..

DELETE ADJASCENT DUPLICATE FROM ITAB COMPARING <FIELDS>

Hope this will help u..

Reward ALL The Helpfull Answers.......

Read only

Former Member
0 Likes
1,295

From Functional point of view, This join query should yield more than one records as A customer can be existing in more than one sales area(sales org, dist. channel, division).

What exactly is your requirement?

Read only

Former Member
0 Likes
1,295

Thanx the problem is solved...

Read only

Former Member
0 Likes
1,295

You have to follow the following steps..

Select A B C "(change it with the field you select)

Into ta_kna1_knvp

FROM KNA1

Inner Join KNVP

On...

where.... "(allways select based on primary key or index)

Sort ta_kna1_knvp by A B. "(Where A B is the key that differ your selection unique)

delete adjacent duplicates from ta_kna1_knvp comparing A B.

Allways use SORT and DELETE ADJACENT DUPLICATES after inner join.