2012 Sep 25 9:24 AM
Hello,
I do have a problem in a report that updates two tables.
The program throws a DBIF_RSQL_INVALID_CURSOR Exception in an select statement with package size.
I assume it is because I perform a SQL modify statement to the selected table within the select endselect loop. Rows are only updated but not inserted.
Unfortunately I do not know a better approach that may not need the select endselect statement or do perform an update which is allowed there.
The tables do have a lot of entries.
Therefore I do have the following approach for updating.
1. Select a package of rows from table A.
2. Select matching rows to the package in table B.
3. Do the update of B by performing a modify statement.
4. Do the update of table A in second modfiy statement.
5. goto 1 and perform the next package
Here is the code for it. Do you have a better idea ? Best regards Michael
SELECT * FROM /rb04/yl7_aiidl INTO TABLE gt_aiidl
PACKAGE SIZE p_bsize
* WHERE xupdatedone ne 'X'
.
SELECT * FROM /ain/kbndet INTO TABLE gt_kbndet
FOR ALL ENTRIES IN gt_aiidl
WHERE det_intid = gt_aiidl-det_intid.
LOOP AT gt_kbndet ASSIGNING <fs_kbndet>.
READ TABLE gt_aiidl ASSIGNING <fs_aiidl> WITH KEY det_intid = <fs_kbndet>-det_intid.
IF sy-subrc = 0.
<fs_kbndet>-/rb04/conf_log = <fs_aiidl>-conf_log_new.
<fs_kbndet>-/rb04/det_log = <fs_aiidl>-det_log_new.
<fs_aiidl>-xupdatedone = 'X'.
ENDIF.
ENDLOOP.
DESCRIBE TABLE gt_kbndet LINES gv_anz.
gv_anz_total = gv_anz_total + gv_anz.
CLEAR gv_anz.
MODIFY /ain/kbndet FROM TABLE gt_kbndet.
MODIFY /rb04/yl7_aiidl FROM TABLE gt_aiidl.
IF p_test IS INITIAL.
COMMIT WORK.
ENDIF.
ENDSELECT.
2012 Sep 26 11:31 AM
The issue is bcoz of the commit work inside the select/endselect statement. Please check the error analysis in ST22.
Hello,
I do have a problem in a report that updates two tables.
The program throws a DBIF_RSQL_INVALID_CURSOR Exception in an select statement with package size.
I assume it is because I perform a SQL modify statement to the selected table within the select endselect loop. Rows are only updated but not inserted.
Unfortunately I do not know a better approach that may not need the select endselect statement or do perform an update which is allowed there.
The tables do have a lot of entries.
Therefore I do have the following approach for updating.
1. Select a package of rows from table A.
2. Select matching rows to the package in table B.
3. Do the update of B by performing a modify statement.
4. Do the update of table A in second modfiy statement.
5. goto 1 and perform the next package
Here is the code for it. Do you have a better idea ? Best regards Michael
SELECT * FROM /rb04/yl7_aiidl INTO TABLE gt_aiidl
PACKAGE SIZE p_bsize
* WHERE xupdatedone ne 'X'
.
SELECT * FROM /ain/kbndet INTO TABLE gt_kbndet
FOR ALL ENTRIES IN gt_aiidl
WHERE det_intid = gt_aiidl-det_intid.
LOOP AT gt_kbndet ASSIGNING <fs_kbndet>.
READ TABLE gt_aiidl ASSIGNING <fs_aiidl> WITH KEY det_intid = <fs_kbndet>-det_intid.
IF sy-subrc = 0.
<fs_kbndet>-/rb04/conf_log = <fs_aiidl>-conf_log_new.
<fs_kbndet>-/rb04/det_log = <fs_aiidl>-det_log_new.
<fs_aiidl>-xupdatedone = 'X'.
ENDIF.
ENDLOOP.
DESCRIBE TABLE gt_kbndet LINES gv_anz.
gv_anz_total = gv_anz_total + gv_anz.
CLEAR gv_anz.
MODIFY /ain/kbndet FROM TABLE gt_kbndet.
MODIFY /rb04/yl7_aiidl FROM TABLE gt_aiidl.
IF p_test IS INITIAL.
COMMIT WORK.
ENDIF.
ENDSELECT.
2012 Sep 26 11:31 AM
The issue is bcoz of the commit work inside the select/endselect statement. Please check the error analysis in ST22.
2012 Sep 26 12:15 PM
Thank you very much for your helpflul answer. This solves the problem of the dump.
Do you have an idea how to program this, when I want to do some commits during processing,
Best regards
Michael
2012 Sep 26 12:17 PM
Yes, no database commit or rollback, is allowed in a SELECT/ENDSELECT block, triggered by COMMIT-WORK, call of function module DB_COMMIT or any other implicit event.
(Read SELECT online documentation)
Regards,
Raymond
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |