Skip to Content
0
Former Member
Dec 10, 2009 at 04:21 AM

Reducing Data base selection time

36 Views

Hi,

I need to get the Excise Documnets which are not Billed. For that I've used following logic. But it is taking much time to get the data.

SELECT a~exnum

a~exyear

a~exdat

a~rdoc2

SUM( a~exbed )

SUM( a~ecs )

SUM( a~exaddtax1 )

b~vbtyp

b~knumv

b~bukrs

b~kunrg

FROM j_1iexcdtl AS a INNER JOIN vbrk AS b

ON ardoc2 EQ bvbeln

INTO TABLE lt_excise WHERE a~exdat IN s_fkdat AND

a~status EQ 'C' AND

  • a~exdat ge '20090401' AND

NOT EXISTS ( SELECT vbeln FROM vbrk WHERE vbeln EQ a~rdoc3 AND

vbtyp EQ 'M' ) AND

b~vbtyp EQ 'U' AND

b~bukrs IN s_bukrs AND

b~kunrg IN s_kunrg

GROUP BY a~exnum

a~exyear

a~exdat

a~rdoc2

b~vbtyp

b~knumv

b~bukrs

b~kunrg.

Pl help to reduce the time for database selection.

Regards,

Rajiv. V