‎2009 Jun 03 6:05 AM
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
‎2009 Jun 03 6:13 AM
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.
‎2009 Jun 03 6:13 AM
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.
‎2009 Jun 03 6:24 AM
Hi Wahid,
What do you mean coll.run? Can you please provide me with an example?
Thanks in advance.
Babu Kilari
‎2009 Jun 03 6:36 AM
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.
‎2009 Jun 05 3:55 PM
It occured as I was using CALL FUNCTION and WAIT between SELECT and ENDSELECT statements.
Thank you all for helping me.
‎2009 Jun 03 6:15 AM
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
‎2009 Jun 03 6:24 AM
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.
‎2009 Jun 03 6:27 AM
Hi,
Remove select endselect.
write code using 'into table'
eg:
select x y z from mara into table it_mara where condition.
Thanks,
Krishna.