Skip to Content
0
Mar 13, 2009 at 01:58 PM

Improve that SELECT statement:

206 Views

Hello,

I'm in CRM and I have to get the partners with some activity from a given date. The date format is a time stamp (DEC 15 field), so if the user enters a very old date, for example year 2007 date, the operation date_1 > p_date is very very slow and the programp generates a dump.

Maybe if I select the whole table and check the values later in a LOOP the performance will improve but I'm not sure because there are 17.000.000 entries on table crmd_order_index and my possible result is around 40.000 entries.

What do you think?

  SELECT DISTINCT a~partner_no
    INTO TABLE lt_partners32
    FROM crmd_order_index AS a INNER JOIN crm_jest AS b
    ON a~header = b~objnr
    WHERE a~object_type     =  'BUS2000126' "Activity
      AND a~process_type_ix IN ('0000','Z000')
      AND a~STAT_OPEN      <> 'X' "Closed
      AND a~date_1               >= p_date
      AND b~inact                  =  SPACE
      AND b~stat                   =  'E0003'.

Edited by: Marshal on Mar 13, 2009 3:01 PM