Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Reg: Slow performance of BKPF table due to AEDAT column in where clause

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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.

6 REPLIES 6

Former Member
0 Kudos

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.

0 Kudos

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*

0 Kudos

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'.

0 Kudos

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 .

former_member190578
Participant
0 Kudos

Maybe there is using an INDEX for the field CPUDT and there is NO INDEX for the field AEDAT???

ThomasZloch
Active Contributor
0 Kudos

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