2006 Nov 07 11:59 AM
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 its 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
2006 Nov 07 1:40 PM
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
2006 Nov 07 2:33 PM
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
2006 Nov 07 4:42 PM
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