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

difference b/w select ,endselect and select statement alone

Former Member
0 Likes
646

hi guys, can any one give me the details abt difference b/w select,endselect and select statement alone, where we will use select,endselect and select statement only with some example.

4 REPLIES 4
Read only

tamra_walstrom
Explorer
0 Likes
552

Please see the SAP help for details but here are a few examples.

Use Select alone if doing the following:

Select single field

into v_field

from t_table.

select field1 field2

from t_table

into it_table.

Use endselect in the following case:

Select field

into v_field

from t_table

endselect.

Read only

Former Member
0 Likes
552

Hi Arun,

When ever u want to append data into the workarea then use select ... endselect. When u r appending data into the internal table then use select. Also when u use select single then also use only select.

<b>Eg: Using only Select</b>

data : begin of itab occurs 0,

lifnr like lfa1-lifnr,

end of itab.

select single lifnr from lfa1 into itab.

data itab like lfa1 occurs 0 with header line.

select * from lfa1 into table itab.

<b>Eg: Using Select .. endselect.</b>

data : itab like lfa1 occurs 0,

wa like lfa1.

select * from lfa1 into wa.

append wa to itab.

endselect.

Regards

Haritha.

Read only

Former Member
0 Likes
552

select
.....
endselect 

is used when you are extracting data into headerline/workarea of the internal table and later append the data to the body.


select 

is used when you are extracting data directly into the body of the internal table.

Hope this helps.

Read only

Former Member
0 Likes
552

hi arun,

try to avoid select and endselect always because if u write select and endselect, for every time it goes to database and fetch one record from database and fills the internal table, if u have thousans of records in the selection then just assume the performance of the report.

instead of above u can write select statement like this,

select * from kna1 into table itab where kunnr = kna1-kunnr.

this statement can get the all avbl records from database fills the itab at single shot now you can assume the performance of the report.

this is the difference b/w these two.

reward points if helpful,

regards,

seshu.