2009 Sep 11 10:44 AM
hi,
i am getting dump in my below code in the delete statement line.actually previously it worked fine but now suddenly we r getting dump in the second delete statement below.can some body tell me the reason.
error analysis: You attempted to change, delete or create a line in the
internal table "\PROG=YBDISEMAT\DATA=INT_MARC", but no valid cursor exists
for the table.
Possible reasons:
1. The relevant ABAP/4 statement does not include the addition
"...INDEX...", although the statement is not
inside a "LOOP...ENDLOOP" loop processing this table.
2. The relevant ABAP/4 statement was called from within a
"LOOP...ENDLOOP" loop after a DELETE "\PROG=YBDISEMAT\DATA=INT_MARC".
LOOP AT int_marc INTO wa_marc.
IF wa_marc-werks IN ra_source.
READ TABLE int_disgr WITH KEY zdisgr = wa_marc-disgr
zwerks = wa_marc-werks.
IF sy-subrc NE 0.
DELETE int_marc.
ENDIF.
ENDIF.
IF wa_marc-werks IN ra_zmdc.
READ TABLE int_disgr WITH KEY zdisgr = wa_marc-disgr
zwerks = wa_marc-werks.
IF sy-subrc NE 0.
DELETE int_marc. _______________________________________________ getting dump here
ENDIF.
ENDIF.
CLEAR wa_marc.
ENDLOOP.
2009 Sep 11 11:08 AM
you are trying to delete a record from the internal table INT_MARC using the statement "DELETE INT_MARC".
For using this statement you should have the record to be deleted in the header line of ITN_MARC,But had looped the Internal table to the workarea WA_MARC ,so you dont have that record in the Header Line of INT_MARC ,insted you have it in "WA_MARC".
so you have to delete the record from internal table INT_MARC which is there in WA_MARC when your if condition is getting satisfied.
hi,
i am getting dump in my below code in the delete statement line.actually previously it worked fine but now suddenly we r getting dump in the second delete statement below.can some body tell me the reason.
error analysis: You attempted to change, delete or create a line in the
internal table "\PROG=YBDISEMAT\DATA=INT_MARC", but no valid cursor exists
for the table.
Possible reasons:
1. The relevant ABAP/4 statement does not include the addition
"...INDEX...", although the statement is not
inside a "LOOP...ENDLOOP" loop processing this table.
2. The relevant ABAP/4 statement was called from within a
"LOOP...ENDLOOP" loop after a DELETE "\PROG=YBDISEMAT\DATA=INT_MARC".
LOOP AT int_marc INTO wa_marc.
IF wa_marc-werks IN ra_source.
READ TABLE int_disgr WITH KEY zdisgr = wa_marc-disgr
zwerks = wa_marc-werks.
IF sy-subrc NE 0.
DELETE int_marc.
ENDIF.
ENDIF.
IF wa_marc-werks IN ra_zmdc.
READ TABLE int_disgr WITH KEY zdisgr = wa_marc-disgr
zwerks = wa_marc-werks.
IF sy-subrc NE 0.
DELETE int_marc. _______________________________________________ getting dump here
ENDIF.
ENDIF.
CLEAR wa_marc.
ENDLOOP.
2009 Sep 11 10:47 AM
Hi,
Use the index specification with delete statement.
DELETE <itab> INDEX <idx>.
hence write the below code:
DELETE int_marc index sy-tabix.
Hope this helps
Regards
Shiva
Edited by: Shiva Kumar Tirumalasetty on Sep 11, 2009 3:17 PM
2009 Sep 11 10:48 AM
Hi,
The error analysis gives you the answer.
"You attempted to change, delete or create a line in the
internal table "\PROG=YBDISEMAT\DATA=INT_MARC", but no valid cursor exists
for the table."
It means that the program cannot determine which entry should be deleted from the table INT_MARC.
Have a look at the F1 help of the statement DELETE for correcting your program.
BR,
Advait
2009 Sep 11 10:50 AM
Hi.
First of all deleting an internal table inside the loop is not a good practise ..You are deleting the same internal table that you are looping..
Instead of that you can make a small modification to your code.
LOOP AT int_marc INTO wa_marc.
IF wa_marc-werks IN ra_source.
READ TABLE int_disgr WITH KEY zdisgr = wa_marc-disgr
zwerks = wa_marc-werks.
IF sy-subrc NE 0.
move 'X' to any field in the internal table.
or you can have an additinal field in the end of the internal table like flag type char01.
and move 'X' to wa_marc-flag.
ENDIF.
ENDIF.
Now outside the loop you can delete
delete int_marc where flag = 'X'.
Regards
Ansari
2009 Sep 11 10:51 AM
Hi,
Try like below:
LOOP AT int_marc INTO wa_marc.
IF wa_marc-werks IN ra_source.
READ TABLE int_disgr WITH KEY zdisgr = wa_marc-disgr
zwerks = wa_marc-werks.
IF sy-subrc NE 0.
DELETE int_marc.
continue. <add
ENDIF.
ENDIF.
IF wa_marc-werks IN ra_zmdc.
READ TABLE int_disgr WITH KEY zdisgr = wa_marc-disgr
zwerks = wa_marc-werks.
IF sy-subrc NE 0.
DELETE int_marc.
continue. <<<<<Add
ENDIF.
ENDIF.
CLEAR wa_marc.
ENDLOOP.
Dump is coming because the program is trying to delete an entrry that has already been deleted.
Regards,
Himanshu
2009 Sep 11 11:08 AM
you are trying to delete a record from the internal table INT_MARC using the statement "DELETE INT_MARC".
For using this statement you should have the record to be deleted in the header line of ITN_MARC,But had looped the Internal table to the workarea WA_MARC ,so you dont have that record in the Header Line of INT_MARC ,insted you have it in "WA_MARC".
so you have to delete the record from internal table INT_MARC which is there in WA_MARC when your if condition is getting satisfied.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |