‎2009 Feb 20 4:20 AM
Hi , how to replaece LIKE '0005%' to improve the performance of quarry.
SELECT BELNR WRBTR ZUONR HKONT SHKZG BUZEI
INTO TABLE I_BSEG
FROM BSEG
FOR ALL ENTRIES IN I_BKPF
WHERE BUKRS = P_BUKRS
AND BELNR = I_BKPF-BELNR
AND GJAHR IN S_GJAHR
AND HKONT LIKE '00005%'.
‎2009 Feb 20 4:24 AM
Insteat you can remove the condition on SELECT statement and once you get the data and into internal table then filter out from it.
else
you can write like the below
data : Var1 type c value '00005'.
concatenate Var1 '%' into FINAL.
and use the FINAL variable in the select WHERE cond..
Regards.
Sravan
Edited by: Sravan Kumar on Feb 20, 2009 5:36 AM
Edited by: Sravan Kumar on Feb 20, 2009 5:38 AM
‎2009 Feb 20 4:41 AM
Hi,
Try this code
SELECT belnr
wrbtr
zuonr
hkont
shkzg
buzei NTO TABLE i_bseg
FROM bseg
FOR ALL ENTRIES IN i_bkpf
WHERE bukrs = p_bukrs
AND belnr = i_bkpf-belnr
AND gjahr IN s_gjahr
AND hkont IN s_hkont. " Declare a Select-option of HKONT and give full value '00005*'
LOOP AT i_bseg INTO wa_bseg.
IF wa_besg-hkont+0(5) = '00005'.
wa_bseg-flag = 'X'. " In your i_bseg internal table declare a field flag.
MODIFY i_bseg FROM wa_bseg INDEX sy-tabix TRANSPORTING flag.
ENDIF.
ENDLOOP.
DELETE i_bseg WHERE flag = 'X'.Regards
Bala Krishna
‎2009 Feb 20 8:04 AM
>
> Hi , how to replaece LIKE '0005%' to improve the performance of quarry.
.
Selection is fine,ensure I_BKPF [] IS NOT INITIAL.
Cheers
‎2009 Feb 20 8:46 AM
these variables determine your performance
WHERE BUKRS = P_BUKRS
AND BELNR = I_BKPF-BELNR
AND GJAHR IN S_GJAHR
‎2009 Feb 20 8:50 AM
Hi,
instead of passing the hardcoded values ,first declare like:
Data : val1 type c value '00005%'.and then use val one in the final select querry
‎2009 Feb 20 9:02 AM
And to add to that do not include % in data declaration .i included that by mistake.
after declaring concatenate % into final_val.
then pass this final_val in where condition of select querry.
Regards,
Rahul
‎2009 Feb 20 2:21 PM
> And to add to that do not include % in data declaration .i included that by mistake.
> after declaring concatenate % into final_val.
> then pass this final_val in where condition of select querry.
sorry, that is complete waste of time with zero impact.
‎2009 Feb 20 2:30 PM
>
> sorry, that is complete waste of time with zero impact.
Ahh Siegfried - you do have a way with words
Anyway, not wishing to pour more gasoline on the fire, I'll just add that it doesn't make much sense to use
AND GJAHR IN S_GJAHRIt was there in BKPF.
Rob
Edited by: Rob Burbank on Feb 20, 2009 9:31 AM
‎2009 Feb 20 3:52 PM
@Rob
I know ... sometimes I get the feeling, that clearer words help. I know that I will never have your patience.
Siegfried
‎2009 Feb 20 3:55 PM
Now that they made me a moderator, I find that I have to bite my tongue a lot more often.
Rob
‎2009 Feb 20 4:33 PM
Sometimes you just have to be a bit boes to get the message across
‎2009 Feb 25 10:43 AM
>
> Hi , how to replaece LIKE '0005%' to improve the performance of quarry.
>
> AND HKONT LIKE '00005%'.
Hi,
you don't have to!
if your access pattern is best to express with a wildcard , just use it.
And if you put it at the trailing end the use of an index is supported if your filter expression
is selective enough.
As Siegfried already pointed out your problem are the other fields in the WHERE condition.
Also look at the size of your FAE table - the used fields here should be supported by an appropriate index even more if it's huge.
bye
yk