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

PACKAGE SIZE SELECT LOOP with incorporated function call?

jensbilgrav
Explorer
0 Likes
1,690

Hi,

I am trying to minimize the amount of memory used by a report.

One of the ways of doing this is to use the PACKAGE SIZE addition to the SELECT statement.

However, as the data extracted needs to be either stored on the application server or downloaded to a PC, I also want to create the file using the option to APPEND the data extracted for each package a little at a time.

Here comes the problem: If I try to call function module GUI_DOWNLOAD inside the PACKAGE SIZE SELECT - ENDSELECT loop, I get the DBIF_RSQL_INVALID_CURSOR CX_SY_OPEN_SQL_DB exception at the beginning of the second loop.

Is there any way to avoid this?

Thanks in advance,

Jens

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,077

use the free statement for the internal tables...if the table data is sent to some other internal table then clear the memory of the internal tables which had no use at the end of the program

6 REPLIES 6
Read only

jordi_escodaruiz
Active Participant
0 Likes
1,077

Hi Jens:

You cannot call FM to write to a file inside a SELECT .. ENDSELECT Loop. This interrupts the database access.

If possible, try to reduce the amout of used memory by fetching only the required fields in your select.

Best regards

Jordi

Read only

Former Member
0 Likes
1,078

use the free statement for the internal tables...if the table data is sent to some other internal table then clear the memory of the internal tables which had no use at the end of the program

Read only

Former Member
0 Likes
1,077

It causes lot of performance. it is not advisable to use GUI_DOWNLOAD inside the select endselect.

and you are using PACKAGE SIZE.

You select them one shot and send it to GUI_DOWNLAOD.

Read only

Former Member
0 Likes
1,077

Hi,

Usually this error (DBIF_RSQL_INVALID_CURSOR ) comes if you are Select Statement is missing some fields please do have a look around with your SELECT statement.

Thanks

Sudharshan

Read only

jensbilgrav
Explorer
0 Likes
1,077

What I find strange, though, is that it does not cause any problems to create the file on the application server, appending the data extracted for each package a little at a time.

It is only when using FM GUI_DOWNLOAD.

Maybe another function module for downloading the data exists?

Read only

0 Likes
1,077

It's not that strange. While you are only using the DATASET related ABAP statements when writing a file to the application server, the function GUI_DOWNLOAD might contain statements that invalidate the database cursor, such as COMMIT WORK.

Maye you can set up an automatic transfer of the complete file from the application server to the desired destination via FTP (or similar products) as a second step.

Thomas