‎2007 Nov 27 2:19 AM
load the data to internal table by using select statement and load the data to structure by using selct statement ...
is both r same ..
when we use SELECT AND ENDSLECT ?
Regards,
pandu.
‎2007 Nov 27 2:38 AM
Hi,
if you are populating the structure...then you have to use SELECT..ENDSELECT.
Then inside that you either populate either an internal table or directly do the processing..performance wise it will be slower..
If you use SELECT ..INTO TABLE...Then it is directly populating the internal table with the database records...The performance will be much higher...
Thanks
Naren
‎2007 Nov 27 3:51 AM
Hi Pandu,
If you want the fill the structure then you use
SELECT.... ENDSELECT.
If you want to fill the internal table directly from Database Table
Then u need to use
SELECT...INTO TABLE
Hope this clears your doubt.
Regards,
Chandru
‎2007 Nov 27 4:02 AM
Hi,
Use of EndSelect statment should be avoided.
So use SELECT SINGLE to load data to structure and Use SELECT.....INTO TABLE <internal table> to load data to internal table.
Regards,
Amit
‎2007 Nov 27 4:06 AM
hi,
<b>select * from kna1.
write: kna1-kunnr.
endselect.</b>------> Use it.
<b>select * from kna1 into table itab.
write: itab-kunnr.</b>
Endselect------> donot use it.
‎2007 Nov 27 4:07 AM
hi,
<b>select * from kna1.
write: kna1-kunnr.
endselect.</b>------> Use it.
<b>select * from kna1 into table itab.
write: itab-kunnr.</b>
Endselect------> donot use it.
Warm Regards,
S.Suresh.
reward if useful......
‎2007 Nov 27 5:16 AM
‎2007 Nov 27 5:21 AM
You should use SELECT..ENDSELECT when you want to copy the contents to structure from Database table.
You should use SELECT..INTO TABLE when you want to copy the contents to Internal Table from Database table.
In order to avoid ENDSELECT while copying data to Structure use
SELECT SINGLE. For this no need to use ENDSELECT.
‎2007 Nov 27 6:10 AM
hi
you should always avoid using select and endselect.
if u want to copy it to a structure use select single.
‎2007 Nov 27 7:59 AM
hai Pandu,
In some cases we have to go with SELECT ............ENDSELECT.
SELECT.........ENDSELECT is act like a loop.
SELECT * INTO CORRESPONDING FIELDS OF WF_AUFK FROM AUFK
WHERE AUFNR IN WP_AUFNR
AND BUKRS = WP_BUKRS
AND GSBER = WP_GSBER.
...................some logics...............................
SELECT * INTO CORRESPONDING FIELDS OF WF_EKKN
FROM EKKN
WHERE AUFNR = WF_AUFK-AUFNR
....................some logics.................................
CLEAR WT_DETAIL_TBL.
WT_DETAIL_TBL-WF_PSPID = WF_AUFK-AUFNR.
WT_DETAIL_TBL-WF_POST1 = WF_AUFK-KTEXT.
WT_DETAIL_TBL-WF_SUB_CD = WF_EKKN-SAKTO.
WT_DETAIL_TBL-WF_EBELN = WF_EKKN-EBELN.
WT_DETAIL_TBL-WF_SORT_PI = WF_EKKN-EBELN.
ENDSELECT.
ENDSELECT.
this statement will take first record from database table and perform the necessary logic present within the SELECT ............ENDSELECT.when the processing of the first record is over, endselect event will triger. after that it will goto above select statement and it will check database table for another record suitable for that selelction criteria.after processing the each record the records willl be stored in a internaal table. so interaction with the database is high.that is y some peoplpes asking u to avoid
SELECT ............ENDSELECT.
LOAD THE DATA INTO THE INTERNAL TABLE.
In this case, interaction with the database is less, bcoz u r retrieveing all the data at first time and storing it into internal table. after that u r processing it from internal table, these are the main differences.its quick processing.
i think ur doubt will be clear.
regards,
shafi.
‎2007 Nov 27 8:01 AM
after load the data into internal table, we will loop that internal table for further processing.