Skip to Content
-1

which one is better performance between loop and select query.

Mar 04, 2017 at 05:05 PM

110

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Nic Teunckens Mar 06, 2017 at 08:51 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Raymond Giuseppi
Mar 06, 2017 at 09:50 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Raghu Govindarajan Mar 06, 2017 at 01:13 PM
0

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!

Share
10 |10000 characters needed characters left characters exceeded
shashi kiran Mar 06, 2017 at 04:24 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded