Skip to Content
0
Former Member
Jun 15, 2009 at 02:36 PM

Optimizing program (SELECT query).

23 Views

The below piece of code is taking a long time for execution. Can somebody please suggest a better way to write it.

-


lv_sydatum2 = sy-datum - 5.

SELECT anlage

auszdat

FROM ever

INTO TABLE lt_ever PACKAGE SIZE 5000

WHERE anlage NE space

AND auszdat LE lv_sydatum2.

SELECT ablbelnr

FROM eablg

into TABLE lt_eab

FOR ALL ENTRIES IN lt_ever[]

WHERE anlage = lt_ever-anlage

AND ablesgr = '01'

AND adatsoll GT lt_ever-auszdat.

SELECT ablbelnr

from eabl

appending TABLE lt_eab1

for all ENTRIES IN lt_eab[]

where ablbelnr = lt_eab-ablbelnr

and ablstat = '0'.

CLEAR lt_ever.

REFRESH lt_ever.

CLEAR lt_eab.

REFRESH lt_eab.

ENDSELECT.

-