‎2013 Oct 31 5:26 AM
Hello,
I am using BKPF table to fetch FI documents but it is taking so much time.
How to reduce time. Please guide me.
Here is my code:
SELECT xblnr bldat FROM bkpf
INTO TABLE it_bkpf1
FOR ALL ENTRIES IN it_bkpf
WHERE awkey = it_bkpf-awkey
belnr = it_bkpf-belnr
and gjahr = it_bkpf-gjahr.
‎2013 Oct 31 7:56 AM
Hi,
I think you can use secondary index to improve the performance
pls check out this link
http://www.saphub.com/abap-dictionary/sap-secondary-index/
Secondry Index : A key which is created other than primary key, to speed up processing.
Additional indexes can place a load on the system since they must be adjusted each time the table contents change. Each additional index therefore slows down the insertion of records in the table.
It is used frequently in select query then for improving performance related to data fetch,
Additional indexes will change the order to select the fields from the table as you specify in your select query. Plz do not create one unless it is very much required to fetch the data.
‎2013 Oct 31 5:34 AM
Hi,
sort it_bkpf by awkey belnr gjahr.
delete adjacent duplicates from it_bkpf comparing awkey belnr gjahr..
if it_bkpf[] is not initial.
SELECT xblnr bldat FROM bkpf
INTO TABLE it_bkpf1
FOR ALL ENTRIES IN it_bkpf
WHERE awkey = it_bkpf-awkey and
belnr = it_bkpf-belnr
and gjahr = it_bkpf-gjahr.
endif.
Regards
Shaik
‎2013 Oct 31 5:37 AM
Hi,
Also have a look at
http://scn.sap.com/thread/2051166
http://scn.sap.com/message/5638974
Regards
Shaik
‎2013 Oct 31 5:54 AM
Hi,
if it_bkpf[] is not initial.
SELECT xblnr bldat FROM bkpf
INTO TABLE it_bkpf1
FOR ALL ENTRIES IN it_bkpf
WHERE awkey = it_bkpf-awkey and
belnr = it_bkpf-belnr
and gjahr = it_bkpf-gjahr
%_HINTS ORACLE 'INDEX("BKPF" "ZIN")'. "u can create ZIN index
endif.
for index go to se11 table bkpf and
‎2013 Oct 31 5:59 AM
Hello,
I never used Indexes,Can u explain me the power of index?
Regards
Neeraj
‎2013 Oct 31 6:11 AM
Hi Neeraj,
Be careful with generic statements, more indexes can improve or degrade performance, less indexes as well, all depending on circumstances. Too complex to describe in a few lines, there are articles and books about these topics. Whenever I will get a chance I will try to resurrect the FAQs and sticky threads of the "old SCN" ABAP performance forum.
SAP standard often uses date fields in indexes, e.g. look at table BKPF where quick access by posting date or CPU date is required.
In any case, before introducing new indexes (which take additional DB space and time per update operation, and might make matters more complex for the CBO), always try finding additional WHERE-conditions (e.g. LEDNR = "00" for CO tables or BSTAT = space for FI document tables) or alternative access paths to the desired data using existing tables that sort the data differently, as suggested by Yuri above.
Your query must be constructed so that the CBO can make optimal use of existing primary or secondary indexes.
Regards,
Rajesh
‎2013 Oct 31 6:16 AM
Hi Rajesh,
Thanks for your suggestion.
I am thinking about projection view on bkpf.May be it can solve the problem?
Regards
Neeraj
‎2013 Oct 31 7:20 AM
You can try to add bukrs (company code) field to your where condition which makes the primary key condition complete and reduces the processing time significantly.
If it is not possible to add bukrs in where condition then try to use secondary index.
Regards,
Gautham.
‎2013 Oct 31 7:56 AM
Hi,
I think you can use secondary index to improve the performance
pls check out this link
http://www.saphub.com/abap-dictionary/sap-secondary-index/
Secondry Index : A key which is created other than primary key, to speed up processing.
Additional indexes can place a load on the system since they must be adjusted each time the table contents change. Each additional index therefore slows down the insertion of records in the table.
It is used frequently in select query then for improving performance related to data fetch,
Additional indexes will change the order to select the fields from the table as you specify in your select query. Plz do not create one unless it is very much required to fetch the data.
‎2013 Oct 31 9:49 AM