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: 

Program takes a lot time to generate the output.

Former Member
0 Kudos

Hi all,

I have made a purchase register which takes a long time to generate the output.It exactly takes 5 min to generate the data for a single day which has only 4 records.I even  made a background run using sm37 (for 1 months but still running from 4 days) I did a runtime analysis using SAT for the day which generated 4 records and i got the time taken by the program for fetching bseg data is very high but could not find an unnecessary codes there which could be removed or changed.So kindly help me in solving this problem.

Regards

Nav

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi all,

Thanks all for your replies.I am attaching my codes.

Regards

Nav

10 REPLIES 10

Former Member
0 Kudos

Hi Nav

Are you able to supply the code of the relevant program you're running.

Is this a custom or SAP Standard program?

Regards

Arden

TanmayVerma
Active Participant
0 Kudos

Hi nav,

Since the program trace shows long running time for query on bseg i would recommend you to check somthings:

  • Do you have a where clause in the query ? Does it contains non-primary key  fields?
  • Try fetching the record with primary keys in where clause.
  • If that is not possible, have u considered the usage of secondary index ? ( though creating secondary indexes are not always recommendable )
  • Are you selecting only necessary fields or selective fields ?

It would be great if you share your code so that we may be able to help better.

~Tanmay

former_member201275
Active Contributor
0 Kudos

Good old BSEG.

As the others here already said, if you post your code it would be a help... to you.

Former Member
0 Kudos

Hi Navratan,

I too faced same problem while fetching data from MSEG( As it has huge data ) using for all entries.

When I approached FS team, they gave me an alternative( other tables ) to fetch the required data.

Ask them is there any alternative for that.Hope it will help you.

Regards,

Omkar.

Former Member
0 Kudos

Hi all,

Thanks all for your replies.I am attaching my codes.

Regards

Nav

0 Kudos

Hi Nav,

First things first. The code is lacking some basic performance improvement techniques.

  • Everywhere you have used for all entries , which is not recommended. You should use joins.
  • Lets say you move forward with for all entries. There is no NOT INITIAL check anywhere before the select having 'FOR ALL ENTRIES' which will cause all the data to be selected even if there are no data in the previous table.
  • Select statement has been used inside the loop , which should be avoided until and unless no other way is possible.

I would recommend you to take care of the above points and then again run a trace and see the pain points.

~Tanmay

0 Kudos

Hi Tanmay,

Thanks for your reply  I will do the necessary corrections as suggested by you and then let you know.

Regards

Nav

raymond_giuseppi
Active Contributor
0 Kudos

Did you notice this good old BSEG is a cluster table, so only actual fields are those of cluster table RFBLG (MANDT, BUKRS, BELNR, GJAHR) so any SELECT that don't provide those key will execute a full table scan...

Hint: Now take a look at so called index table BS[I,A][S,D,K,M] which are actual transparent tables, but this is a FAQ...


Regards,

Raymond

0 Kudos

Hi Raymond,

Thanks for your reply .I got the thing so would do some changes to it.

Regards

Nav

Former Member
0 Kudos

Hi all,

Thanks everyone for your reply.You all were very helpful  in sorting out the problem.

Regards

Nav