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

Select

Former Member
0 Likes
827

HI experts,

I am facing a problem where I have huge number of records in the database table.

So when in my program I select them using a SELECT statment into an internal table it gives me a DUMP saying time out.

Can any one tell me how should I populate my internal table with all the records in the database tables.

Such that I can fetch 1 lakh records at a time .

and append them to the internal table.

Helpful answer will be rewarded with points.

Thanks in advance.

9 REPLIES 9
Read only

Former Member
0 Likes
796

I am not sure if you are writing the statement with select........ end select. If you are using that then it is better you populate the internal table by using ........into table itab........... clause and then process the records by using loop...... endloop statements.

Message was edited by:

Jagannadh Ketavarapu

Read only

Former Member
0 Likes
796

1) declare internal table by occurs 0 clause.

2) select only relevent fields from dtabase into Internal table instead of select *..

3) do not use select and endselect loop.

4) try to use where condition on select and also try tht fields in where condition are in the same order as they appear in the database table.

e.g -

data: begin of itab occurs 0.

include structure pa0002.

data end of itab.

select field1 field2 into corresponding fields of table itab

from pa0002 where field3 = '124'

and field4 = '23'.

Read only

Former Member
0 Likes
796

if the performance is not a factor just tell your basis person to increase the time limit for that.

regards

shiba dutta

Read only

Former Member
0 Likes
796

Hi,

You can use statement select upto 100000

It will work

Regards

Sabu

Read only

0 Likes
796

Hi,

First check your select staement following key points,

1. Dont use select endselect.

2.Use desired fields not select *.

3.Use where condition to estrict data.

4.Use the table index as much as possible.

If u r still getting dump contact BASIS person.

Reward if useful.

Thanks,

Alex

Read only

Former Member
0 Likes
796

The main reasons include <b>usage of join statements and no where conditions for index fields</b> which takes a long time to execute. Please note that. Then if you could post the code it would better to find what the problem is.

Regards

Kathirvel

Read only

Former Member
0 Likes
796

Hi ,

In the select statement there is an addition called package size , which basically restricts the number of records fetched from database at a time.

this statrement is used in select - endselect format.

an e.g.is given below

data : it_1 type table of mara.
select * into table it_1  " Here it selects 100 records at a time
from mara
package size 100.

endselect.

here the select statement selects 100 records during each iteration ,so what you can do is in the select - endselect , appned the content of it_1 to another table usinf <b>append lines of</b> command ,

you can specify the package size based on your systems setting.

just debug the program and see how it runs.

do revert back in case you have any further queries

Regards

Arun

  • Reward points if reply is helpful

Read only

Former Member
0 Likes
796

Hi Rashmi,

If the table is transactional table, don't use select * without where clause. You can a way to restrict no of entries.

If the table is master table like company code, you can retrieve select * without where clause. Based on company code you can retrieve transactional data.

Regards

Bhupal Reddy

Read only

Former Member
0 Likes
796

Hi ,

Got any solution for your issue,

Regards

Arun