Application Development 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: 

Performance

Former Member
0 Kudos

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

10 REPLIES 10

andreas_mann3
Active Contributor
0 Kudos

...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

Vinod_Chandran
Active Contributor
0 Kudos

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.

0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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

0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

maybe you forget the binary search ?

Former Member
0 Kudos

Dear Andreas

Thanks I have changed the program .

After transporting it to Prod .

I will let you know.

Thanks again.

Siladitya

0 Kudos

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