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

how we replace '0000%'

Former Member
0 Likes
1,279

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%'.

12 REPLIES 12
Read only

former_member242255
Active Contributor
0 Likes
1,244

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

Read only

former_member585060
Active Contributor
0 Likes
1,244

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

Read only

Former Member
0 Likes
1,244

>

> Hi , how to replaece LIKE '0005%' to improve the performance of quarry.

.

Selection is fine,ensure I_BKPF [] IS NOT INITIAL.

Cheers

Read only

Former Member
0 Likes
1,244

these variables determine your performance


WHERE BUKRS = P_BUKRS
AND BELNR = I_BKPF-BELNR
AND GJAHR IN S_GJAHR

Read only

Former Member
0 Likes
1,244

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

Read only

Former Member
0 Likes
1,244

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

Read only

Former Member
0 Likes
1,244

> 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.

Read only

0 Likes
1,244

>

> 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_GJAHR

It was there in BKPF.

Rob

Edited by: Rob Burbank on Feb 20, 2009 9:31 AM

Read only

Former Member
0 Likes
1,244

@Rob

I know ... sometimes I get the feeling, that clearer words help. I know that I will never have your patience.

Siegfried

Read only

0 Likes
1,244

Now that they made me a moderator, I find that I have to bite my tongue a lot more often.

Rob

Read only

0 Likes
1,244

Sometimes you just have to be a bit boes to get the message across

Read only

Former Member
0 Likes
1,244

>

> 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