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

regarding select statement

Former Member
0 Likes
944

Hi ,

i have written a select statement plz suggest , is it a good practise to write it in the given below format will it affect the performance.

SELECT * INTO CORRESPONDING FIELDS OF TABLE ZBSIS

FROM BSIS

WHERE BUDAT IN BUDAT

AND HKONT IN

( SELECT SAKNR FROM ZTABLE_FLOW WHERE GSBER IN GSBER )

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
911

HI,

Definatly it will affect the performance.

1. Dont use nested Select statement instead use For All entries.

2. Dont Use corresponding fields in your select statement. Select only required fields and use an internal table of that type only.

I hope i am clear to you.

7 REPLIES 7
Read only

Former Member
0 Likes
911

Hi,

Please try to avoid nested select statement. The reason is

"A simple SELECT loop is a single database access whose result is passed to the ABAP program line by line. Nested SELECT loops mean that the number of accesses in the inner loop is multiplied by the number of accesses in the outer loop. You should therefore only use nested SELECT loops if the selection in the outer loop contains very few lines"

Thanks

venkat

Read only

Former Member
0 Likes
911

Using a sub query doesn't have any performance loop holes.

I think you are going the right way.

Regards,

Abhinab Mishra

Read only

Former Member
0 Likes
912

HI,

Definatly it will affect the performance.

1. Dont use nested Select statement instead use For All entries.

2. Dont Use corresponding fields in your select statement. Select only required fields and use an internal table of that type only.

I hope i am clear to you.

Read only

Former Member
0 Likes
911

Hi,

ITS NOT A GOOD PRACTICE AT ALL..

go with individual selects.. if just 2 tables ur using then go with for all entries..

dont go with corresponding fields it will take time.. so use the field references while passing the data

Read only

Former Member
0 Likes
911

Hi,

It will affect the performance if number of records are more.

Suggestion is: Dont use Select * in place of it write down the field names and also try to avoid corresponding fields of table as well.....just map the fields accorind to your Internal table structure.

After Fetching the data, Sort the table with your primark eys so that if you are fetching another talbes baed on previos one then performance will be good.

Please confirm if it clears your doubt and appreciate me for the same.

Regards

Sachin

Read only

Former Member
0 Likes
911

Hi ,

some performane tips for select :

1) Avoid use of select * , instead give the specified fields u want to select

2) Avoid the nested select.

3) Select with index support.

4) If u need to select data from two table , then use for all entries .

Thanks

Shambhu

Read only

Former Member
0 Likes
911

Hi,

ITS NOT A GOOD PRACTICE AT ALL..

go with individual selects.. if just 2 tables ur using then go with for all entries..

dont go with corresponding fields it will take time.. so use the field references while passing the data