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

BSEG performance issue

Former Member
0 Likes
972

How come i have used all the key fields in BSEG table in the WHERE condition but the runtime is still very slow? During debug, the process will be stuck for a long time in the select single statement from BSEG, however, if i try to input the same WHERE fields in SE16n, data is retrieved in just a second. Does the lack of mandt in the WHERE condition has something to do with it?

here is the code:

select single zlsch

from bseg

into i_clear-zlsch

where bukrs = i_clear-bukrs

and belnr = i_clear-belnr

and gjahr = i_clear-gjahr

and zlsch = 'C' or zlsch = 'E'.

Edited by: edztan15 on Apr 1, 2010 9:56 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
896

If you pasted your code correctly, I believe it might be a simple issue of missing brackets:


select single zlsch from bseg into i_clear-zlsch
       where bukrs = i_clear-bukrs
         and belnr = i_clear-belnr
         and gjahr = i_clear-gjahr
         and ( zlsch = 'C' or zlsch = 'E' ).

Remove the single and you should see that this makes a difference. Might be off, but your conditions look odd without the bracket...

Cheers, harald

7 REPLIES 7
Read only

Former Member
0 Likes
896

hi

Check here!

[Quickly Retrieving FI document Data from BSEG|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417100)ID0608414050DB01579708719316768280End?blog=/pub/wlg/7692]

select single zlsch

from bseg

into i_clear-zlsch

where bukrs = i_clear-bukrs

and belnr = i_clear-belnr

and gjahr = i_clear-gjahr

and zlsch = 'C' or zlsch = 'E'.

here you are selecting single record zlsch then in where condition you are specify the same filed (C,E) it will reterive only one record!.

[check here|http://forums.sdn.sap.com/search.jspa?threadID=&q=BSEGperformanceissue&objID=f234&dateRange=all&numResults=15&rankBy=10001]

you can use secondary index table.

Read only

Former Member
0 Likes
896

> used all the key fields in BSEG table

not really ... the last one is missing

But still I do not really see the problem.

Read only

0 Likes
896

>

> > used all the key fields in BSEG table

> not really ... the last one is missing

>

> But still I do not really see the problem.

Yup, the last one is missing, but the issue is the same even if I add that one.

Read only

HermannGahm
Product and Topic Expert
Product and Topic Expert
0 Likes
896

Hi,

what is a long time? Trace it with the SQL trace (ST05) to get more details...

Kind regards,

Hermann

Read only

Former Member
0 Likes
897

If you pasted your code correctly, I believe it might be a simple issue of missing brackets:


select single zlsch from bseg into i_clear-zlsch
       where bukrs = i_clear-bukrs
         and belnr = i_clear-belnr
         and gjahr = i_clear-gjahr
         and ( zlsch = 'C' or zlsch = 'E' ).

Remove the single and you should see that this makes a difference. Might be off, but your conditions look odd without the bracket...

Cheers, harald

Read only

0 Likes
896

>

> If you pasted your code correctly, I believe it might be a simple issue of missing brackets:

>


> select single zlsch from bseg into i_clear-zlsch
>        where bukrs = i_clear-bukrs
>          and belnr = i_clear-belnr
>          and gjahr = i_clear-gjahr
>          and ( zlsch = 'C' or zlsch = 'E' ).
> 

> Remove the single and you should see that this makes a difference. Might be off, but your conditions look odd without the bracket...

>

> Cheers, harald

Actually, i also just found out that this is the case! Although I pasted it correctly, I just realized that the last WHERE field is weird. Adding bracket (like you suggested) or putting it in a range seems to fix the issue. Thanks!

Read only

0 Likes
896

It's not so weird once you know the rules behind the logical expressions:

http://help.sap.com/abapdocu_70/en/ABENLOGEXP_BOOLE.htm

I admit I have to look this up occasionally and rather use some brackets too many to be on the safe side

Thomas