Skip to Content
0
Former Member
Sep 03, 2007 at 06:04 AM

Regarding database access performance

15 Views

Hi,

I am pasting the code which i have used to access the database, i m displaying the report in alv format....when i checked it in se30 the results for database access are quite high...how can i optimize the performance.......

SELECT KUNNR

NAME1

INTO TABLE IT_KNA1

FROM KNA1

WHERE KUNNR IN S_KUNNR.

SELECT VBELN

KNUMV

KUNNR

INTO TABLE IT_VBAK

FROM VBAK

FOR ALL ENTRIES IN IT_KNVV

WHERE SPART = IT_KNVV-SPART

AND KUNNR = IT_KNVV-KUNNR.

IF SY-DBCNT = 0.

MESSAGE E001(Z_MESG).

ENDIF.

SELECT KNUMV

KSCHL

KAWRT

INTO TABLE IT_KONV

FROM KONV

FOR ALL ENTRIES IN IT_VBAK

WHERE KNUMV = IT_VBAK-KNUMV.

SELECT VBELN

MATNR

ARKTX

WERKS

NETPR

INTO TABLE IT_VBAP

FROM VBAP

FOR ALL ENTRIES IN IT_VBAK

WHERE WERKS IN S_WERKS

AND MATNR IN S_MATNR

AND VBELN = IT_VBAK-VBELN.

IF SY-DBCNT = 0.

MESSAGE I002(Z_MESG) with s_werks s_matnr.

ENDIF.

SELECT VBELN

FKIMG

NETWR

AUBEL

PRCTR

INTO TABLE IT_VBRP

FROM VBRP

FOR ALL ENTRIES IN IT_VBAP

WHERE AUBEL = IT_VBAP-VBELN.

SELECT VBELN

VGBEL

INTO TABLE IT_LIPS

FROM LIPS

FOR ALL ENTRIES IN IT_VBAP

WHERE VGBEL = IT_VBAP-VBELN.

SELECT DMBTR

XBLNR

INTO TABLE IT_BSIS

FROM BSIS

FOR ALL ENTRIES IN IT_LIPS

WHERE ( HKONT = '0004111013' OR HKONT = '0004111008' OR HKONT = '0004111009' )

AND BUDAT IN S_BUDAT

AND XBLNR = IT_LIPS-VBELN.

IF SY-DBCNT = 0.

MESSAGE I003(Z_MESG) with S_BUDAT.

ENDIF.