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: 

how to get better perform here

Former Member
0 Kudos

hi there,

bellow code is using with in the loop. how can i modify to get better performance.

SELECT knumv kposn kwert FROM konv

INTO CORRESPONDING FIELDS OF lt_konv

WHERE knumv EQ lt_output-knumv

AND kposn EQ lt_output-posnr

AND kschl EQ 'VPRS'.

COLLECT lt_konv.

ENDSELECT.

thx in adv.

4 REPLIES 4

Former Member
0 Kudos

Dont use select ..end select inside loop...

Use for all entries..

0 Kudos

thnkas.

this code is repeated 5 times with deferent where clause..ofcourse only one time only it's executed.

but it is using collect..normally i worked with append..

can we use sum..etc here

any suggetions

former_member194613
Active Contributor
0 Kudos

the better solution for the select statement whould be to use the aggreagte function sum for the field kwert:

SELECT knumv kposn sum(kwert)

FROM konv

INTO CORRESPONDING FIELDS OF table lt_konv

WHERE knumv EQ lt_output-knumv

AND kposn EQ lt_output-posnr

AND kschl EQ 'VPRS'.

The select is inside the loop an lt_output.

Aggregate functions and FOR ALL ENTRIES can not be combined, the

FOR ALL ENTRIES is a select distinct !!!

So you must leave the loop around the select and you can't use the FOR ALL ENTRIES, but this is o.k.,

Siegfried

0 Kudos

thanks man.

points awarded:)