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

problem with select statement

Former Member
0 Likes
1,448

Hi,

I am using select statement on IMRG table with measuring point field in where clause. This select included in another select endselect which is a requirement and cannot be avoided.

There already exist a secondary index on this field.

Problem is when i run the program in debugging mode, the select statement works fine but it dumps with time limit error when i run it directly.

Kindly help us what could be done to overcome this issue.

Regards,

Gurmukh singh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,072

Hi,

As the select statement (IMRG) you are using in SELECT ENDSELECT, the problem might be a buffering issue and going to dump.

So in the SELECT ENDSELECT use the PACKAGE option which will read the data in packets and executes the inbetween logic.

Suppose you are getting a 10000 records at one shot using SELECT ENDSELECT, PACKAGE option,

process this 10000 records wherever used and finally clear this 10000 records.

The SELECT ENDSELECT will fetch next 10000 if exists and continues processing.

Regards,

Chitti babu

7 REPLIES 7
Read only

Former Member
0 Likes
1,073

Hi,

As the select statement (IMRG) you are using in SELECT ENDSELECT, the problem might be a buffering issue and going to dump.

So in the SELECT ENDSELECT use the PACKAGE option which will read the data in packets and executes the inbetween logic.

Suppose you are getting a 10000 records at one shot using SELECT ENDSELECT, PACKAGE option,

process this 10000 records wherever used and finally clear this 10000 records.

The SELECT ENDSELECT will fetch next 10000 if exists and continues processing.

Regards,

Chitti babu

Read only

Sathish
Product and Topic Expert
Product and Topic Expert
0 Likes
1,072

Would recommend to use

OPEN CURSOR SELECT ...

DO.

FETCH NEXT CURSOR.... PACKAGE SIZE 1000.

...

...

ENDDO.

This is better approach to avoid memory issue.

Read only

Former Member
0 Likes
1,072

Hi,

I suppose the dump is due to long execution time rather than memory issues . You should use PACKAGE size in case of memory issues rather that Long execution time. Please paste your select query so that we can have a look. Also let us know what is the total no of records in the table to get the size of table.

Thanks

Raj

Read only

Former Member
0 Likes
1,072

Hi,

due to performace reason u r program is going to short dump,try to avoide the select and endselect ,if u writing with in the loop for execution it take more time .use another select statement like select single r select up to rows .....

past u select statement ...

Regards,

Madhu

Read only

Former Member
0 Likes
1,072

Hi,

Use cursors, ur problem will be resolved. This procedure can avoid using select statements within select-endselect which is performance slow process.

Reason for dump is, you might have fetching huge data from select end select and passing it to inner select using for all entreis, due to memory overflow reason, your program might going to dump.

Please use cursors to avoid this memory problems.

OPEN CURSOR SELECT ...

DO.

FETCH NEXT CURSOR.... PACKAGE SIZE 1000.

if sy-sybrc <> 0.

exit.

endif.

...

...

ENDDO.

Read only

Former Member
0 Likes
1,072

@RAM RAM see other positing

same here:

> with time limit error when i run it directly

It is too slow.

Change in batch and you are done.

Or try to optimze it. But if it runs onyl very rarely, then batch is the simpler option.

Siegfried

Read only

SujeetMishra
Active Contributor
0 Likes
1,072

Hello Guru,

I will suggest you not to use endselect.

select and insert into table itab.

after that you can use read with binary search and loop.

Please send your code so that i can modify accordingly.

i was also getting same issues but i resolved.

Regards,

Sujeet