07-29-2005 12:43 PM
Dear All,
I am having performance problem in my report .
And getting short dump also.
Would please suggest me how I will rectified it.
Code for your reference.
SELECT *
FROM pa0302
INTO CORRESPONDING FIELDS OF TABLE it_pa0302
FOR ALL ENTRIES IN it_p0001
WHERE massn IN ('01','08','12','EX')
AND pernr = it_p0001-pernr
AND ( ( begda BETWEEN w_frmdt and w_todt ) "PJ141004
AND begda = it_p0001-begda. "PJ921004
AND endda = it_p0001-endda ). " ).
AND begda <= w_todt.
LOOP AT it_p0001.
LOOP AT it_pa0302 WHERE pernr EQ it_p0001-pernr..
it_pernr-pernr = it_p0001-pernr.<-Short dump occurs
it_pernr-werks = it_p0001-werks.
it_pernr-persk = it_p0001-persk.
it_pernr-massn = it_pa0302-massn.
it_pernr-massg = it_pa0302-massg.
it_pernr-act_date = it_pa0302-begda.
IF it_pa0302-massn = '04' AND
( it_pa0302-massg = '02' OR
it_pa0302-massg = ' ' ).
it_pernr-own_int = 'X'.
ELSEIF it_pa0302-massn = '12' AND
( it_pa0302-massg = '01' OR
it_pa0302-massg = ' ' OR
it_pa0302-massg = '03' ).
it_pernr-own_int = 'X'.
ENDIF.
APPEND it_pernr.
CLEAR it_pernr.
ENDLOOP.
ENDLOOP.
Thanks in advance
07-29-2005 12:48 PM
...it_pernr-pernr = it_p0001-pernr.<-Short dump occurs
...
1) which short dump ?
i think you'll move a wrong type to it_pernr-pernr
pls check field it_p0001-pernr
2)
-is table it_pa0302 a sorted / hashed table
if not , pls change table-type
- i think you can save yor 1st select with for all entries -> you can integrate this select in your loop
regards Andreas
07-29-2005 12:55 PM
Are you checking whether it_p0001 has some value in it before using 'FOR ALL ENTRIES'? If the internal table it_p0001 does not have any records, all the records from the table will be selected.
For example.
IF NOT it_p0001[] IS INITIAL.
SELECT....
ENDIF.
07-29-2005 1:59 PM
Hi Siladitya,
please reward the points to the answers that have helped you / satisfactorily answered your question. You do that by clicking the stars that you find against each response you get.
thanks and regards
Andreas
07-29-2005 1:20 PM
Dear Andreas,
I am getting short dump TIME_OUT as line mentioned ealier.
1.Internal Table it_pa0302 defined like
DATA : it_pa0302 LIKE pa0302 OCCURS 0 WITH HEADER LINE.
2. IT_P0001 not initial.
Regards
Siladitya
07-29-2005 1:29 PM
Hi Siladitya,
so define it_pa0302 :
data it_pa0302 type sorted table of pa0302
with unique key pernr...
p.s.
run abap in batch mode .
perhaps there's no performance problem ?!
regards Andreas
07-29-2005 1:50 PM
Hi,
instead of FOR ALL ENTRIES, if IT_P0001 is less than 3000 entries, you could use RANGES.
If you take all the data of the table, don't set for all entries, just check good value after the select.
Maybe you could check with SE30 what take lot of time ? database or abap ?
You could replace your two loops by a loop from index. (Need and example ?)
Regards
Frédéric
07-29-2005 1:45 PM
Hello,
1. you only use a few fields of pa0302. Use
SELECT field1 field2 .. from pa0302...
->keeps amount of transferred data lower
2. Handle nested loops with care.
Replace
LOOP AT it_p0001.
LOOP AT it_pa0302 WHERE pernr EQ it_p0001-pernr..
by
DATA: l_tbx TYPE sy-tabix.
SORT it_pa0302 BY pernr.
LOOP AT it_p0001.
READ TABLE it_pa0302 WITH KEY pernr = it_p0001-pernr
TRANSPORTING NO FIELDS.
l_tbx = sy-tabix.
LOOP AT it_pa0302 FROM l_tbx.
IF it_pa0302-pernr NE it_p0001-pernr.
EXIT.
ENDIF.
3. Do not use implicit workarea. Define structures to handle the lines of the internal tables.
DATA: l_p0001 TYPE p0001.
Instead of
LOOP AT it_p0001.
use
LOOP AT it_p0001 INTO l_p0001 TRANSPORTING field1 field2....
Christian
07-29-2005 1:51 PM
07-29-2005 1:46 PM
Dear Andreas
Thanks I have changed the program .
After transporting it to Prod .
I will let you know.
Thanks again.
Siladitya
07-29-2005 1:54 PM
Make sure that you sort the It_P0001 before the select. Also, it may help if you flip/flop the where clause a bit.
<b>Sort it_p0001 ascending by pernr.</b>
SELECT * FROM pa0302
INTO CORRESPONDING FIELDS OF TABLE it_pa0302
FOR ALL ENTRIES IN it_p0001
<b> WHERE pernr = it_p0001-pernr
and massn IN ('01','08','12','EX')</b>
* AND ( ( begda BETWEEN w_frmdt and w_todt ) "PJ141004
* AND begda = it_p0001-begda. "PJ921004
* AND endda = it_p0001-endda ). " ).
AND begda <= w_todt.
Regards,
Rich Heilman