‎2007 Sep 06 6:40 AM
Hi ,
What is the difference in
Select...
...
endselect .
&
Select ....
‎2007 Sep 06 6:43 AM
SELECT * from MARA.
Append MARA to i_MARA.
ENDSELECT.
Above statement will execute 100 times if MARA has 100 records & i_mara will have all 100 records
SELECT * from MARA
into table i_mara.
Above statement will execute only once & fetch all the 100 records in i_mara.
‎2007 Sep 06 6:42 AM
select endselect is just like a select with in a loop.
see the below examples
using select endselect
select * from vbak.
append vbak to it_vbak.
endselect.
alternative of using select endselect
select * from vbak into table it_vbak.
Hope it is clear
Regards
Gopi
‎2007 Sep 06 6:43 AM
SELECT * from MARA.
Append MARA to i_MARA.
ENDSELECT.
Above statement will execute 100 times if MARA has 100 records & i_mara will have all 100 records
SELECT * from MARA
into table i_mara.
Above statement will execute only once & fetch all the 100 records in i_mara.
‎2007 Sep 06 6:45 AM
Basically both have the same output. However their usage is different.
select - endselect -> this is used when you do not specify all the primary ckeys of the table in WHERE clause.
select single -> This is used when you specify all the primary keys of table in the WHERE clause of the query.
I hope this solves your doubt.
Reward points if helpful
‎2007 Sep 06 6:46 AM
HI,
select.
...
endselect
this fetches the data from the dbtab in a loop 1 by 1.this locks the table for the particular time period.
select * from bdtab into table.
here it fetches the record in 1 shot and need not lock the table.
hence select is faster than select...endselect
thanks
vivekanand
‎2007 Sep 06 6:57 AM
hi,
in this select statement no need to give end select as it is populating all the data to table itab_mara.
select matnr ernam from mara into corresponding fields of table itab_mara
where matnr = marc-matnr.
2. this select statement becomes a loop so we have to specify endselect.
select matnr ernam from mara into corresponding fields of itab_mara
where matnr = marc-matnr.
endselect.
Reward with points if helpful.
Message was edited by:
Vinutha YV
‎2007 Sep 06 7:06 AM
hi,
select ........... end select just acts like a loop and it fetches all records from database table and places into internal table. in select statement there are different types as
1. select single * .................. -
fetches only one record from database table based on where condition
2. select matnr,pernr,...................... -
fetches no .of fields from different tables [with help of views or joins].............
3. select * from .............. into table itab -
fecthes all fields from database table into internal table in a single time.
4. select matnr, pernr ................... into d_matnr, d_pernr..........----
fetches fields of databse tables into individual fields .
with select statement we can use into corresponding option also.
if helpful reward some points.
with regards,
Suresh aluri.