Skip to Content
author's profile photo Former Member
Former Member

Regarding database access performance

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.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Sep 03, 2007 at 06:09 AM

    1. Replace your FOR ALL ENTRIES by RANGES

    2. If you would like to use FOR ALL ENTRIES, try to prepare the internal table with only one entry by key (ex the select on KONV, KNUMV is not the key of IT_VBAK, so you will access several times the same key in the database).

    I think your reponse time problem is due to the FOR ALL ENTRIES. If you make an ST05 you will show that this command make several access instead of a simple RANGES.

    Sometimes it's better to access all the table than select requiered entry (for ex. KNA1).

    Fred

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.