‎2010 Apr 01 8:52 AM
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
‎2010 Apr 01 9:42 AM
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
‎2010 Apr 01 9:02 AM
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.
‎2010 Apr 01 9:15 AM
> used all the key fields in BSEG table
not really ... the last one is missing
But still I do not really see the problem.
‎2010 Apr 01 9:17 AM
>
> > 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.
‎2010 Apr 01 9:22 AM
Hi,
what is a long time? Trace it with the SQL trace (ST05) to get more details...
Kind regards,
Hermann
‎2010 Apr 01 9:42 AM
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
‎2010 Apr 01 9:53 AM
>
> 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!
‎2010 Apr 01 9:20 PM
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