‎2007 Jun 12 1:57 PM
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.
‎2007 Jun 12 4:33 PM
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.
‎2007 Jun 12 4:44 PM
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.
‎2007 Jun 12 5:48 PM
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.
‎2007 Jun 12 5:55 PM
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.