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: 

memory problems in internal table

Former Member
0 Kudos

Hi,

I am facing an issue with the internal table memory.

I am selecting something from the database and putting it in internal table but the load is so much that it is giving me memory errors as the data may go into millions.

So what we have decided is to cut down the data in the internal table. we have defined a variable which will contain suppose 30000 data.

so what i mean to do is to take the records from the databas based on the value in the variable. By that way i will be taking only 30000 data each time.

But the issue is that first time it will take 1 to 30000 records if i give upto 30000 rows in the select query.. but then how will i take 30001 to 60000 the next time.. by that i mean how will i keep incrementing in the select query.

Thanks in advance.

Amit Kurup

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You can use <b>PACKAGE SIZE</b> in the SELECT statement to define the number of records to read.

See http://www.sap-img.com/abap/package-size.htm

Regards,

Wenceslaus.

7 REPLIES 7

abdul_hakim
Active Contributor
0 Kudos

hi

basically internal tables are dynamic tables and there is no size limit for it with the exception that the size will be set by ur BASIS while installing.So you define an internal table and pass data into it in one shot like below.

DATA ITAB LIKE TABLE OF KNA1.

SELECT * FROM KNA1 INTO TABLE ITAB.

If you are still not clear then paste ur code in this thread..

Cheers,

Abdul Hakim

Former Member
0 Kudos

You can use <b>PACKAGE SIZE</b> in the SELECT statement to define the number of records to read.

See http://www.sap-img.com/abap/package-size.htm

Regards,

Wenceslaus.

0 Kudos

Yeah, I agree absolutely with Wencelaus: If the data amount goes into the millions, package size is <i>the</i> thing you want to use.

Using db cursors isn't recommended anymore and also very slow. (They were pretty much used in the DataArchiving program that handle huge amount of data).

Best wishes,

Florin

Former Member
0 Kudos

Arshad,

Given that its huge amount of data, you might want to consider using FIELD GROUPS instead of internal tables.

They are exactly like INTERNAL TABLES, but can handle huge amount of data.

regards,

Ravi

Note : Please mark the helpful answers

Former Member
0 Kudos

try out by giving OCCURS 10000 in the definition of internal table..

i mean: DATA : IT_MARA LIKE MARA OCCURS 10000 WITH HEADER LINE.

check this out..

Srikanth

Former Member
0 Kudos

Hi

I've never used these stataments but perhaps they are usefull for you:

See the help for OPEN/CLOSE/FETCH CURSOR

DATA: C TYPE CURSOR,

WA TYPE <TABLE>.

DATA: ITAB LIKE STANDARD TABLE OF <TABLE>.

OPEN CURSOR C FOR

SELECT * FROM <TABLE> WHERE .......

DO.

FETCH NEXT CURSOR C TO WA.

IF SY-SUBRC <> 0.

CLOSE CURSOR C.

EXIT.

ENDIF.

APPEND WA TO ITAB.

IF COUNT = 30000.

      • DO SOMETHING

COUNT = 0.

REFRESH ITAB.

ENDIF.

COUNT = COUNT + 1.

ENDDO.

Max

Former Member
0 Kudos

Instead of using 'into itab'.. go for 'select.. endselect' by using 'package size' option..

Check out the below link for further info..

http://www.sap-img.com/abap/package-size.htm