‎2007 Oct 25 7:11 AM
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.
‎2007 Oct 25 7:34 AM
How many values are there in s_credat?
The performance could be affected if there are lot number of records in s_credat.
‎2007 Oct 25 9:29 PM
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.
‎2007 Oct 25 10:55 PM
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