Application Development 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: 

DBIF_RSQL_INVALID_CURSOR: Invalid interruption of a database selection duri

Former Member
0 Kudos

Hi,

My requirement is creating variants to the standard prog through z program. For this m using open cursor statemnts for fetching the data form the database table.

OPEN CURSOR WITH HOLD l_cursor FOR
     SELECT DISTINCT docnum FROM edidc
      WHERE mestyp  = gv_mestyp
      AND status  = '64'
  ORDER BY docnum.

  DO.
    FETCH NEXT CURSOR l_cursor INTO TABLE
                               lt_docnum PACKAGE SIZE
                               p_split.
    IF sy-subrc NE 0.
      EXIT.
    ENDIF.

    READ TABLE lt_docnum INDEX 1 INTO ls_docnum.
    gs_rsparams-low = ls_docnum.
    DESCRIBE TABLE lt_docnum LINES l_lines.
    READ TABLE lt_docnum INDEX l_lines INTO ls_docnum.
    gs_rsparams-high = ls_docnum.
    INSERT gs_rsparams INTO gt_rsparams INDEX 1.
*    APPEND gs_rsparams TO gt_rsparams." INDEX 1

    ADD 1 TO gv_var_cnt.
    gv_varian = p_varian.
    CONCATENATE gv_varian gv_var_cnt INTO gv_varian.
    CALL FUNCTION 'RS_VARIANT_DELETE'
      EXPORTING
        report               = p_report
        variant              = gv_varian
        flag_confirmscreen   = 'N'
        flag_delallclient    = 'N'
      EXCEPTIONS
        not_authorized       = 1
        not_executed         = 2
        no_report            = 3
        report_not_existent  = 4
        report_not_supplied  = 5
        variant_locked       = 6
        variant_not_existent = 7
        no_corr_insert       = 8
        variant_protected    = 9
        OTHERS               = 10.
    IF sy-subrc <> 0.
*   ignore
    ENDIF.

    gs_varid-variant = gv_varian.
    gs_varit-variant = gv_varian.
    REFRESH gt_varit.
    APPEND gs_varit TO gt_varit.

    CALL FUNCTION 'RS_CREATE_VARIANT'
      EXPORTING
        curr_report               = p_report
        curr_variant              = gv_varian
        vari_desc                 = gs_varid
      TABLES
        vari_contents             = gt_rsparams
        vari_text                 = gt_varit
      EXCEPTIONS
        illegal_report_or_variant = 1
        illegal_variantname       = 2
        not_authorized            = 3
        not_executed              = 4
        report_not_existent       = 5
        report_not_supplied       = 6
        variant_exists            = 7
        variant_locked            = 8
        OTHERS                    = 9.
    IF sy-subrc <> 0.
*   ignore
    ENDIF.
  ENDDO.

CLOSE CURSOR l_cursor.

i have set the brkpt at fetch statement and tried debugging for the first do loop its executing fine and variat is getting created but for the second record prog is going into dump DBIF_RSQL_INVALID_CURSOR: Invalid interruption of a database selection M sturck up at this point.

I have searched the forum for this error but didn't get the answer.

can aynone suggest me with the answer and wat the cause for this error. Or suggest me the other best method instead of using the open and fetch cursor methods.

6 REPLIES 6

SuhaSaha
Advisor
Advisor
0 Kudos

Hello,

Looks like the DB cursor you had opened using OPEN CURSOR got closed.

Although i can see the usage of WITH HOLD addition but it can prevent the cursor to be closed in case of "explicit" DB commit or rollback. I suppose there was an implicit DB LUW termination which led to this situation.

Anyway are you using old or new debugger? Try using new debugger & see if the error persists.

BR,

Suhas

former_member195402
Active Contributor
0 Kudos

Hi,

keyword docu says:

An open database cursor can be closed using the statement CLOSE CURSOR. In addition, an open database cursor is closed for a database commit or a database rollback.

I think, one of the fm's will do a db commit.

Regards,

Klaus

0 Kudos

Hi,

I have tried even commenting all the fn modules after fetch but still its going to dump and m using the new debugger

or any other way to fetch the records in packet size ....

0 Kudos

Does it still dump if you comment the fm's and use no debugger? You can use a write or something to see what you got!

soumya_jose3
Active Contributor
0 Kudos

Hi Ramya,

If you remove the break-point, it might not dump.

Regards,

Soumya.

0 Kudos

calling functions inside select...endselect might lead to dumps as fm's maybe does a commit work.

also declaring cursor with hole will loose the cursor, only in the case a native sql-commit IS DONE!!! exec sql. commit work. end-exec.

you should read you date into an internal table, then create/delete your variants inside LOOP...ENDLOOP

regards oliver