08-20-2007 4:26 PM
hallow
i doing this code and i wont to now if i can improve this select
SELECT pernr
endda
begda
kostl
ename
FROM pa0001
INTO CORRESPONDING FIELDS OF TABLE lt_pa0001
WHERE begda LE gdate
AND endda GE gdate_13
AND kostl NE '' "
AND persk NE 'ZZ'
AND persg NE '5'.
Regards
08-20-2007 4:27 PM
08-20-2007 4:27 PM
08-20-2007 4:31 PM
Hi,
Try to avoid using into corresponding fields instead use into table statement. And If possible use Pernr in select statement.
Thanks,
Sriram.
08-20-2007 4:36 PM
HI ,
declare the it_pa0001 filed in the same sequence as in select and remove that into corresponding option in the select statement.
Thanks
Mahesh
08-20-2007 4:38 PM
Are you familiar with indexes? What index do you have on PA0001?
The statement will not be very performant anyway
begindate is smaller something, and enddate is larger something, so not in an interval,
non-equal can of course not be supported by indexes.
AND kostl NE '' "
AND persk NE 'ZZ'
AND persg NE '5'.
So your statement is very likely to be a full scan on PA0001, hopefully, there are not many records in this table.
Siegfried
08-20-2007 4:42 PM
following are the index avaiable:
ABK
BUK
KST
ORG
PBR
PGR
PKR
PTB
SAZ
VDS
maybe check which can be used efficeintly ir ur query. also as checked by other restrict in using coressponding and check ur intervals
08-20-2007 4:53 PM
Hi,
Try to use all Key fields as declared in table.
Like :
Select Key1
Key2
Key3
From Mara
where matnr.........ect
Thanks and Regards,
Thrivikram