Skip to Content
0
Former Member
Jan 27, 2009 at 03:24 PM

How to make this code go faster?

32 Views

Hi,

I have this code and its really slow. My question is how to make it faster since its taking about 10 hours.

Code:

  loop at ti_equi.
    select matnr sernr lief_nr kunde datum uzeit bwart posnr
 appending corresponding fields of table ti_ser01
      from z_objk_ser01
     where sernr eq ti_equi-sernr
       and matnr eq ti_equi-matnr.
  endloop.

  delete ti_ser01 where not ( kunde in s_kunnr and
                              bwart = '631' ).
  sort ti_ser01 by matnr sernr datum descending uzeit descending.
  delete adjacent duplicates from ti_ser01 comparing matnr sernr.

What this code does is fetch all these fields and then just keeps the one that's been modified at last.

I have created an index by sernr and matnr in table objk which makes it just a little bit faster.

Any helpful answer will be appreciated.

Regards,

Roberto

Edited by: Julius Bussche on Jan 27, 2009 4:29 PM

Code tags added. Please use more meaningfull subject titles