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 Size in Select statement.

Former Member
0 Kudos

Hi,

We have a problem in executing the program. The code fetches millions of records for processing, due to this , the Dump occured. Any way to fine tune the Code to split the file and process the contents of it.

The Code :

select * from zglob_avail into table gt_zglob_avail.

lv_count = sy-dbcnt.

loop at gt_zglob_avail.

if gt_zglob_avail-offer_package is not initial and

gt_zglob_avail-good is not initial.

.

.

.

. endif.

endloop.

The Dump :

Roll..................... 16128

EM....................... 595179824

MM Used.................. 572595736

MM Free.................. 14183512

Regards,

Syed Ajaz

6 REPLIES 6

Former Member
0 Kudos

Depending on your needs:

1) Add a WHERE clause to reduce the recordset and process in "chunks"

2) Add an UP TO x ROWS to reduce the recordset and process in "chunks"

laxmanakumar_appana
Active Contributor
0 Kudos

Hi,

Use field groups instead of internal tables.

Ex:

FIELD-GROUPS:x_database.

INSERT: x_fld1

x_fld2

x_fld3

INTO x_database.

move 1 to x_fld1.

move 2 to x_fld2.

move 3 to x_fld3.

EXTRACT x_database.

Regards

Appana

Former Member
0 Kudos

Try using pacgage size addition into your select statment.

BR, JAcek

former_member223537
Active Contributor
0 Kudos

Hi,

1.

Instead of using SELECT * , specify only the fields which are required.

eg. SELECT MATNR

MAKTX

from makt

where.....

2. In the WHERE clause specify the condition OFF_PACKAGE Not initial and good not initial.

3. This would avoid the If condition inside the loop.

Best regards,

Prashant

Former Member
0 Kudos

Hi,

use open cursor ,fetch with packet size logic

OPEN CURSOR WITH HOLD GV_DB_CURSOR FOR

SELECT * FROM ZCOX

WHERE BUKRS IN S_BUKRS

AND BUDAT IN S_BUDAT.

DO.

FETCH NEXT CURSOR GV_DB_CURSOR

INTO TABLE IT_ZCOXPRIHST

PACKAGE SIZE GC_SIZE. "Packet size 10000

IF SY-SUBRC NE 0.

CLOSE CURSOR GV_DB_CURSOR.

EXIT.

ENDIF.

Regards,

Amole

Juwin
Active Contributor
0 Kudos

Another related question from me....