10-16-2008 1:05 PM
Hi,
I have an expencesive sql statement.
how to tune this one.
Get Q linked to position
lt_objid[] = I_OBJID_TAB[].
IF NOT LT_OBJID[] IS INITIAL.
SELECT OBJID SOBID INTO TABLE LT_STOQ
FROM HRP1001
FOR ALL ENTRIES IN LT_OBJID
WHERE OTYPE = 'S'
AND OBJID = LT_OBJID-OBJID
AND PLVAR = '01'
AND RSIGN = 'A'
AND RELAT = 'ZPC'
AND ISTAT = '1'
AND BEGDA <= KDATE
AND ENDDA >= KDATE
AND SCLAS = 'Q'.
IF SY-SUBRC = 0.
LOOP AT LT_STOQ.
LT_OBJID2-OBJID = LT_STOQ-SOBID.
APPEND LT_OBJID2.
ENDLOOP.
SORT LT_OBJID2.
DELETE ADJACENT DUPLICATES FROM lt_objid2.
ENDIF.
Thanks in Advance
10-16-2008 1:11 PM
Since your using only OBJID field in for all entering deleting adajcent duplicate comparing only with oBJID should be done . Did you do that ??? If not do it it will have impact on your performance.
SORT LT_OBJID by OBJID.
DELETE ADJACENT DUPLICATES FROM lt_objid comparing OBJID.