09-24-2008 8:13 AM
Hi Experts
I am trying to reduce the databse load on BKPF table in my program.
I have written the select as follows:
SELECT BUKRS BELNR GJAHR BLART BUDAT AWKEY FROM BKPF
INTO TABLE IST_BKPF
FOR ALL ENTRIES IN IST_EKBE
WHERE BUKRS IN S_BUKRS AND
GJAHR = IST_EKBE-GJAHR AND
AWKEY = IST_EKBE-AWKEY.
AWKEY is obtained as follows:
LOOP AT IST_EKBE INTO WA_EKBE.
CONCATENATE WA_EKBE-BELNR WA_EKBE-GJAHR INTO WA_EKBE-AWKEY.
MODIFY IST_EKBE FROM WA_EKBE TRANSPORTING AWKEY.
CLEAR : WA_EKBE.
ENDLOOP.
I have used all the primary keys available on BKPF table,please suggest me as to how i can reduce the load on it.
Presently the load is around 85% on BKPF table itself.
Thanks in advance
Rehman
09-24-2008 8:15 AM
HI,
First of all put the select query inside
if IST_EKBE is initial.
endif.
as in case of FOR ALL ENTRIES, if the mother internal table is NULL, it will fetch all the data of BKPF.
Regards,
Anirban
09-24-2008 8:59 AM
You need to include BKPF-AWTYP in the WHERE-conditions, so secondary index BKPF~4 can be used for quick access.
AWTYP will have a fixed value for all these documents, which one it is I don't know by heart (maybe RMRP) but you can find out yourself by looking at a single BKPF row via SE16.
Thomas
09-24-2008 2:41 PM
Check the internal table IST_EKBE is not intital.
if IST_EKBE is not initial.
write the select quiry here.
endif.
Here if we wont check this, Where condition in the select quiry will fail and large amount of data will be fetched.
Regards,
Bharani.
11-01-2008 10:21 AM
Hello,
Your code is perfect but, i think the problem is something else. test by useing a if statement that your internal table is inital or not. but i dont think it will help you more..
11-02-2008 5:48 PM
Hi,
First make sure that your driver Table is not Empty......This is a Thumb rule for For all Entries...
By the way, I would suggest you to not go for FOR ALL ENTIRES with BKPF..Unless and untill you are very sure that your driver Table is not going to have a large number of records.....In case your Table is going to get a huge no of rows.....you will be getting a Short Dump in Production.
If your Driver Table is having Large no of records, then your Workprocess may require the system resources(Memory & CPU time) more than what is fixed for any APPlication Server WorkProcess and hence you may get a Short Dump.
Bettre you go for Select ...Endselect....this may take time but will save you from the more worst condition of getting a Shortdump in production server...
11-02-2008 6:14 PM
Hi,
Do as Thomas has adviced. The records will be fetched much faster than before. I'm using the same logic in one of my program too. And of course check that it_ekbe is not empty before running the query on BKPF.
Ajay,
In one of your posts I saw this statment given by you :
Go with the Thumb rule of Performance Tunning: The number of Database Intercations should be minimal at the runtime, and use Field Symbols more and more.
What will select...endselect do then ?
regards,
Advait
Edited by: Advait Gode on Nov 2, 2008 7:17 PM