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

Memory Size in Select statement.

Former Member
0 Likes
825

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
Read only

Former Member
0 Likes
726

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"

Read only

Laxmana_Appana_
Active Contributor
0 Likes
726

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

Read only

Former Member
0 Likes
726

Try using pacgage size addition into your select statment.

BR, JAcek

Read only

Former Member
0 Likes
726

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

Read only

Former Member
0 Likes
726

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

Read only

Juwin
Active Contributor
0 Likes
726

Another related question from me....