Application Development 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: 

Performance issue with select query

Former Member
0 Kudos

Hi,

i have a performance issue with below query...its taking lots of time to execute.

********************************

We have a selection screen with Idoc creation date field only, so screen should allow user the enter startdate and end date of idoc received.

SELECT docnum status direct credat mestyp idoctp

FROM edidc

INTO CORRESPONDING FIELDS OF TABLE i_edidc

WHERE status = '53' AND

direct = '2' AND

credat IN s_credat AND

mestyp = 'CREMAS' AND

idoctp = 'CREMAS03'.

*******************************************

Pls review and suggest me, how we can improve the performance.

3 REPLIES 3

Sathish
Employee
Employee
0 Kudos

How many values are there in s_credat?

The performance could be affected if there are lot number of records in s_credat.

Rodrigo-Giner
Active Contributor
0 Kudos

Here r some advices:

1- IF u use one IN statment in the where clause, use all IN. Put the "hardcoded" Values in the s_option-low field.

2- Try not to use CORRESPONDING FIELDS OF. Instead Declare i_edidc like this:

DATA: Begin of i_edidc occurs 0,

docnum TYPE edidc-docnum,

status TYPE edidc-status,

vdirect TYPE edidc-vdirect,

credat TYPE edidc-credat,

mestyp TYPE edidc-mestyp,

idoctp TYPE edidc-idoctp,

END OF i_edidc.

And use INTO TABLE i_edidc

SELECT docnum status direct credat mestyp idoctp

FROM edidc

INTO TABLE i_edidc

WHERE status IN s_status AND

direct IN s_direct AND

credat IN s_credat AND

mestyp IN s_mestyp AND

idoctp IN s_idoctp.

former_member195698
Active Contributor
0 Kudos

Hi,

Give the fields in the where condition in the sames sequence as present in the database. Also the fields which are selected should be in the same sequence as present in the database.

Try creating an index on the table based on the query if advisable.

Regards,

Abhishek