0
Dec 30, 2008 at 09:27 AM

# Problem with Select Statements

54 Views

Hi All,

I have a performance problem for my report because of the following statements.

How can i modify the select statements for improving the performance of the report.

*These statements are in LOOP.

SELECT shkzg SUM( dmbtr )

INTO (shkzg1s , kopbal1s)

FROM bsid

WHERE bukrs = ibukrs

AND kunnr = ktab-kunnr

AND budat < idate-low

AND shkzg = 'S'

AND umskz EQ ''

GROUP BY shkzg.

ENDSELECT.

SELECT shkzg SUM( dmbtr )

INTO (shkzg1su , kopbal1su)

FROM bsid

WHERE bukrs = ibukrs

AND kunnr = ktab-kunnr

AND budat < idate-low

AND shkzg = 'S'

AND umskz IN zspgl

GROUP BY shkzg.

ENDSELECT.

SELECT shkzg SUM( dmbtr )

INTO (shkzg1h , kopbal1h)

FROM bsid

WHERE bukrs = ibukrs

AND kunnr = ktab-kunnr

AND budat < idate-low

AND shkzg = 'H'

AND umskz EQ ''

GROUP BY shkzg.

ENDSELECT.

SELECT shkzg SUM( dmbtr )

INTO (shkzg1hu , kopbal1hu)

FROM bsid

WHERE bukrs = ibukrs

AND kunnr = ktab-kunnr

AND budat < idate-low

AND shkzg = 'H'

AND umskz IN zspgl

GROUP BY shkzg.

ENDSELECT.

SELECT shkzg SUM( dmbtr )

INTO (shkzg2s , kopbal2s)

WHERE bukrs = ibukrs

AND kunnr = ktab-kunnr

AND budat < idate-low

AND shkzg = 'S'

AND umskz EQ ''

GROUP BY shkzg.

ENDSELECT.

SELECT shkzg SUM( dmbtr )

INTO (shkzg2su , kopbal2su)

WHERE bukrs = ibukrs

AND kunnr = ktab-kunnr

AND budat < idate-low

AND shkzg = 'S'

AND umskz IN zspgl

GROUP BY shkzg.

ENDSELECT.

SELECT shkzg SUM( dmbtr )

INTO (shkzg2h , kopbal2h)

WHERE bukrs = ibukrs

AND kunnr = ktab-kunnr

AND budat < idate-low

AND shkzg = 'H'

AND umskz EQ ''

GROUP BY shkzg.

ENDSELECT.

SELECT shkzg SUM( dmbtr )

INTO (shkzg2hu , kopbal2hu)

WHERE bukrs = ibukrs

AND kunnr = ktab-kunnr

AND budat < idate-low

AND shkzg = 'H'

AND umskz IN zspgl

GROUP BY shkzg.

ENDSELECT.