Application Development and Automation 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: 
Read only

Report Optimization

Former Member
0 Likes
1,524

Experts,

I have given list of report , that need to be optimized , my problem

is without understanding the logic of the program , If i start doing optimization

then it may change the overall behavior of the code , for example there may

be instance where loop within loop may be used , As said there may be repeated

records , hence read would have been avoided inside loop .

What is the best way to optimise code without trying to understand what code

is doing.

10 REPLIES 10
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,145

<i>What is the best way to optimise code without trying to understand what code

is doing.</i>

Well, as you may guess, you should always know what the code is doing(or supposed to be doing) before you make any modifications to it, including optimization enhancements.

REgards,

Rich Heilman

Read only

rodrigo_paisante3
Active Contributor
0 Likes
1,145

Hi,

Could you please post here your code? I will "try" to understand it..

Regards

Read only

0 Likes
1,145

safasfc

Read only

Former Member
0 Likes
1,145

I think your SELECTs are generally OK. I didn't look at them closely, but nothing jumped out at me.

One of your forms (populate_firm) has a nested loop in it. I think I would leave that until after fixing the next one:

The program does a number of



READ TABLE ZZZZZZ WITH KEY 
  F1 = Z1
  F2 = Z2...

Try sorting these tables in the key filed order and then adding BINARY SEARCH to the READ statements. This will speed the program up and you don't really have to delve into the logic.


SORT ZZZZZZ by F1 F2.
READ TABLE ZZZZZZ WITH KEY 
  F1 = Z1
  F2 = Z2...
  BINARY SEARCH.

Rob

Read only

rodrigo_paisante3
Active Contributor
0 Likes
1,145

Hi sanju,

Rob said what you need to do.

Dont worry about long programs. You realy dont need to know exacty logic of the program, but you know what do you have to do: to optimize.

Try to execute the program in bug mode, or with break points, and verify parts of your program. You need to know where the program's performance is not good.

i have the same problem here, a report with poor performance but i dont know how to optimize because all technics were used and the performance is bad.

I expect you solve this problem,

regards

RP

Read only

KjetilKilhavn
Active Contributor
0 Likes
1,145

I can't really help with optimizing the code in such cases, but I can offer an alternative suggestion: Buy a more powerful computer.

After all, if time is too costly to spend it on understanding the purpose of the code, hardware is probably cheap in comparison.


Kjetil Kilhavn (Vettug AS) - ABAP developer since Feb 2000, but will probably never be a Rockstar developer
Read only

0 Likes
1,145

Well, I'm not so sure about that. If I went to management and told them that I couldn't understand some code and asked them to by new hardware instead, I think the money they would use to buy it would come from the money they save by not paying me any more.

Rob

Read only

0 Likes
1,145

Well, since the customer's (or company's) needs are the highest priority that isn't a problem, is it?

Anyway, I was thinking more along the lines of the management not wanting people to spend time figuring out the code, not people not being able to understand it.

But your answer was a good one anyway. Shows that there's always another angle from which things can be viewed. Have a good weekend


Kjetil Kilhavn (Vettug AS) - ABAP developer since Feb 2000, but will probably never be a Rockstar developer
Read only

Former Member
0 Likes
1,145

Hi,

Usually performance improvement takes places at 2 levels:

1) 'Quick Wins' , this is where you use SE30/ST05 to find the obvious problems and correct. Sometimes with badly written programs you can quickly ( less than a day) get some major improvements without knowing much, if anything, about what the program does.

2) 'Rewrites', this where you do need to understand what the program is supposed to do and look to see if there are any better alternatives. I've lost count of the number of programs involving reading BSEG that I've seen that need redesign.

Read only

Former Member
0 Likes
1,145

Hi Sanju,

<b>I have actually worked on similiar case where performance optimization had to be done without going into the logic of report. So what I did for that was:</b>

used proper sorts on all the internal tables.

read table itab has to be done with binary search.

try to fetch data at once from DB .

try to work on internal tables as much as possible.

removed unnecessary looping on internal tables.

selecting the fields from DB table have to be in proper sequence. means ,,if in Db table matnr is before werks , then write select as

select matnr werks from...

and same case with conditions also

select * from DB table

where matnr = ''

and werks = '' .

Hope it helps.

reward points if useful

BR

Harmeet Singh.