09-20-2008 11:27 AM
HI,
I have used following query in ABAP code in ABAP extract stage (in Datastage)
SELECT
bukrs
belnr
gjahr
INTO TABLE it_bkpf
FROM bkpf
WHERE cpudt >= 'date' OR aedat >=.'date'
The performance is very slow for 4000 records it is taking 22 minutes.
If i use the query
SELECT
bukrs
belnr
gjahr
INTO TABLE it_bkpf
FROM bkpf
WHERE cpudt >= 'date'
Then i got almost same records but it took only 1 minute.
But i must use first SQL .
Can anyone tell me how can i improve performance.?
Thanks in advance.
Pavan
09-20-2008 11:38 AM
Hi use this code:
SELECT
bukrs
belnr
gjahr
INTO TABLE it_bkpf
FROM bkpf
WHERE cpudt >= 'date' .
IF it_bkpf IS NOT INITIAL.
delete it_bkpf where aedat LT date.
ENDIF.
09-20-2008 11:38 AM
Hi use this code:
SELECT
bukrs
belnr
gjahr
INTO TABLE it_bkpf
FROM bkpf
WHERE cpudt >= 'date' .
IF it_bkpf IS NOT INITIAL.
delete it_bkpf where aedat LT date.
ENDIF.
09-21-2008 4:14 PM
Hi chandra,
In the code 'date' is actually current week .
If i use your code then i will get only those records which are created in the current week.
Suppose if a record is created not in current week but modified in current week then such records will not be obtained fro your query as you are not mentioning aedat in where claause.
All suggestions are welcomed.
Thanks in advance.
*Pavan*
09-21-2008 4:46 PM
Hi,
Did you check the output with AND instead of OR
SELECT
bukrs
belnr
gjahr
INTO TABLE it_bkpf
FROM bkpf
WHERE cpudt >= 'date' AND aedat >='date'.
09-22-2008 5:01 AM
Hi Krishna,
My requirement is that, i need to get all records which are created or modfied on particular date or week.
If i use 'AND' in where clause then record which is created on given date will not come because normally when it is created in CPUDT matches date value but AEDAT will be '00000000'. So such records will not be obtained .
09-21-2008 7:51 PM
Maybe there is using an INDEX for the field CPUDT and there is NO INDEX for the field AEDAT???
09-22-2008 9:17 AM
Make sure you include field BUKRS (single value if possible) in all selects on BKPF, since it is the first field in the primary and all secondary indexes.
Thomas