‎2011 Apr 01 6:33 PM
Hi,
I am using FETCH CURSOR statement to fetch the data from a database table with package size. For the fetched records I am doing parallel processing using parallel processing frame work in banking system.
Here the problem is for the first iteration it works fine but when it comes to FETCH NEXT CURSOR in the second iteration , programs gets dumping by saying that 'CURSOR already closed'.
I am not closing the cursor in the program but some how it got closed some where in the standard function module which I used for parallel processing.
I used WITHHOLD also along with FETCH CURSOR but no use. Please let me know how to avoid the cursor to get close.
Below is my code
IF NOT l_tab_product IS INITIAL.
OPEN CURSOR WITH HOLD lv_cursor FOR
SELECT contract_int prodint cn_currency mig_grp
INTO TABLE gt_cont
FROM bca_contract
FOR ALL ENTRIES IN l_tab_product
WHERE prodint = l_tab_product-prodint
AND mig_grp IN s_migrp.
DO.
FETCH NEXT CURSOR lv_cursor
INTO TABLE gt_cont
PACKAGE SIZE lv_size.
IF sy-subrc <> 0.
CLOSE CURSOR lv_cursor.
EXIT.
ELSE.
*
*
*
parallel processing logic
*
*
ENDDO.
ENDIF.
‎2011 Apr 02 7:30 AM
Using Withhold will not make sure that the cursor will not get closed because of commits.
SAP Doc says
If the addition WITH HOLD is specified, the database cursor is not closed by a database commit executed using Native SQL. The addition does not have an influence, however, on implicit database commits or on any rollbacks which always close the database cursor.
You have to check the part written in your parallel processing logic.
As Brad said please donot dump your old threads like this.
‎2011 Apr 01 6:52 PM
You are closing the CURSOR.
IF sy-subrc 0.
CLOSE CURSOR lv_cursor.
‎2011 Apr 01 6:59 PM
Sorry that is typo.
I am not closing it.
If sy-subrc NE 0
CLOSE CURSOR lv_cursor.
EXIT.
I have used above code
‎2011 Apr 01 8:04 PM
Please stop flooding our forum with all of your posts. You don't need to put useless comments in 3 year old posts when you close them. Is this some sort of April Fool's activity?
‎2011 Apr 02 7:30 AM
Using Withhold will not make sure that the cursor will not get closed because of commits.
SAP Doc says
If the addition WITH HOLD is specified, the database cursor is not closed by a database commit executed using Native SQL. The addition does not have an influence, however, on implicit database commits or on any rollbacks which always close the database cursor.
You have to check the part written in your parallel processing logic.
As Brad said please donot dump your old threads like this.
‎2011 Apr 02 8:27 PM
What Brad said. This gives me a chance though to delete some of these threads altogether.
In the future, please leave the comment box emtpy when closing old threads, unless you want to reveal your own breakthrough solution to the initial problem.
Thomas