Hello Venky,
it is very difficult to answer directly to your question without having more informations:
When a TIME_OUT error occurs, it may have the described issues:
1) Loops over a large amount of lines or without a exit-condition
2) Inperformant database access without having proper indexes
3) Large amount of data which have to be transferred from DB to AS
What can you do?
On the database:
* You can minimize the amount of data by bringing as much as possible logic from ABAP code into the DB-select (Grouping, Joins, Subselects ... )
* Do not transfer every field if you only need a set
* Inspect you SQL and find out if the indices are correct
On the business logic:
* Loop/Reads on Sorted or hashed tables
* Try to avoid to complex structures which will lead into "spaghetti"-code with the risk of unreachable conditions
There is a good blog about this topic ( although it is about ABAP on HANA, it can be used very good for classical environments ): Performance Guidelines for ABAP Development on the SAP HANA Database
Nevertheless: Make a estimation about the amount of data and time which the logic should take. Use tracetools for clarifying where most of the time gets lost.
If nothing helps, try to run your report as background-job.
Kind regards,
Hendrik