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

Program execution taking a long time

Former Member
0 Likes
3,324

Hi Experts

We have a program which has a loop inside which; in order to optimize the performance,

we have used read statements with Binary Search after sorting the internal tables.

The code inside the loop contains multiple read statements (as mentioned) followed by one BDC and one Update statement.

When we executed the program by scheduling it in background it took 33000 seconds to execute; which is around 9 hours which is not acceptable.

Mentioned herewith are the findings which might help you to analyze and propose the solution.

1) Records in scope for the program to process : 45000

2) We have also noticed that the time taken for processing a fixed number of records increases gradually with the passage of time.

for example:

the 1st 100 records executed in 25secs

next 100 records executed in 75secs

the next 100 in 100 secs and ....... the gradual increase continues.

Just for your information sake: there are no select queries inside the loop ... endloop.

Kindly provide a solution.

Thanks and Regards

Avishek

10 REPLIES 10
Read only

HermannGahm
Product and Topic Expert
Product and Topic Expert
0 Likes
2,059

Hi,

have you traced the program (SE30, ST12) in order to see where the time is spent?

Once you found the time consumers you can think about (or ask for help) how to optimize...

Kind regards,

Hermann

Read only

Former Member
0 Likes
2,059

can't wait to see some code!

Read only

Former Member
0 Likes
2,059

Avishek,

check this thread

Thanks

Bala Duvvuri

Read only

samantak_chatterjee
Active Contributor
0 Likes
2,059

Hi Avishek,

Is there any other of optimizing the code by way of local table buffering, using field symbols, etc. The above mentioned things are a part of the general coding guidelines and will help to optimize the code performance.

Hope this helps.

Thanks,

Samantak.

Read only

Former Member
0 Likes
2,059

Hi Avishek,

Increasing time, it's a strange behavior here on your description.

Questions:

1) This BDC is standard?

2) Are you refreshing BDC before set it again?

3) This UPDATE have index support or it always run a sequencial access on databases?

4) You need execute this sequencially or you can take advantage of app servers running in parallel?

Regards, Fernando Da Ró

Read only

0 Likes
2,059

Hi Avishek,

I agree with Fernando. You may try using a Function Module for BDC and Update, which will get called in parallel procress.

You can call the function Module for a set of 100 - 500 records.

Thanks,

Preyansh

Read only

Former Member
0 Likes
2,059

please show the code, change name if you don't want to show internals.

Read only

Former Member
0 Likes
2,059

can we using cursor?

Read only

former_member193284
Active Participant
0 Likes
2,059

Hello,

I would suggest to perform following steps to optimize your code.

Please run SE30 runtime analysis and figure out if ABAP/Database/System is taking time

Also run Code inspector & Extended program check to remove all warnings errors

Then run ST05 and figure out if any select query is taking time. In this case use secondary index if required.

If you have select query's in your program avoid correponding clause and ensure you select fields in the order they are defined in the database tables... you internal table structure should match the sequence.

try and use for all entries if required.

restrict your database selects by ensuring you dont select unwanted records while data fetching.

Regarding ABAP code.

Use binary search..

clear your work areas and internal tables

try and use field symbols if your modyfing internal tables

if possible your views

Hope this helps you

Have a nice day

Thanks

Sumit

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
2,059

If you have standard BAPI's available then avoid BDC and go for that, you can see the difference in the execution time.

@-Aniesh - Cursors never improve the execution time !!! .

the 1st 100 records executed in 25secs

next 100 records executed in 75secs

the next 100 in 100 secs and

You have told that you are using read statement inside the loop, that too it triggers multiple times.

have you checked how many times it gets triggered for the above three steps ?

And donot expect a mass upload program to get finished within a short time