‎2009 Feb 17 10:42 AM
Hi,
The below select statement is giving TIME_OUT error in production system.
SELECT filkd bukrs belnr buzei blart bldat bschl budat
dmbtr hkont kunnr rebzg mansp madat manst
shkzg umskz vbund xblnr
zbd1t zbd2t zbd3t zfbdt zterm
FROM bsid
INTO TABLE t_bsid
WHERE bukrs IN s_bukrs
AND kunnr IN s_kunnr
AND umskz IN s_umskz
AND augdt EQ w_augdt_null
AND augbl EQ w_augbl_null
AND budat <= p_keydat.
The select statement is using primary index but still it is causing time out error.Can anyone tell me how to improve the performance of this select statement?
‎2009 Feb 17 10:50 AM
Hi,
SELECT filkd bukrs belnr buzei blart bldat bschl budat
dmbtr hkont kunnr rebzg mansp madat manst
shkzg umskz vbund xblnr
zbd1t zbd2t zbd3t zfbdt zterm
FROM bsid
INTO TABLE t_bsid
WHERE bukrs IN s_bukrs
AND kunnr IN s_kunnr
AND umskz IN s_umskz.
Loop at T_bsid.
IF augdt EQ w_augdt_null
AND augbl EQ w_augbl_null
AND budat <= p_keydat.
ENDIF.
ENDLOOP.Decrease load on Database server.
Regards,
GP
‎2009 Feb 17 10:53 AM
I hope you might be passing lot of data to this query, why dont you try the option to execute this report in background mode? So that ther will not be any timeout error?
Regards
Shiva
‎2009 Feb 17 11:41 AM
what does the SQL Trace say?
The select statement is using primary index, the ABAP statement or the Explain statement.
How many records come back.
> Loop at T_bsid.
> IF augdt EQ w_augdt_null
> AND augbl EQ w_augbl_null
> AND budat <= p_keydat.
> ENDIF.
not recommended!!
Siegfried
‎2009 Feb 17 12:11 PM
>
> Can anyone tell me how to improve the performance of this select statement?
Yes, provide a single value in S_BUKRS and S_KUNNR.
Thomas
‎2009 Feb 17 7:54 PM
SELECT filkd bukrs belnr buzei blart bldat bschl budat
dmbtr hkont kunnr rebzg mansp madat manst
shkzg umskz vbund xblnr
zbd1t zbd2t zbd3t zfbdt zterm
FROM bsid
INTO TABLE t_bsid
WHERE bukrs IN s_bukrs
AND kunnr IN s_kunnr
AND umskz IN s_umskz
AND augdt EQ w_augdt_null
AND augbl EQ w_augbl_null
AND budat <= p_keydat. is ur statement
now using corresponding clause
SELECT filkd bukrs belnr buzei blart bldat bschl budat
dmbtr hkont kunnr rebzg mansp madat manst
shkzg umskz vbund xblnr
zbd1t zbd2t zbd3t zfbdt zterm
FROM bsid
INTO corresponding fields of TABLE t_bsid
WHERE bukrs IN s_bukrs
AND kunnr IN s_kunnr
AND umskz IN s_umskz
AND augdt EQ w_augdt_null
AND augbl EQ w_augbl_null
AND budat Le p_keydat. (insted of <= use le) this might improve performance of ur selct query.
and make sure that selection screen varables is of same time as u use in your internal table.
‎2009 Feb 18 1:07 PM
>
> AND budat Le p_keydat. (insted of <= use le) this might improve performance of ur selct query.
>
LE is the same as <=
WHERE filter as stated above must be more selective to force an indexed read .
bye
yk
‎2009 Feb 19 4:39 AM
Hi Yukon,
Now how can we improve the performance of this select statement?How can the index be more selective?
‎2009 Feb 19 8:06 AM
the answer was already given, what is actually in the ranges????
WHERE bukrs IN s_bukrs
AND kunnr IN s_kunnr
AND umskz IN s_umskz
Only you can answer that!
‎2009 Feb 19 10:21 AM
Hi Siegfried,
The values for s_bukrs,s_kunnr and s_umskz given in selection screen are only single values.But even then the select statement is taking long time for execution and finally throwing TIME_OUT error.
‎2009 Feb 19 8:50 AM
IF s_kunnr [] IS INITIAL.
"better trigger error message
SELECT bukrs belnr gjahr FROM bkpf by providing BUKRS , BSTAT ( ' ' , 'A' , 'B' etc ), BUDAT(obligatory) in the where condition.
do the second select from BSEG passing bukrs belnr year along with other parameter which u have..
ELSE.
ur SELECT
ENDIF.
Cheers
‎2009 Feb 19 11:06 AM
I suggest to run the report in background mode. It can avoid the time-out error.
Otherwise check with the proper index used from table BSID.
Regards
Lalit
‎2009 Feb 19 11:25 AM
Hi,
you are selecting the data from the BSID table from your select statement the select fields order should not maintain the data base order , so that it takes lot of time ,change the fields order and run the program.
Regards,
Madhu