Skip to Content
0
Former Member
Mar 03, 2011 at 06:02 AM

DBIF_RSQL_INVALID_CURSOR: Invalid interruption of a database selection duri

528 Views

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.