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

Time exceed error

Former Member
0 Likes
577

Hi all

I have report which match with the production details, I cant get the one month data any disturbance, but of I select two month data it has 100000 records, problem is it’s getting error time limit exceed I have put back ground process still the error is generating please fine the code following,(loop),please help me

LOOP AT IT_ITAB INTO WA_ITAB. “This has 10000 records

CONCATENATE 'OR' WA_ITAB-AUFNR INTO

W_AUFNR.

*Settlement

CLEAR W_SET_NO.

SELECT SINGLE BELNR INTO W_SET_NO

FROM AUAK

WHERE OBJNR = W_AUFNR.

CLEAR W_DOC.

SELECT SINGLE BELNR INTO W_DOC

FROM BKPF

WHERE AWKEY = W_SET_NO AND BUKRS = COMP .

*double entry value.

DATA CR LIKE BSIS-SHKZG.

W_VALUE = 0.

CLEAR CR.

SELECT SINGLE DMBTR INTO W_VALUE

FROM BSIS

WHERE BELNR = W_DOC AND BUKRS = COMP.

SELECT SINGLE MONAT INTO WA_ITAB-MONAT

FROM BSIS

WHERE BELNR = W_DOC AND BUKRS = COMP.

Endloop.

Thanks

Kanishka

3 REPLIES 3
Read only

Former Member
0 Likes
492

My first suggestion would be to remove the selects inside the loop..that's too expensive. You have to find a way to select the data outside the loop/endloop and that will solve your problem.

Cheers

Read only

Former Member
0 Likes
492

The problem is that you are selecting against large tables without using keys.

In the select against BKPF, you must at least add AWTYP.

You are selecting twice against BSIS using the same criteria. So you really only should do it once. But that SELECT also doesn't use an index. You should select ONCE against BSEG instead, using the BUKRS, BELNR and GJAHR that you get from the first (corrected) SELECT against BKPF.

Rob

Read only

Former Member
0 Likes
492

hi,

Your code has perfomance issues. You cannot put big tables like BSEG and BSIS in a loop....IF you do that you will get time out.

One way to do it is select whatever you want outside the loop in an internal table .. then use all entries on that internal table.

Plus you will have to use most of the primary keys if not all in tables like BSEG and BSIS.

in the last part of the code you are doing select two times on the same table for the same conditions that is also not necessary.. use select once and take both the values.

Mainly in this code the performance has to be taken care of otherwise it will give time out

Prince