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

How to avoid end-select in the sel;ect statement

Former Member
0 Likes
2,845

Hi All

i have the following select statement,

SELECT KBETR FROM KONV

INTO (V_EXDUTY) UP TO 1 ROWS

WHERE KNUMV = VBRK-KNUMV

AND KSCHL = 'JEXP'

AND KPOSN = VBFA-POSNN.

ENDSELECT.

now i want to know the alternative stat for this one by removing the end-select. and also explain me why do we use select ..... end-select. brief explanation is appreciated.

thanks in advance

ABAPER

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,286

hi,

u can use SELECT SINGLE ...since u r using select upto 1 rows. they hv used select upto 1 rows...as they are passing partial primary keys. there is a possibility that u mite have more than one matching records.

u can use "select..into table" and use some condition to retrieve the specific record.

regards,

madhu

Hi All

i have the following select statement,

SELECT KBETR FROM KONV

INTO (V_EXDUTY) UP TO 1 ROWS

WHERE KNUMV = VBRK-KNUMV

AND KSCHL = 'JEXP'

AND KPOSN = VBFA-POSNN.

ENDSELECT.

now i want to know the alternative stat for this one by removing the end-select. and also explain me why do we use select ..... end-select. brief explanation is appreciated.

thanks in advance

ABAPER

3 REPLIES 3
Read only

Former Member
0 Likes
1,287

hi,

u can use SELECT SINGLE ...since u r using select upto 1 rows. they hv used select upto 1 rows...as they are passing partial primary keys. there is a possibility that u mite have more than one matching records.

u can use "select..into table" and use some condition to retrieve the specific record.

regards,

madhu

Read only

Former Member
0 Likes
1,286

Hi,

Here you can use select single on behalf of ..Upto 1 row.

But select single gives best performance only if you accessed using full primary key. Otherwise upto 1 row gives its best if you specifying a partial key...

Read only

Former Member
0 Likes
1,286

SELECT SINGLE KBETR

FROM KONV

INTO V_EXDUTY

WHERE KNUMV = VBRK-KNUMV

AND KSCHL = 'JEXP'

AND KPOSN = VBFA-POSNN.