Skip to Content

performance of select statement

Hi all,

I doing performance tuning for report .

when i checked in ST05 , the below 2 statements is taking more time eventhough i tried to reduce as much as possible .

SELECT ebeln

EBELP

BEWTP

BWART

budat

MATNR

werks

FROM EKBE INTO TABLE T_EKBE

WHERE BUDAT IN S_EINDT

AND matnr in so_matnr

AND WERKS IN S_WERKS

AND BEWTP EQ 'E'

AND BWART IN ('101','105').

IF NOT t_ekbe[] IS INITIAL.

SELECT ebeln

ebelp

etenr

eindt

menge

wemng

FROM EKET INTO TABLE T_EKET

FOR ALL ENTRIES IN T_EKBE

WHERE EBELN = T_EKBE-EBELN

AND EBELP = T_EKBE-EBELP.

Please suggest how to reduce the time taken.

regards

chetan

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • Best Answer
    Posted on Aug 14, 2009 at 12:37 PM

    Maybe you can first access EKET (index on EINDT) and then EKBE, if you normally have a small selection range in S_EINDT. Even better, use a JOIN and let the optimizer decide about the best access path.

    Thomas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 14, 2009 at 10:48 AM

    Hi

    The problem should be in the SELECT of EKBE, here u don't use any key fields, I don't know the logic of your program in order to find out the jey fields value before selecting EKBE data.

    So u should consider if it needs to create a secondary index with the fields you're using in the select.

    Max

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      in addition, keep in mind that EKBE tends to get very big, especially if you are working with framework orders or contracts. to reduce the size, try to move the data to EKBEH using RM06EKBE.

  • author's profile photo Former Member
    Former Member
    Posted on Aug 14, 2009 at 01:45 PM

    1) Create an index on database table EKET on field BUDAT.

    2) On the selection screen make field BUDAT mandatory.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 17, 2009 at 07:05 AM

    Itu2019s required to create an index to BUDAT and change the query like below.

    FROM EKBE INTO TABLE T_EKBE

    WHERE BUDAT IN S_EINDT

    AND matnr in so_matnr

    AND WERKS

    AND BEWTP EQ 'E'

    AND BWART EQ u2018101u2019 OR u2018105'.

    Sunitha.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 17, 2009 at 08:54 AM

    Hi,

    Use all the primary keys of table EKBE as done in below code.

    TABLES: S001.
    CONSTANTS: SSOUR_INI  LIKE S001-SSOUR VALUE   IS INITIAL,
               VRSIO_INI  LIKE S001-VRSIO VALUE   IS INITIAL,
               SPMON_INI  LIKE S001-SPMON VALUE   IS INITIAL,
    
               SPTAG_INI  LIKE S001-SPTAG VALUE   IS INITIAL,
               SPWOC_INI  LIKE S001-SPWOC VALUE   IS INITIAL,
               SPBUP_INI  LIKE S001-SPBUP VALUE   IS INITIAL.
    
    
    DATA: TA_S001 TYPE STANDARD TABLE OF S001.
    DATA: WA_S001 TYPE S001.
    
    SELECT-OPTIONS:
                  SO_SPTAG   FOR S001-SPTAG OBLIGATORY,
                  SO_KUNNR   FOR S001-KUNNR OBLIGATORY,
                  SO_VKORG   FOR S001-VKORG OBLIGATORY,
                  SO_VTWEG   FOR S001-VTWEG OBLIGATORY,
                  SO_SPART   FOR S001-SPART OBLIGATORY,
                  SO_MATNR   FOR S001-MATNR OBLIGATORY.
    
    START-OF-SELECTION.
    
    SELECT        * FROM  S001
    
           INTO TABLE TA_S001
           WHERE  SSOUR  GE SSOUR_INI     "Greater Equal initial value
           AND    VRSIO  GE VRSIO_INI     "   idem
           AND    SPMON  GE SPMON_INI     "   idem
           AND    SPTAG  IN SO_SPTAG
           AND    SPWOC  GE SPWOC_INI     "   idem
           AND    SPBUP  GE SPBUP_INI     "   idem
           AND    KUNNR  IN SO_KUNNR
           AND    VKORG  IN SO_VKORG
           AND    VTWEG  IN SO_VTWEG
           AND    SPART  IN SO_SPART
           AND    MATNR  IN SO_MATNR.
    
    

    You will definately find some improvement...

    Thanks,

    Krishna

    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.