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: 

plz reduse the f8 time

0 Kudos

dear all,

in my internal order report i have this select query.

in debugging i obserd that select sum( wkgbtr) is taking more time .how to make it fast .plz advise me. in o/p i need to present the values of sum (whgbtr) for present yer and previous year so i used 2 times .but it taking more time.

select ktext gsber idat1 idat3 objnr from aufk into corresponding fields of

table it_aufk1

where kokrs = p_kokrs

and objnr in p_objnr.

loop at it_aufk1.

select sum( WKGBTR )

perio

from coep into table IT_COEP1 where objnr EQ IT_AUFK1-objnr

and gjahr = p_gjahr

and kokrs = p_kokrs

and beknz <> 'A' and beknz <> 'L'

group by coepobjnr coepperio.

some mathematial operations.

num = p_gjahr - 1.

SELECT

SUM( WKGBTR )

INTO TABLE IT_COEP2

FROM COEP

where objnr eq IT_AUFK1-objnr

and beknz <> 'A' and beknz <> 'L'

and gjahr eq num .

endloop.

thanking you,

sudhakar

3 REPLIES 3

0 Kudos

Hi,

Do not put SELECT statements in a LOOP.

Try using FOR ALL ENTRIES along with the table.

select sum( WKGBTR )

perio

from coep into table IT_COEP1 FOR ALL ENTRIES in it_aufk1 where objnr EQ IT_AUFK1-objnr

and gjahr = p_gjahr

and kokrs = p_kokrs

and beknz <> 'A' and beknz <> 'L'

group by coepobjnr coepperio.

some mathematial operations.

num = p_gjahr - 1.

SELECT

SUM( WKGBTR )

INTO TABLE IT_COEP2

FROM COEP

FOR ALL ENTRIES IN IT_AUFK1

where objnr eq IT_AUFK1-objnr

and beknz <> 'A' and beknz <> 'L'

and gjahr eq num .

Regards,

Sesh

Former Member
0 Kudos

hi

<b>donot use into corresponding fields of. its not advisable at all to use.</b>

<b>donot put select inside loop

instaed try using read statement and for all entries</b>

regards

ravish

b]plz dont forget to reward points if useful</b>

Former Member
0 Kudos

If you go to transaction SE38 and go to menu path Environment->Examples-> you will see a number of options. Choose the performance examples and you will find a whole load of examples talking about speeding up DB access and internal table processing.

I suggest you have a look through that and try to speed up your own code.

Gareth.