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

message overwrite table within a LOOP

Former Member
0 Likes
1,498

When I pass the verification I obtain the next message:

You may not delete or overwrite table "IBSIS" within a LOOP through itself ...

I don´t understand, can you help me please,

LOOP AT IBSIS.
        BSIS = IBSIS-BSIS.
*----- Zur Stornierung vorgemerkte Posten ausschließen, ----------------
*----- z.B. Abgrenzungsposten ------------------------------------------
        CHECK BSIS-XSTOV = SPACE.
        CLEAR: XBSIS, XBSISGR.
*----- Fuellen der Gruppierungstabelle xbsisgr -------------------------
*----- und der Tabelle xbsis -------------------------------------------
*----- Sonderbearbeitung für WE/RE-Konten ------------------------------
        PERFORM XBSIS_XBSISGR_FUELLEN.
        DELETE IBSIS.
        IF X_EXIT = 'X'.
          REFRESH IBSIS.
          EXIT.
        ENDIF.
      ENDLOOP.

Cordial greetings.

3 REPLIES 3
Read only

naimesh_patel
Active Contributor
0 Likes
880

Try with deleting with help of INDEX


LOOP AT IBSIS.
L_INDEX = SY-TABIX.
        BSIS = IBSIS-BSIS.
*----- Zur Stornierung vorgemerkte Posten ausschließen, ----------------
*----- z.B. Abgrenzungsposten ------------------------------------------
        CHECK BSIS-XSTOV = SPACE.
        CLEAR: XBSIS, XBSISGR.
*----- Fuellen der Gruppierungstabelle xbsisgr -------------------------
*----- und der Tabelle xbsis -------------------------------------------
*----- Sonderbearbeitung für WE/RE-Konten ------------------------------
        PERFORM XBSIS_XBSISGR_FUELLEN.
        DELETE IBSIS INDEX L_INDEX.
        IF X_EXIT = 'X'.
          REFRESH IBSIS.
          EXIT.
        ENDIF.
      ENDLOOP.

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
880

you can't delete the entire table while you're looping through it. Is that what you're trying to do?

if so, you need to exit the loop then delete the table.

if you are trying to delete just a row out of it, you need to specify that with the INDEX argument.

regards,

robert.

EDIT - Naimesh gave a good hint.. but also, there's a REFRESH IBSIS in there that will trigger a short dump if executed in the loop.

Edited by: robert phelan on May 14, 2008 6:29 PM

Read only

Former Member
0 Likes
880

hi,

If i have understood your question correctly .. do this way ...


LOOP AT IBSIS.
    LV_INDEX = SY-TABIX.  
      BSIS = IBSIS-BSIS.
*----- Zur Stornierung vorgemerkte Posten ausschließen, ----------------
*----- z.B. Abgrenzungsposten ------------------------------------------
        CHECK BSIS-XSTOV = SPACE.
        CLEAR: XBSIS, XBSISGR.
*----- Fuellen der Gruppierungstabelle xbsisgr -------------------------
*----- und der Tabelle xbsis -------------------------------------------
*----- Sonderbearbeitung für WE/RE-Konten ------------------------------
        PERFORM XBSIS_XBSISGR_FUELLEN.
*        DELETE IBSIS.
        IBSIS-FLAG = 'X'.
        IF X_EXIT = 'X'.
*          REFRESH IBSIS.
           CLEAR IBSIS.
          EXIT.
        ENDIF.
      MODIFY IBSIS INDEX LV_INDEX TRANSPORTING FLAG.
      ENDLOOP.

  DELETE IBSIS WHERE FLAG = 'X'.