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

Database selection goes for a dump

Former Member
0 Likes
916

Hi,

I am using SELECT....ENDSELECT to fetch the data in Chunks. Whenever I get a chunk of data I am creating a separate task for that which calls RFC enabled Function Module.

In Simple words....

SELECT.....

CALL FUNCTION <XYZ> STARTING NEW TASK STARTNAME.

ENDSELECT....

In the first iteration, I am selecting 1000 records and it is working fine, but when the program runs for the second iteration it is giving a dump DBIF_RSQL_INVALID_CURSOR.

What could be the problem? I searched SDN and found few answers like for the second time it will not give a dump. But, I have a vague idea here. Anybody please provide me with a solution.

Thanks,

Babu Kilari

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
862

Hi Babu,

Is the FM you are calling is a custom or standard one?? If it is a custom, then try using Coll.run option and call the FM.

Coll.run option will process all the data internally, and till the complete data is processed internally, the database commit is not performed.

Hope this is useful.

Regards,

-Syed.

7 REPLIES 7
Read only

Former Member
0 Likes
863

Hi Babu,

Is the FM you are calling is a custom or standard one?? If it is a custom, then try using Coll.run option and call the FM.

Coll.run option will process all the data internally, and till the complete data is processed internally, the database commit is not performed.

Hope this is useful.

Regards,

-Syed.

Read only

0 Likes
862

Hi Wahid,

What do you mean coll.run? Can you please provide me with an example?

Thanks in advance.

Babu Kilari

Read only

0 Likes
862

Hi Babu,

When you mention Collective Run as the option under the RFC enabled FM, all the data is passed to the External Memory and when the collection is over, it will be imported to the database using the index.

For Ex:

TABLES indx. 

DATA indx_tab TYPE TABLE OF indx. 

DATA sflight_tab TYPE TABLE OF sflight. 

SELECT * FROM sflight INTO TABLE sflight_tab. 

EXPORT sflight_tab TO DATABASE indx(hk) ID 'FLIGHTS' 
       USING indx_export. 

... 

indx-srtf2 = 0. 
IMPORT sflight_tab FROM DATABASE indx(hk) ID 'FLIGHTS' 
       USING indx_import. 

... 

FORM indx_export USING foo. 
  APPEND indx TO indx_tab. 
ENDFORM. 

FORM indx_import USING foo. 
  READ TABLE indx_tab INTO indx WITH KEY srtf2 = indx-srtf2. 
  indx-srtf2 = indx-srtf2 + 1. 
ENDFORM. 

Your FM when you use with Coll.run option will run similar to this logic.

Regards,

-Syed.

Read only

0 Likes
862

It occured as I was using CALL FUNCTION and WAIT between SELECT and ENDSELECT statements.

Thank you all for helping me.

Read only

Former Member
0 Likes
862

hai babu ,

invalid cursor may be due to wrong selection from data base

ru selecting 1000 records for each iteration check if in next iteration tehre are 1000 records too

m.a

Read only

Former Member
0 Likes
862

One of the possible cause of the dupm is database commit with in the database selection.

You can not use the following statements, while selecting the data from database via using select endselect.

- MESSAGE (apart from MESSAGE S...)

- COMMIT WORK

- ROLLBACK WORK

- CALL SCREEN

- CALL DIALOG

- CALL TRANSACTION

- SUBMIT

- BREAK-POINT

- WAIT

You can collect the data needed for these statements together in an

internal table and process them

in a loop.

loop at itab.

call Function 'aba'.

endloop.

hope this will help u.

Read only

Former Member
0 Likes
862

Hi,

Remove select endselect.

write code using 'into table'

eg:

select x y z from mara into table it_mara where condition.

Thanks,

Krishna.