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: 

which one is better performance between loop and select query.

former_member244346
Participant
0 Kudos

Hi Experts,

I have a question for ABAPER, in my program fetching data from BKPF table based on input fields BELNR, GJAHR and XBLNR. Here XBLNR is a non primary key field, so when data volume is huge system giving dump at BKPF table select query. Anyone can help on this whether i need to create secondary index for BKPF table or I need to fetch data based on BELNR and GJAHR then in loop i will filter by xblnr.

Which one is better performance.

Thanks,

Pradeep.

4 REPLIES 4

NTeunckens
Active Contributor
0 Kudos

You should look into creating a secondary index if it is not already in place.

Check with your BASIS-team and perhaps do some tests around this ...

I see a lot of SAP-KBA's with regard to the use of (secondary) indexes on table 'BKPF' in SAP-Standard FunctionModules. So if SAP-Stdrd makes use of it, it is worth checking this out for your own Development as well.

raymond_giuseppi
Active Contributor
0 Kudos

There is an index with XBLNR but it also require BUKRS and BSTAT. Check with functional if you are able to provide those values too. Also I'm surprised you don't already use BUKRS field.

raghug
Active Contributor
0 Kudos

What am I missing here...

  • You state that you are getting back so much data with BELNR, GJAHR and XBLNR - that your program dumps on the selection - What is the dump? For volume or time?
  • Now you want to get rid of XBLNR -> You do realize that will only return more data, right? How is that going to help?

.

An ABAP loop after bringing all the data over to the application server will never be as efficient as even letting the database server work on un-indexed data. That said, as Raymond said - there is an index - figure out how to use it!

Former Member
0 Kudos

Use all the three Key fields "BUKRS", BELNR" and "GJAHR" to fetch data from BKPF.