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: 

How to optimize FETCH NEXT CURSOR

oueslati_anis
Participant
0 Kudos

Hi All;  

  I am in charge of optimizing an ABAP Code. After debugging the program I found that the most CPU consuming operation is :

FETCH NEXT CURSOR s_cursor

                   INTO CORRESPONDING FIELDS OF TABLE t_table

                   PACKAGE SIZE s_s_if-maxsize.

How Can I reduce the execution time of this code to get a better performance of the ABAP program.

Regards

Anis

5 REPLIES 5

matt
Active Contributor
0 Kudos

I can see immediately this is a BI/BW extractor. (or similar).

You have to find the OPEN CURSOR that defines the selection, and optimise that. On the BI/BW end, you may be able to get better performance by tweaking the package side.

0 Kudos

Hello Matthew

In fact you are coorect this is a BI/BW Extractor. The problem is that when we use a package size of 50000 ( standard SAP ) the extractor crashes with out of memory issue. I would like to optimze it in order to get it working with 50000 as a package size. When debugging I saw that this fetch is taking a long time to be executed, could it not be the root cause of this issue ???

Thanks in advance.

Regards

Anis

Clemenss
Active Contributor
0 Kudos

Hi Anis,

the package size probably is the root cause of the out of memory crash.

The root cause for bad performance lies in the open cursor statement, probably WHERE clause not using appropriate index.

As most SAP objects, BW extractors were never built and/or tested in real mass data environments.

For improvement, check definition of  t_table. It may have far more field than necessary. Also check if use of any table index or even adding an index to the table in question may help.

Regards, Clemens

matt
Active Contributor
0 Kudos

As I said.

You have to find the OPEN CURSOR that defines the selection, and optimise that.


But in your first post you said it was a high cpu problem. Now you're saying it's an out of memory problem. Which is it?


Also, is this a standard extractor or a custom (generic) one?

Former Member
0 Kudos

Please post the WHERE clause.

Rob