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

Dump in Fetch Cursor Issue

Former Member
0 Likes
1,529

Hi,

I am trying to create a Data source at R/3 Side through will standard BI extractor will put the required data from R/3 table.

I have created a FM.

Specific for BI extractor , i have written code like shown below

I am getting a Dump when i execute this FM through RSA3


DATA: l_s_select TYPE srsc_s_select.

  STATICS: s_s_if TYPE srsc_s_if_simple,

                s_counter_datapakid LIKE sy-tabix,

      OPEN CURSOR WITH HOLD s_cursor FOR

        SELECT ktopl
               ktosl
               konts
         FROM  t030
         WHERE ktopl = 'OC01'
         AND   ktosl = 'WRX' OR ktosl = 'FR1' OR ktosl = 'FR2' OR
               ktosl = 'FR3' OR ktosl = 'FR4' OR ktosl = 'KON' OR
               ktosl = 'WRY'.
                            

    FETCH NEXT CURSOR s_cursor
               APPENDING CORRESPONDING FIELDS
               OF TABLE it_t030
               PACKAGE SIZE s_s_if-maxsize.

          s_cursor TYPE cursor.

     IF sy-subrc <> 0.
      CLOSE CURSOR s_cursor.
      RAISE no_more_data.
    ENDIF.

After CLOSE CURSOR statement only i have written my other select query and futher processing.

Acutally i dont understand why i need to write a select query on t030 after OPEN cursor?

it_t030 is not my final table which i am passing to the TABLES parameter.

it is e_t_data of type some Z custom structure which i want.

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught

in

procedure "Z_FM_AP_OPEN_ACCURALS" "(FUNCTION)", nor was it propagated by a

RAISING clause.

Since the caller of the procedure could not have anticipated that the

exception would occur, the current program is terminated.

The reason for the exception is:

The cursor used in a FETCH or CLOSE CURSOR command is

not open. It was either not yet open or has already

been closed. You can close the cursor explicitly with

the CLOSE CURSOR command

Edited by: mayank verdia on Jan 14, 2010 11:45 PM

Edited by: mayank verdia on Jan 14, 2010 11:46 PM

Hi,

I am trying to create a Data source at R/3 Side through will standard BI extractor will put the required data from R/3 table.

I have created a FM.

Specific for BI extractor , i have written code like shown below

I am getting a Dump when i execute this FM through RSA3


DATA: l_s_select TYPE srsc_s_select.

  STATICS: s_s_if TYPE srsc_s_if_simple,

                s_counter_datapakid LIKE sy-tabix,

      OPEN CURSOR WITH HOLD s_cursor FOR

        SELECT ktopl
               ktosl
               konts
         FROM  t030
         WHERE ktopl = 'OC01'
         AND   ktosl = 'WRX' OR ktosl = 'FR1' OR ktosl = 'FR2' OR
               ktosl = 'FR3' OR ktosl = 'FR4' OR ktosl = 'KON' OR
               ktosl = 'WRY'.
                            

    FETCH NEXT CURSOR s_cursor
               APPENDING CORRESPONDING FIELDS
               OF TABLE it_t030
               PACKAGE SIZE s_s_if-maxsize.

          s_cursor TYPE cursor.

     IF sy-subrc <> 0.
      CLOSE CURSOR s_cursor.
      RAISE no_more_data.
    ENDIF.

After CLOSE CURSOR statement only i have written my other select query and futher processing.

Acutally i dont understand why i need to write a select query on t030 after OPEN cursor?

it_t030 is not my final table which i am passing to the TABLES parameter.

it is e_t_data of type some Z custom structure which i want.

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught

in

procedure "Z_FM_AP_OPEN_ACCURALS" "(FUNCTION)", nor was it propagated by a

RAISING clause.

Since the caller of the procedure could not have anticipated that the

exception would occur, the current program is terminated.

The reason for the exception is:

The cursor used in a FETCH or CLOSE CURSOR command is

not open. It was either not yet open or has already

been closed. You can close the cursor explicitly with

the CLOSE CURSOR command

Edited by: mayank verdia on Jan 14, 2010 11:45 PM

Edited by: mayank verdia on Jan 14, 2010 11:46 PM

2 REPLIES 2
Read only

Former Member
0 Likes
745

I sloved it myself.

Read only

0 Likes
745

So, Can you describe how did you solve it? I am getting the similar issue.