Skip to Content
0
Former Member
Mar 25, 2009 at 11:39 AM

Select query getting too slow.

97 Views

Hello Friends,

I have a performance tunning problem.

I have select options like,

Customer : S_KUNNR

Create date : S_CRT_DT

Change Date : S_CHG_DT

for this i am executing following select query.

* Get the customer details.
  SELECT t1~kunnr t2~name1 t2~name2 t2~name3 t2~sort1
      INTO TABLE i_cust_details
      FROM kna1 AS t1
      INNER JOIN adrc AS t2
        ON t2~addrnumber = t1~adrnr
      INNER JOIN cdhdr AS t3
        ON t3~objectid = t1~kunnr
    WHERE t1~kunnr IN s_kunnr            " Customer
      AND t1~erdat IN s_crt_dt           " Creation date
*     Following sub query for the most recent changed date.
      AND t3~changenr = ( SELECT MAX( changenr )
                               FROM cdhdr AS t4
                            WHERE t4~objectclas = wc_objclass
                              AND t4~objectid   = t1~kunnr
                              AND t4~udate     IN s_chg_dt )

      AND t3~objectclas = wc_objclass
      AND t1~ktokd = ZACT1.

but it takes mauch time.

how can i solve this?