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

Former Member
0 Likes
665

hi

when we will use

select

end select

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
638

Hi,

I think generally if you don't have the full primary value to use SELECT SINGLE..You will be SELECT UP TO 1 ROWS with an ENDSELECT..Can be used for existence check..

Example..

-


SELECT MATNR UP TO 1 ROWS

INTO V_MATNR

FROM VBAP

WHERE VBELN = '1234567'.

ENDSELECT.

Thanks,

Naren

7 REPLIES 7
Read only

Former Member
0 Likes
639

Hi,

I think generally if you don't have the full primary value to use SELECT SINGLE..You will be SELECT UP TO 1 ROWS with an ENDSELECT..Can be used for existence check..

Example..

-


SELECT MATNR UP TO 1 ROWS

INTO V_MATNR

FROM VBAP

WHERE VBELN = '1234567'.

ENDSELECT.

Thanks,

Naren

Read only

Former Member
0 Likes
638

when you want process some thing( calculating or writing to list ) while fetching the date ,

Regards

Siva

Read only

Former Member
0 Likes
638

You should use:

SELECT... INTO TABLE it_table

LOOP at it_table

ENDLOOP.

instead !!!

Select...Endselect creates a loop within the select statement BUT... it performs multiple DB reads to achieve it.

The INTO TABLE above performs one and only one DB read... which is much faster and efficient for the App server and DB server.

Read only

former_member69765
Contributor
0 Likes
638

SELECT * from <Table>

  • All Processing Logic

END SELECT

SELECT - END SELECT works like a loop. A single record is read and the processing is done.

This causes multiple hits on Data base server... which increases your execution time.

Instead.. it is good programming practice to select all the required data into an internal table and then loop on the internal table. this reduces the run time to a great extent.

the conclusion is that in general you must avaoid using SELECT ENDSELECT.

Read only

Former Member
0 Likes
638

Ratna,

Please reward points accordingly and close the thread.

Read only

Former Member
0 Likes
638

i would suggest never to use select-end select .

u shopuld always prefer

select (field-list) into table (conditions) .

u can always avoid using select-end select .

also i would tell not to use nested select statements .

a better idea would be to use 'for all entries ' option of select statement .

if helpful plz reward points

Read only

Former Member
0 Likes
638

Hi,

SELECT ENDSELECT is usually used when we need to select a range of values. Values which are just needed from the IT are selected using this.

SELECT is not concluded by ENDSELECT :

if it is a SELECT SINGLE command,

if only aggregate functions appear in the SELECT clause and there is no GROUP BY clause, or

if the INTO clause INTO TABLE itab or APPENDING TABLE itab does not include the addition PACKAGE SIZE.

Thanks and regards,

Priyanka.