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

Select Statement Doubt

Former Member
0 Likes
655

Hello Experts,

Please let me know after below select statement will be executed, will t_kdst table will have duplicate records. After this select statement do i need to sort the table and add delete adjacent statement?

SELECT VBELN VBPOS MATNR WERKS STLAN STLNR STLAL FROM kdst INTO CORRESPONDING FIELDS OF TABLE t_kdst

WHERE vbeln in order

and matnr in matnr

and vbpos in item

AND werks IN plant.

Regards,

Preeti

5 REPLIES 5
Read only

Former Member
0 Likes
627

Hello Preeti,

Since you are selection all key fields (primary table key) you won't have duplicate entries in the internal table because the primary table key is always unique.

Only if you leave out one or more key fields on the selected fields list, you could get duplicate entries.

Regards,

Michael

Read only

Former Member
0 Likes
627

Hi Preeti,

there won't be any duplicate records since your where claue is based on KEY fields...

so no need of sorting and adding adjacent duplicates...

hope this may be usefl...

please reward...

Regards,

Prashant

Read only

Former Member
0 Likes
627

Preeti,

For the KDST table, a combination of 7 fields forms the primary key. In the Select query's where clause, u have taken only 4 fields of the primary key. Due to the rest of 3 fields, there is a possibility for existing of duplicate entries. Hence you have to use SORT as well as DELETE ADJACENT statement (if you are concerned about records with univque values of the where clause's 4 fields alone).

Read only

Former Member
0 Likes
627

Hi Preeti,

As you are selecting all 7 primary keys, there is no chance of having duplicate entries in your internal table.

Each entry in the internal table would have a unique primary key combination.

Regards,

Pankaj Sharma

Read only

Former Member
0 Likes
627

The problem is not <u>duplicate</u> entries; it is <u>missing</u> entries. But the answer is the same; if you are selecting all fields in the primary key, you will have no problem.

Rob