‎2008 Jun 18 12:24 PM
The following Statement is expensive on DB.
Kindly suggest the changes.....
SELECT DISTINCT pernr INTO it_pernr-pernr
FROM pa0001
CLIENT SPECIFIED
WHERE mandt EQ sy-mandt
AND pernr IN s_pernr
AND subty EQ space
AND objps EQ space
AND sprps EQ space
AND endda GE sy-datum
AND begda LE sy-datum
AND seqnr EQ '000'
AND bukrs IN s_bukrs
AND werks IN s_werks
AND persg IN s_persg
AND persk IN s_persk.
READ TABLE it_adpernr INTO wa_adpernr
WITH TABLE KEY pernr = it_pernr-pernr.
IF sy-subrc EQ 0.
APPEND it_pernr.
wa_adpernr-entry = 'X'. "indicator selection
MODIFY it_adpernr FROM wa_adpernr
TRANSPORTING entry
WHERE pernr EQ it_pernr-pernr.
ENDIF.
ENDSELECT.
‎2008 Jun 18 12:26 PM
Hello,
I suggest you to do a select with all EQ and IN conditions and the use a if to delete the rows with the others conditions ( GE, and LE ).
And look in the table if all fields that you're using are in an index.
Regards.
‎2008 Jun 18 12:28 PM
Don't use select and aselect , instead do a seelct and do the read and modify opeartions later.
‎2008 Jun 18 12:37 PM
Hi,
just use the select query as given below.
SELECT DISTINCT pernr INTO table it_pernr
FROM pa0001
CLIENT SPECIFIED for all entries in it_adpernr
WHERE mandt EQ sy-mandt
AND pernr it_adpernr-pernr
AND subty EQ space
AND objps EQ space
AND sprps EQ space
AND endda GE sy-datum
AND begda LE sy-datum
AND seqnr EQ '000'
AND bukrs IN s_bukrs
AND werks IN s_werks
AND persg IN s_persg
AND persk IN s_persk.
If you use the select query like this it will bring the data at one shot.